]> git.lizzy.rs Git - rust.git/blob - tests/ui/never_type/diverging-fallback-no-leak.rs
Rollup merge of #106701 - ibraheemdev:sync-sender-spin, r=Amanieu
[rust.git] / tests / ui / never_type / diverging-fallback-no-leak.rs
1 // revisions: nofallback fallback
2 //[nofallback] check-pass
3
4 #![cfg_attr(fallback, feature(never_type, never_type_fallback))]
5
6 fn make_unit() {}
7
8 trait Test {}
9 impl Test for i32 {}
10 impl Test for () {}
11
12 fn unconstrained_arg<T: Test>(_: T) {}
13
14 fn main() {
15     // Here the type variable falls back to `!`,
16     // and hence we get a type error.
17     unconstrained_arg(return);
18     //[fallback]~^ ERROR trait bound `!: Test` is not satisfied
19 }