diff options
| -rw-r--r-- | src/test/compile-fail/defaulted-unit-warning.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/compile-fail/defaulted-unit-warning.rs b/src/test/compile-fail/defaulted-unit-warning.rs index 2b6bd01f907..5213a189714 100644 --- a/src/test/compile-fail/defaulted-unit-warning.rs +++ b/src/test/compile-fail/defaulted-unit-warning.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![allow(dead_code)] +#![allow(unreachable_code)] #![deny(resolve_trait_on_defaulted_unit)] trait Deserialize: Sized { @@ -30,6 +32,19 @@ fn doit() -> Result<(), String> { Ok(()) } +trait ImplementedForUnitButNotNever {} + +impl ImplementedForUnitButNotNever for () {} + +fn foo<T: ImplementedForUnitButNotNever>(_t: T) {} + +fn smeg() { + let _x = return; + foo(_x); + //~^ ERROR code relies on type + //~| WARNING previously accepted +} + fn main() { let _ = doit(); } |
