mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Rollup merge of #88348 - spastorino:field-types-tait-test, r=oli-obk
Add field types tait tests r? ```@oli-obk``` Related to #86727
This commit is contained in:
commit
af549368f3
20
src/test/ui/type-alias-impl-trait/field-types.rs
Normal file
20
src/test/ui/type-alias-impl-trait/field-types.rs
Normal file
@ -0,0 +1,20 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
// FIXME This should compile, but it currently doesn't
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
type Foo = impl Debug;
|
||||
//~^ ERROR: could not find defining uses
|
||||
|
||||
struct Bar {
|
||||
foo: Foo,
|
||||
}
|
||||
|
||||
fn bar() -> Bar {
|
||||
Bar { foo: "foo" }
|
||||
//~^ ERROR: mismatched types [E0308]
|
||||
}
|
||||
|
||||
fn main() {}
|
21
src/test/ui/type-alias-impl-trait/field-types.stderr
Normal file
21
src/test/ui/type-alias-impl-trait/field-types.stderr
Normal file
@ -0,0 +1,21 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/field-types.rs:16:16
|
||||
|
|
||||
LL | type Foo = impl Debug;
|
||||
| ---------- the expected opaque type
|
||||
...
|
||||
LL | Bar { foo: "foo" }
|
||||
| ^^^^^ expected opaque type, found `&str`
|
||||
|
|
||||
= note: expected opaque type `impl Debug`
|
||||
found reference `&'static str`
|
||||
|
||||
error: could not find defining uses
|
||||
--> $DIR/field-types.rs:8:12
|
||||
|
|
||||
LL | type Foo = impl Debug;
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
Loading…
Reference in New Issue
Block a user