File tree 2 files changed +41
-0
lines changed
src/test/ui/type-alias-impl-trait
2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ feature( type_alias_impl_trait) ]
2
+ #![ allow( dead_code) ]
3
+
4
+ // FIXME This should compile, but it currently doesn't
5
+
6
+ use std:: fmt:: Debug ;
7
+
8
+ type Foo = impl Debug ;
9
+ //~^ ERROR: could not find defining uses
10
+
11
+ struct Bar {
12
+ foo : Foo ,
13
+ }
14
+
15
+ fn bar ( ) -> Bar {
16
+ Bar { foo : "foo" }
17
+ //~^ ERROR: mismatched types [E0308]
18
+ }
19
+
20
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0308]: mismatched types
2
+ --> $DIR/field-types.rs:16:16
3
+ |
4
+ LL | type Foo = impl Debug;
5
+ | ---------- the expected opaque type
6
+ ...
7
+ LL | Bar { foo: "foo" }
8
+ | ^^^^^ expected opaque type, found `&str`
9
+ |
10
+ = note: expected opaque type `impl Debug`
11
+ found reference `&'static str`
12
+
13
+ error: could not find defining uses
14
+ --> $DIR/field-types.rs:8:12
15
+ |
16
+ LL | type Foo = impl Debug;
17
+ | ^^^^^^^^^^
18
+
19
+ error: aborting due to 2 previous errors
20
+
21
+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments