mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
20 lines
477 B
Rust
20 lines
477 B
Rust
//! This test shows how we fail selection in a way that can influence
|
|
//! selection in a code path that succeeds.
|
|
|
|
//@ revisions: next old
|
|
//@[next] compile-flags: -Znext-solver
|
|
|
|
fn is_trait<T: Trait<U>, U: Default>(_: T) -> U {
|
|
Default::default()
|
|
}
|
|
|
|
trait Trait<T> {}
|
|
impl<T: Send> Trait<u32> for T {}
|
|
impl<T> Trait<i32> for T {}
|
|
fn foo() -> impl Sized {
|
|
if false { is_trait(foo()) } else { Default::default() }
|
|
//~^ ERROR: type annotations needed
|
|
}
|
|
|
|
fn main() {}
|