diff options
| author | Andrew Cann <shum@canndrew.org> | 2017-02-04 14:17:58 +0800 |
|---|---|---|
| committer | Andrew Cann <shum@canndrew.org> | 2017-02-04 14:17:58 +0800 |
| commit | 42f3ac5ea610b351e404dd30199d13ffc91617d5 (patch) | |
| tree | b640eda9ffceead228da70c5ff011d0f734409e5 /src/test/compile-fail | |
| parent | 7444d07154652c4d7a3e91e645eaa604a8bc4c84 (diff) | |
| download | rust-42f3ac5ea610b351e404dd30199d13ffc91617d5.tar.gz rust-42f3ac5ea610b351e404dd30199d13ffc91617d5.zip | |
Expand defaulted unit test
Diffstat (limited to 'src/test/compile-fail')
| -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(); } |
