RFC #1733 (Trait Aliases): use of lifetime parameter in trait alias not detected #127725
Labels
A-lifetimes
Area: Lifetimes / regions
A-trait-objects
Area: trait objects, vtable layout
C-bug
Category: This is a bug.
F-trait_alias
`#![feature(trait_alias)]`
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
This is an issue with RFC rust-lang/rfcs#1733 (Trait Aliases, Tracking Issue #41517 ). I can't describe well what might be the issue, I just stumbled upon it with the following MVE:
The error output is as follows:
This is unexpected because clearly
'a
is being used equally in all cases! But in the cases where a trait alias is involved in the definition of the trait object type, the compiler doesn't detect this. I believe this is a bug, or at the very least extremely counterintuitive.I haven't experimented with this issue more to test the bounds of what exactly fails (such as
impl
instead ofdyn
, nested trait aliases,...) and might not have the time to either. For my use case the workaround of using an extension trait with blanket impl works, but trait aliases would clearly be the more semantically correct choice. I mostly just wanted you to be aware of this, so trait aliases don't stabilize with incorrect behavior. And of course, if this was already known and I just didn't read the conversation enough, just ignore me.The text was updated successfully, but these errors were encountered: