about summary refs log tree commit diff
path: root/tests/ui/impl-trait/non-defining-uses/avoid-inference-constraints-from-blanket.rs
blob: bb3acfde5bc87c295c72054f26211f8ef9d32c0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
//@ check-pass

// Regression test for trait-system-refactor-initiative#205. Avoid constraining
// the opaque type when applying blanket impls.

trait Trait<T> {}

impl<T> Trait<T> for T {}
impl Trait<u32> for u64 {}

fn impls_trait<T: Trait<U>, U>() -> T {
    todo!()
}

fn foo() -> impl Sized {
    if false {
        // `opaque: Trait<u32>` shouldn't constrain `opaque` to `u32` via the blanket impl
        return impls_trait::<_, u32>();
    }
    1u64
}
fn main() {}