Skip to content

Commit b9b53c8

Browse files
authored
Rollup merge of #88201 - spastorino:tait-incomplete-inference-test, r=oli-obk
Test that incomplete inference for TAITs fail r? `@oli-obk` Related to #86727
2 parents 1d0d7c3 + 29dffe5 commit b9b53c8

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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 numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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`.

0 commit comments

Comments
 (0)