summaryrefslogtreecommitdiffstats
path: root/tests/ui/typeck/issue-114918/const-in-impl-fn-return-type.rs
blob: a1b9a7eba4da70f77727d53d883a4490f67cb85a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Regression test for #114918
// Test that a const generic enclosed in a block within the return type
// of an impl fn produces a type mismatch error instead of triggering
// a const eval cycle


trait Trait {
    fn func<const N: u32>() -> [ (); N ];
}

struct S {}

#[allow(unused_braces)]
impl Trait for S {
    fn func<const N: u32>() -> [ (); { () }] { //~ ERROR mismatched types
        N
    }
}

fn main() {}