diff --git a/tests/ui/cast/issue-112630-1.rs b/tests/ui/cast/issue-112630-1.rs new file mode 100644 index 0000000000000..c392f3ad4436d --- /dev/null +++ b/tests/ui/cast/issue-112630-1.rs @@ -0,0 +1,6 @@ +fn f(_: B) {} +//~^ ERROR cannot find type `B` in this scope [E0412] + +fn main() { + let _ = [0; f as usize]; +} diff --git a/tests/ui/cast/issue-112630-1.stderr b/tests/ui/cast/issue-112630-1.stderr new file mode 100644 index 0000000000000..79adb7c6ce6a0 --- /dev/null +++ b/tests/ui/cast/issue-112630-1.stderr @@ -0,0 +1,14 @@ +error[E0412]: cannot find type `B` in this scope + --> $DIR/issue-112630-1.rs:1:9 + | +LL | fn f(_: B) {} + | ^ not found in this scope + | +help: you might be missing a type parameter + | +LL | fn f(_: B) {} + | +++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/cast/issue-112630.rs b/tests/ui/cast/issue-112630.rs new file mode 100644 index 0000000000000..abae887b9a490 --- /dev/null +++ b/tests/ui/cast/issue-112630.rs @@ -0,0 +1,8 @@ +enum Foo { + Bar(B), + //~^ ERROR cannot find type `B` in this scope [E0412] +} + +fn main() { + let _ = [0; Foo::Bar as usize]; +} diff --git a/tests/ui/cast/issue-112630.stderr b/tests/ui/cast/issue-112630.stderr new file mode 100644 index 0000000000000..04910fc557756 --- /dev/null +++ b/tests/ui/cast/issue-112630.stderr @@ -0,0 +1,14 @@ +error[E0412]: cannot find type `B` in this scope + --> $DIR/issue-112630.rs:2:9 + | +LL | Bar(B), + | ^ not found in this scope + | +help: you might be missing a type parameter + | +LL | enum Foo { + | +++ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0412`.