blob: af0577ac0609fcb24d9eaad0302819b6f5787771 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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!()
}
}
|