Skip to content

Commit

Permalink
Add regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Aug 5, 2019
1 parent 9b87d22 commit f9e29b2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/test/ui/consts/self_normalization.rs
@@ -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 changes: 21 additions & 0 deletions src/test/ui/consts/self_normalization2.rs
@@ -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());
}

0 comments on commit f9e29b2

Please sign in to comment.