forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch
can_eq
and can_sub
to DefineOpaqueTypes::Yes
They are mostly used in diagnostics anyway
- Loading branch information
Showing
4 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![feature(type_alias_impl_trait)] | ||
struct Foo; | ||
|
||
type Bar = impl Sized; | ||
//~^ ERROR unconstrained opaque type | ||
|
||
impl Foo { | ||
fn foo(self: Bar) {} | ||
//~^ ERROR: invalid `self` parameter type: Bar | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error: unconstrained opaque type | ||
--> $DIR/arbitrary-self-opaque.rs:4:12 | ||
| | ||
LL | type Bar = impl Sized; | ||
| ^^^^^^^^^^ | ||
| | ||
= note: `Bar` must be used in combination with a concrete type within the same module | ||
|
||
error[E0307]: invalid `self` parameter type: Bar | ||
--> $DIR/arbitrary-self-opaque.rs:8:18 | ||
| | ||
LL | fn foo(self: Bar) {} | ||
| ^^^ | ||
| | ||
= note: type of `self` must be `Self` or a type that dereferences to it | ||
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`) | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0307`. |