-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't ICE if method receiver fails to unify with arbitrary_self_types
- Loading branch information
1 parent
1b67f8b
commit 05c5caa
Showing
3 changed files
with
42 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#![feature(arbitrary_self_types)] | ||
|
||
use std::ops::Deref; | ||
|
||
struct Foo(u32); | ||
impl Foo { | ||
fn get<R: Deref<Target=Self>>(self: R) -> u32 { | ||
self.0 | ||
} | ||
} | ||
|
||
fn main() { | ||
let mut foo = Foo(1); | ||
foo.get::<&Foo>(); | ||
//~^ ERROR mismatched types | ||
} |
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,9 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/arbitrary-self-from-method-substs.rs:14:5 | ||
| | ||
LL | foo.get::<&Foo>(); | ||
| ^^^ expected `&Foo`, found `Foo` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |