Array repeat expression lengths must be monomorphic at MIR building time
This commit is contained in:
parent
9fe05e9456
commit
eed0d33a65
2 changed files with 40 additions and 12 deletions
25
src/test/ui/consts/associated_const_generic.rs
Normal file
25
src/test/ui/consts/associated_const_generic.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// check-pass
|
||||
|
||||
trait TraitA {
|
||||
const VALUE: usize;
|
||||
}
|
||||
|
||||
struct A;
|
||||
impl TraitA for A {
|
||||
const VALUE: usize = 1;
|
||||
}
|
||||
|
||||
trait TraitB {
|
||||
type MyA: TraitA;
|
||||
const VALUE: usize = Self::MyA::VALUE;
|
||||
}
|
||||
|
||||
struct B;
|
||||
impl TraitB for B {
|
||||
type MyA = A;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = [0; A::VALUE];
|
||||
let _ = [0; B::VALUE]; // Indirectly refers to `A::VALUE`
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue