Skip to content

Commit dc85120

Browse files
committed
tests: add tests for #112630
Signed-off-by: David Wood <david@davidtw.co>
1 parent c2e1ae4 commit dc85120

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

tests/ui/cast/issue-112630-1.rs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn f(_: B) {}
2+
//~^ ERROR cannot find type `B` in this scope [E0412]
3+
4+
fn main() {
5+
let _ = [0; f as usize];
6+
}

tests/ui/cast/issue-112630-1.stderr

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0412]: cannot find type `B` in this scope
2+
--> $DIR/issue-112630-1.rs:1:9
3+
|
4+
LL | fn f(_: B) {}
5+
| ^ not found in this scope
6+
|
7+
help: you might be missing a type parameter
8+
|
9+
LL | fn f<B>(_: B) {}
10+
| +++
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0412`.

tests/ui/cast/issue-112630.rs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
enum Foo {
2+
Bar(B),
3+
//~^ ERROR cannot find type `B` in this scope [E0412]
4+
}
5+
6+
fn main() {
7+
let _ = [0; Foo::Bar as usize];
8+
}

tests/ui/cast/issue-112630.stderr

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0412]: cannot find type `B` in this scope
2+
--> $DIR/issue-112630.rs:2:9
3+
|
4+
LL | Bar(B),
5+
| ^ not found in this scope
6+
|
7+
help: you might be missing a type parameter
8+
|
9+
LL | enum Foo<B> {
10+
| +++
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)