We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3499da6 commit 951a38cCopy full SHA for 951a38c
src/test/ui/never_type/never-value-fallback-issue-66757.rs
@@ -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