add test for ice 83056 "bad input type for cast"

Fixes #83056
This commit is contained in:
Matthias Krüger 2024-03-22 18:18:56 +01:00
parent 19310ce2cc
commit 445507a19d
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,6 @@
// #83056 ICE "bad input type for cast"
struct S([bool; f as usize]);
fn f() -> T {}
//~^ ERROR cannot find type `T` in this scope
pub fn main() {}

View File

@ -0,0 +1,20 @@
error[E0412]: cannot find type `T` in this scope
--> $DIR/ice-bad-input-type-for-cast-83056.rs:4:11
|
LL | struct S([bool; f as usize]);
| ----------------------------- similarly named struct `S` defined here
LL | fn f() -> T {}
| ^
|
help: a struct with a similar name exists
|
LL | fn f() -> S {}
| ~
help: you might be missing a type parameter
|
LL | fn f<T>() -> T {}
| +++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0412`.