Skip to content

Commit d7ed5a5

Browse files
committed
Unignore closure-bang.
This test was ignored long ago in rust-lang#20578 when the syntax for closures was changed. The current status is that a closure with an explicit `!` return type will trigger the `unreachable_code` lint which appears to be the original intent of the test (rust-lang#16836). A closure without a return type won't trigger the lint since the `!` type isn't inferred (AFAIK). This restores the test to its original form.
1 parent fd57c6b commit d7ed5a5

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed
+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
// ignore-test FIXME(#20574)
2-
31
#![deny(unreachable_code)]
42

53
fn main() {
6-
let x = || panic!();
4+
let x = || -> ! { panic!() };
75
x();
86
println!("Foo bar"); //~ ERROR: unreachable statement
97
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error: unreachable statement
2+
--> $DIR/closure-bang.rs:6:5
3+
|
4+
LL | x();
5+
| --- any code following this expression is unreachable
6+
LL | println!("Foo bar");
7+
| ^^^^^^^^^^^^^^^^^^^ unreachable statement
8+
|
9+
note: the lint level is defined here
10+
--> $DIR/closure-bang.rs:1:9
11+
|
12+
LL | #![deny(unreachable_code)]
13+
| ^^^^^^^^^^^^^^^^
14+
= note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
15+
16+
error: aborting due to previous error
17+

0 commit comments

Comments
 (0)