blob: 9a41b9c8173afee2a6697719eb34126108028915 (
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
28
29
30
31
32
33
|
// 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.
//
// Regression test for issue #125877.
//@ compile-flags: -Znext-solver
//@ normalize-stderr: "you are using [0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?( \([^)]*\))?" -> "you are using $$RUSTC_VERSION"
#![feature(const_trait_impl, effects)]
//~^ ERROR feature has been removed
#[const_trait]
trait Main {
fn compute<T: ~const Aux>() -> u32;
}
impl const Main for () {
fn compute<'x>() -> u32 {
//~^ ERROR associated function `compute` has 0 type parameters but its trait declaration has 1 type parameter
0
}
}
#[const_trait]
trait Aux {}
impl const Aux for () {}
fn main() {
const _: u32 = <()>::compute::<()>();
}
|