summary refs log tree commit diff
path: root/tests/ui/polymorphization/inline-incorrect-early-bound.rs
blob: e69e4a4faa05d6c931420c8435cee7304d5a6dc3 (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
26
27
// This test demonstrates an ICE that may occur when we try to resolve the instance
// of a impl that has different generics than the trait it's implementing. This ensures
// we first check that the args are compatible before resolving the body, just like
// we do in projection before substituting a GAT.
//
// When polymorphization is enabled, we check the optimized MIR for unused parameters.
// This will invoke the inliner, leading to this ICE.

//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes

trait Trait {
    fn foo<'a, K: 'a>(self, _: K);
}

impl Trait for () {
    #[inline]
    fn foo<K>(self, _: K) {
        //~^ ERROR lifetime parameters or bounds on method `foo` do not match the trait declaration
        todo!();
    }
}

pub fn qux<T>() {
    ().foo(());
}

fn main() {}