add and update tests

This commit is contained in:
b-naber 2022-01-11 20:25:57 +01:00
parent 4c27d348ec
commit 7dac626092
4 changed files with 40 additions and 4 deletions

View File

@ -0,0 +1,12 @@
// check-pass
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
pub struct Foo<const N: usize>;
pub trait Bar<T> {}
impl<T> Bar<T> for Foo<{ 1 }> {}
impl<T> Bar<T> for Foo<{ 2 }> {}
fn main() {}

View File

@ -15,9 +15,20 @@ LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data
| | | |
| expected due to this | expected due to this
| |
= note: expected struct `A<'a, u16, {2u32}, {3u32}>` = note: expected struct `A<'a, u16, _, _>`
found struct `A<'b, u32, {2u32}, {3u32}>` found struct `A<'b, u32, _, _>`
error: aborting due to 2 previous errors error[E0308]: mismatched types
--> $DIR/types-mismatch-const-args.rs:18:41
|
LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
| |
| expected due to this
|
= note: expected struct `A<'a, u16, 4_u32, _>`
found struct `A<'b, u32, 2_u32, _>`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`. For more information about this error, try `rustc --explain E0308`.

View File

@ -20,6 +20,17 @@ LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data
= note: expected struct `A<'a, u16, _, _>` = note: expected struct `A<'a, u16, _, _>`
found struct `A<'b, u32, _, _>` found struct `A<'b, u32, _, _>`
error: aborting due to 2 previous errors error[E0308]: mismatched types
--> $DIR/types-mismatch-const-args.rs:18:41
|
LL | let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
| -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u16`, found `u32`
| |
| expected due to this
|
= note: expected struct `A<'a, u16, 4_u32, _>`
found struct `A<'b, u32, 2_u32, _>`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0308`. For more information about this error, try `rustc --explain E0308`.

View File

@ -15,6 +15,8 @@ fn a<'a, 'b>() {
//~^ ERROR mismatched types //~^ ERROR mismatched types
let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData }; let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
//~^ ERROR mismatched types //~^ ERROR mismatched types
let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
//~^ ERROR mismatched types
} }
pub fn main() {} pub fn main() {}