-
Notifications
You must be signed in to change notification settings - Fork 13.8k
default auto traits: use default supertraits instead of Self: Trait
bounds on associated items
#145879
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
default auto traits: use default supertraits instead of Self: Trait
bounds on associated items
#145879
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 |
---|---|---|
|
@@ -21,6 +21,20 @@ fn bar<T: ?Sized + ?Trait2 + ?Trait1 + ?Trait4>(_: &T) {} | |
|
||
// FIXME: `?Trait1` should be rejected, `Trait1` isn't marked `#[lang = "default_traitN"]`. | ||
fn baz<T>() where T: Iterator<Item: ?Trait1> {} | ||
//~^ ERROR this relaxed bound is not permitted here | ||
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. Please remove the above FIXME 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. Moreover this test is quite a mixed bag, it's unclear what the test intentions are. In #142693 I almost deleted it for that reason but I kept it to track bugs pertaining to I don't think we should test "this relaxed bound is not permitted here" in this file, I'd advise you to create a new one whose name is based on 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. From my understanding there are 2 checks for relaxed bounds consistency:
This PR fixes the first check but not the second and therefore FIXME comments in this file are still relevant. So, your suggestion is to keep these checks in separate files for readability reasons, right? In my opinion it isn't very useful because the invocation of second check implies that the first check has already been invoked. That is, the test that covers the second check also covers the first one. |
||
|
||
struct S1<T>(T); | ||
|
||
impl<T> S1<T> { | ||
fn f() where T: ?Trait1 {} | ||
//~^ ERROR this relaxed bound is not permitted here | ||
} | ||
|
||
trait Trait5<'a> {} | ||
|
||
struct S2<T>(T) where for<'a> T: ?Trait5<'a>; | ||
//~^ ERROR this relaxed bound is not permitted here | ||
//~| ERROR bound modifier `?` can only be applied to default traits like `Sized` | ||
|
||
struct S; | ||
impl !Trait2 for S {} | ||
|
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.