1 // This is a minified example from Crater breakage observed when attempting to
2 // stabilize never type, nstoddard/webgl-gui @ 22f0169f.
4 // This particular test case currently fails as the inference to `()` rather
5 // than `!` happens as a result of an `as` cast, which is not currently tracked.
6 // Crater did not find many cases of this occurring, but it is included for
9 // revisions: nofallback fallback
10 //[nofallback] check-pass
11 //[fallback] check-fail
13 #![cfg_attr(fallback, feature(never_type_fallback))]
15 use std::marker::PhantomData;
18 let error = Closure::wrap(Box::new(move || {
19 //[fallback]~^ to be a closure that returns `()`, but it returns `!`
20 panic!("Can't connect to server.");
21 }) as Box<dyn FnMut()>);
24 struct Closure<T: ?Sized>(PhantomData<T>);
26 impl<T: ?Sized> Closure<T> {
27 fn wrap(data: Box<T>) -> Closure<T> {