-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not require associated types with Self: Sized to uphold bounds when confirming object candidate #115467
Do not require associated types with Self: Sized to uphold bounds when confirming object candidate #115467
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// check-pass | ||
// revisions: current next | ||
//[next] compile-flags: -Ztrait-solver=next | ||
|
||
#![feature(return_position_impl_trait_in_trait)] | ||
|
||
fn main() { | ||
let vec: Vec<Box<dyn Trait>> = Vec::new(); | ||
|
||
for i in vec { | ||
i.fn_2(); | ||
} | ||
} | ||
|
||
trait OtherTrait {} | ||
|
||
trait Trait { | ||
fn fn_1(&self) -> impl OtherTrait | ||
where | ||
Self: Sized; | ||
|
||
fn fn_2(&self) -> bool; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// check-pass | ||
// revisions: current next | ||
//[next] compile-flags: -Ztrait-solver=next | ||
|
||
trait Foo { | ||
type Bar<'a> | ||
where | ||
Self: Sized; | ||
|
||
fn test(&self); | ||
} | ||
|
||
impl Foo for () { | ||
type Bar<'a> = () where Self: Sized; | ||
|
||
fn test(&self) {} | ||
} | ||
|
||
fn test(x: &dyn Foo) { | ||
x.test(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a change in stable behaviour (compiles now, errors on nightly) and needs an FCP There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess that's what you mean by "doesn't need re-litigation". Ugh... I agree, but we have procedures out of a reason, too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it does -- but if you think it needs one, then start an FCP 🤷 (edited for clarity, sorry the wording was kind of terse before 😅) |
||
} | ||
|
||
fn main() { | ||
test(&()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly sure why this diagnostic has come back -- it's kinda sketchy, but also it's kinda implemented sketchily. I kinda don't want to bother fixing it, but I guess could be convinced otherwise.