Skip to content

Commit

Permalink
tests: add tests for #112630
Browse files Browse the repository at this point in the history
Signed-off-by: David Wood <[email protected]>
  • Loading branch information
davidtwco committed Jul 12, 2023
1 parent c2e1ae4 commit dc85120
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/ui/cast/issue-112630-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fn f(_: B) {}
//~^ ERROR cannot find type `B` in this scope [E0412]

fn main() {
let _ = [0; f as usize];
}
14 changes: 14 additions & 0 deletions tests/ui/cast/issue-112630-1.stderr
Original file line number Diff line number Diff line change
@@ -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>(_: B) {}
| +++

error: aborting due to previous error

For more information about this error, try `rustc --explain E0412`.
8 changes: 8 additions & 0 deletions tests/ui/cast/issue-112630.rs
Original file line number Diff line number Diff line change
@@ -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];
}
14 changes: 14 additions & 0 deletions tests/ui/cast/issue-112630.stderr
Original file line number Diff line number Diff line change
@@ -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<B> {
| +++

error: aborting due to previous error

For more information about this error, try `rustc --explain E0412`.

0 comments on commit dc85120

Please sign in to comment.