]>
Commit | Line | Data |
---|---|---|
60c5eb7d XL |
1 | // We need to opt into the `never_type_fallback` feature |
2 | // to trigger the requirement that this is testing. | |
3 | #![feature(never_type, never_type_fallback)] | |
0531ce1d | 4 | |
041b39d2 | 5 | #![allow(unused)] |
8bb4bdeb XL |
6 | |
7 | trait Deserialize: Sized { | |
8 | fn deserialize() -> Result<Self, String>; | |
9 | } | |
10 | ||
11 | impl Deserialize for () { | |
12 | fn deserialize() -> Result<(), String> { | |
13 | Ok(()) | |
14 | } | |
15 | } | |
16 | ||
8bb4bdeb XL |
17 | trait ImplementedForUnitButNotNever {} |
18 | ||
19 | impl ImplementedForUnitButNotNever for () {} | |
20 | ||
21 | fn foo<T: ImplementedForUnitButNotNever>(_t: T) {} | |
e1599b0c | 22 | //~^ NOTE required by this bound in `foo` |
8bb4bdeb XL |
23 | |
24 | fn smeg() { | |
25 | let _x = return; | |
26 | foo(_x); | |
0531ce1d XL |
27 | //~^ ERROR the trait bound |
28 | //~| NOTE the trait `ImplementedForUnitButNotNever` is not implemented | |
29 | //~| NOTE the trait is implemented for `()` | |
8bb4bdeb XL |
30 | } |
31 | ||
32 | fn main() { | |
cc61c64b | 33 | smeg(); |
8bb4bdeb | 34 | } |