mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Add regression tests
This commit is contained in:
parent
9b87d22ea8
commit
f9e29b279c
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…
Reference in New Issue
Block a user