Test that incomplete inference for TAITs fail

上级 a9ab2e55
#![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() {}
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`.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册