File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
src/test/ui/type-alias-impl-trait Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( type_alias_impl_trait) ]
2+
3+ type Foo = impl Sized ;
4+
5+ fn bar ( ) -> Foo {
6+ None
7+ //~^ ERROR: type annotations needed [E0282]
8+ }
9+
10+ fn baz ( ) -> Foo {
11+ //~^ ERROR: concrete type differs from previous defining opaque type use
12+ Some ( ( ) )
13+ }
14+
15+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0282]: type annotations needed
2+ --> $DIR/incomplete-inference.rs:6:5
3+ |
4+ LL | None
5+ | ^^^^ cannot infer type for type parameter `T` declared on the enum `Option`
6+
7+ error: concrete type differs from previous defining opaque type use
8+ --> $DIR/incomplete-inference.rs:10:1
9+ |
10+ LL | fn baz() -> Foo {
11+ | ^^^^^^^^^^^^^^^ expected `[type error]`, got `Option<()>`
12+ |
13+ note: previous use here
14+ --> $DIR/incomplete-inference.rs:5:1
15+ |
16+ LL | fn bar() -> Foo {
17+ | ^^^^^^^^^^^^^^^
18+
19+ error: aborting due to 2 previous errors
20+
21+ For more information about this error, try `rustc --explain E0282`.
You can’t perform that action at this time.
0 commit comments