Skip to content

Commit edfdb92

Browse files
committed
Add ui test unreachable-by-call-arguments-issue-139627.rs
Signed-off-by: xizheyin <[email protected]>
1 parent 6e83046 commit edfdb92

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![deny(unreachable_code)]
2+
#![deny(unused)]
3+
4+
pub enum Void {}
5+
6+
pub struct S<T>(T);
7+
8+
pub fn foo(void: Void, void1: Void) { //~ ERROR unused variable: `void1`
9+
let s = S(void); //~ ERROR unused variable: `s`
10+
drop(s); //~ ERROR unreachable expression
11+
let s1 = S { 0: void1 };
12+
drop(s1);
13+
}
14+
15+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
error: unreachable expression
2+
--> $DIR/unreachable-by-call-arguments-issue-139627.rs:10:10
3+
|
4+
LL | let s = S(void);
5+
| ------- any code following this expression is unreachable
6+
LL | drop(s);
7+
| ^ unreachable expression
8+
|
9+
note: this expression has type `S<Void>`, which is uninhabited
10+
--> $DIR/unreachable-by-call-arguments-issue-139627.rs:9:13
11+
|
12+
LL | let s = S(void);
13+
| ^^^^^^^
14+
note: the lint level is defined here
15+
--> $DIR/unreachable-by-call-arguments-issue-139627.rs:2:9
16+
|
17+
LL | #![deny(unused)]
18+
| ^^^^^^
19+
= note: `#[deny(unreachable_code)]` implied by `#[deny(unused)]`
20+
21+
error: unused variable: `s`
22+
--> $DIR/unreachable-by-call-arguments-issue-139627.rs:9:9
23+
|
24+
LL | let s = S(void);
25+
| ^ help: if this is intentional, prefix it with an underscore: `_s`
26+
|
27+
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
28+
29+
error: unused variable: `void1`
30+
--> $DIR/unreachable-by-call-arguments-issue-139627.rs:8:24
31+
|
32+
LL | pub fn foo(void: Void, void1: Void) {
33+
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_void1`
34+
35+
error: aborting due to 3 previous errors
36+

0 commit comments

Comments
 (0)