Add regression tests
This commit is contained in:
parent
9b87d22ea8
commit
f9e29b279c
2 changed files with 37 additions and 0 deletions
16
src/test/ui/consts/self_normalization.rs
Normal file
16
src/test/ui/consts/self_normalization.rs
Normal file
|
@ -0,0 +1,16 @@
|
|||
// compile-pass
|
||||
|
||||
fn testfn(_arr: &mut [();0]) {}
|
||||
|
||||
trait TestTrait {
|
||||
fn method();
|
||||
}
|
||||
|
||||
impl TestTrait for [(); 0] {
|
||||
fn method() {
|
||||
let mut arr: Self = [(); 0];
|
||||
testfn(&mut arr);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
21
src/test/ui/consts/self_normalization2.rs
Normal file
21
src/test/ui/consts/self_normalization2.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
// compile-pass
|
||||
|
||||
trait Gen<T> {
|
||||
fn gen(x: Self) -> T;
|
||||
}
|
||||
|
||||
struct A;
|
||||
|
||||
impl Gen<[(); 0]> for A {
|
||||
fn gen(x: Self) -> [(); 0] {
|
||||
[]
|
||||
}
|
||||
}
|
||||
|
||||
fn array() -> impl Gen<[(); 0]> {
|
||||
A
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let [] = Gen::gen(array());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue