-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-trait-systemArea: Trait systemArea: Trait systemI-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
This makes things unsound. Here is an example from @eddyb:
pub trait MakeRef<'a> {
type Ref;
}
impl<'a, T: 'a> MakeRef<'a> for T {
type Ref = &'a T;
}
pub trait MakeRef2 {
type Ref2;
}
impl<'a, T> MakeRef2 for T {
type Ref2 = <T as MakeRef<'a>>::Ref;
}
fn foo() -> <String as MakeRef2>::Ref2 { &String::from("foo") }
fn main() {
println!("{}", foo());
}
This should be prohibited by https://github.com/rust-lang/rfcs/blob/master/text/0447-no-unused-impl-parameters.md, but it seems there is some bug.
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemI-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.