-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
39323a5
commit 90a8d67
Showing
3 changed files
with
39 additions
and
1 deletion.
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,24 @@ | ||
#![feature(return_position_impl_trait_in_trait)] | ||
#![allow(incomplete_features)] | ||
|
||
use std::fmt::Display; | ||
use std::ops::Deref; | ||
|
||
trait Foo { | ||
fn bar(self) -> impl Deref<Target = impl Display + ?Sized>; | ||
} | ||
|
||
struct A; | ||
|
||
impl Foo for A { | ||
fn bar(self) -> &'static str { | ||
"Hello, world" | ||
} | ||
} | ||
|
||
fn foo<T: Foo>(t: T) { | ||
let () = t.bar(); | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
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,14 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-102571.rs:20:9 | ||
| | ||
LL | let () = t.bar(); | ||
| ^^ ------- this expression has type `impl Deref<Target = impl std::fmt::Display + ?Sized>` | ||
| | | ||
| expected associated type, found `()` | ||
| | ||
= note: expected associated type `impl Deref<Target = impl std::fmt::Display + ?Sized>` | ||
found unit type `()` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |