Skip to content

Commit 951a38c

Browse files
author
Nicholas Matsakis
committed
Add regression test for #66757
1 parent 3499da6 commit 951a38c

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Regression test for #66757
2+
//
3+
// Test than when you have a `!` value (e.g., the local variable
4+
// never) and an uninferred variable (here the argument to `From`) it
5+
// doesn't fallback to `()` but rather `!`.
6+
//
7+
// run-pass
8+
9+
#![feature(never_type)]
10+
11+
// FIXME(#67225) -- this should be true even without the fallback gate.
12+
#![feature(never_type_fallback)]
13+
14+
struct E;
15+
16+
impl From<!> for E {
17+
fn from(_: !) -> E {
18+
E
19+
}
20+
}
21+
22+
#[allow(unreachable_code)]
23+
#[allow(dead_code)]
24+
fn foo(never: !) {
25+
<E as From<!>>::from(never); // Ok
26+
<E as From<_>>::from(never); // Inference fails here
27+
}
28+
29+
fn main() { }

0 commit comments

Comments
 (0)