about summary refs log tree commit diff
path: root/tests/ui/impl-trait/auto-trait-selection.rs
blob: ee5612459c2577e85f4091d183b3b6fa2865a8b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! 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() {}