mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Test that incomplete inference for TAITs fail
This commit is contained in:
parent
a9ab2e5539
commit
29dffe5176
15
src/test/ui/type-alias-impl-trait/incomplete-inference.rs
Normal file
15
src/test/ui/type-alias-impl-trait/incomplete-inference.rs
Normal file
@ -0,0 +1,15 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
type Foo = impl Sized;
|
||||
|
||||
fn bar() -> Foo {
|
||||
None
|
||||
//~^ ERROR: type annotations needed [E0282]
|
||||
}
|
||||
|
||||
fn baz() -> Foo {
|
||||
//~^ ERROR: concrete type differs from previous defining opaque type use
|
||||
Some(())
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -0,0 +1,21 @@
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/incomplete-inference.rs:6:5
|
||||
|
|
||||
LL | None
|
||||
| ^^^^ cannot infer type for type parameter `T` declared on the enum `Option`
|
||||
|
||||
error: concrete type differs from previous defining opaque type use
|
||||
--> $DIR/incomplete-inference.rs:10:1
|
||||
|
|
||||
LL | fn baz() -> Foo {
|
||||
| ^^^^^^^^^^^^^^^ expected `[type error]`, got `Option<()>`
|
||||
|
|
||||
note: previous use here
|
||||
--> $DIR/incomplete-inference.rs:5:1
|
||||
|
|
||||
LL | fn bar() -> Foo {
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0282`.
|
Loading…
Reference in New Issue
Block a user