Skip to content

Commit 42f3ac5

Browse files
committed
Expand defaulted unit test
1 parent 7444d07 commit 42f3ac5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: src/test/compile-fail/defaulted-unit-warning.rs

+15
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![allow(dead_code)]
12+
#![allow(unreachable_code)]
1113
#![deny(resolve_trait_on_defaulted_unit)]
1214

1315
trait Deserialize: Sized {
@@ -30,6 +32,19 @@ fn doit() -> Result<(), String> {
3032
Ok(())
3133
}
3234

35+
trait ImplementedForUnitButNotNever {}
36+
37+
impl ImplementedForUnitButNotNever for () {}
38+
39+
fn foo<T: ImplementedForUnitButNotNever>(_t: T) {}
40+
41+
fn smeg() {
42+
let _x = return;
43+
foo(_x);
44+
//~^ ERROR code relies on type
45+
//~| WARNING previously accepted
46+
}
47+
3348
fn main() {
3449
let _ = doit();
3550
}

0 commit comments

Comments
 (0)