-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/type-alias-impl-trait/incomplete-inference.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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`. |