-
Notifications
You must be signed in to change notification settings - Fork 13.5k
prevent specialized negative impls #74648
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
Changes from 1 commit
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ trait MyTrait { | |
type Foo; | ||
} | ||
|
||
default impl !MyTrait for u32 {} //~ ERROR auto traits must not contain where bounds | ||
default impl !MyTrait for u32 {} | ||
//~^ ERROR negative impls on primitive types must not contain where bounds | ||
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. what is the "where bound" 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. it seems like it's more about the |
||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
#![feature(negative_impls)] | ||
|
||
// Test a negative impl for a trait requires `T: ?Sized`. | ||
// Test that negative impls for a trait requires `T: ?Sized`. | ||
|
||
trait MyTrait {} | ||
|
||
impl<T> !MyTrait for T {} //~ ERROR auto traits must not contain where bounds | ||
impl<T> !MyTrait for T {} | ||
//~^ ERROR negative impls on type parameters must not contain where bounds | ||
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. is there any way to highlight the
|
||
|
||
fn main() {} |
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.
do we disallow negative impls for all tuples? (I think that'd be ok, actually, though I think we could also permit them for tuples if they are only restricted based on arity, but I don't see the point.)
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.
I think allowing them for tuples will prevent us from ever adding variadic tuples, so it should be easier to just disallow them for now