Add test for issue-67739

This commit is contained in:
Yuki Okushi 2020-03-13 09:04:14 +09:00
parent a2c41e9cdc
commit 3609bac340
No known key found for this signature in database
GPG Key ID: B0986C85C0E2DAA1
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,18 @@
// Regression test for #67739
#![allow(incomplete_features)]
#![feature(const_generics)]
use std::mem;
pub trait Trait {
type Associated: Sized;
fn associated_size(&self) -> usize {
[0u8; mem::size_of::<Self::Associated>()];
//~^ ERROR: array lengths can't depend on generic parameters
0
}
}
fn main() {}

View File

@ -0,0 +1,8 @@
error: array lengths can't depend on generic parameters
--> $DIR/issue-67739.rs:12:15
|
LL | [0u8; mem::size_of::<Self::Associated>()];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error