提交 dc49b2cd 编写于 作者: N Niko Matsakis

Add regression test for #66757

上级 d2861130
// Regression test for #66757
//
// Test than when you have a `!` value (e.g., the local variable
// never) and an uninferred variable (here the argument to `From`) it
// doesn't fallback to `()` but rather `!`.
//
// run-pass
#![feature(never_type)]
// FIXME(#67225) -- this should be true even without the fallback gate.
#![feature(never_type_fallback)]
struct E;
impl From<!> for E {
fn from(_: !) -> E {
E
}
}
#[allow(unreachable_code)]
#[allow(dead_code)]
fn foo(never: !) {
<E as From<!>>::from(never); // Ok
<E as From<_>>::from(never); // Inference fails here
}
fn main() { }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册