diff options
Diffstat (limited to 'src/test/ui/never_type/fallback-closure-wrap.rs')
-rw-r--r-- | src/test/ui/never_type/fallback-closure-wrap.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/ui/never_type/fallback-closure-wrap.rs b/src/test/ui/never_type/fallback-closure-wrap.rs new file mode 100644 index 000000000..af0577ac0 --- /dev/null +++ b/src/test/ui/never_type/fallback-closure-wrap.rs @@ -0,0 +1,30 @@ +// This is a minified example from Crater breakage observed when attempting to +// stabilize never type, nstoddard/webgl-gui @ 22f0169f. +// +// This particular test case currently fails as the inference to `()` rather +// than `!` happens as a result of an `as` cast, which is not currently tracked. +// Crater did not find many cases of this occuring, but it is included for +// awareness. +// +// revisions: nofallback fallback +//[nofallback] check-pass +//[fallback] check-fail + +#![cfg_attr(fallback, feature(never_type_fallback))] + +use std::marker::PhantomData; + +fn main() { + let error = Closure::wrap(Box::new(move || { + //[fallback]~^ ERROR type mismatch resolving + panic!("Can't connect to server."); + }) as Box<dyn FnMut()>); +} + +struct Closure<T: ?Sized>(PhantomData<T>); + +impl<T: ?Sized> Closure<T> { + fn wrap(data: Box<T>) -> Closure<T> { + todo!() + } +} |