add and update tests
This commit is contained in:
parent
4c27d348ec
commit
7dac626092
12
src/test/ui/const-generics/issues/issue-92186.rs
Normal file
12
src/test/ui/const-generics/issues/issue-92186.rs
Normal 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() {}
|
@ -15,9 +15,20 @@ LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
= note: expected struct `A<'a, u16, {2u32}, {3u32}>`
|
||||
found struct `A<'b, u32, {2u32}, {3u32}>`
|
||||
= note: expected struct `A<'a, u16, _, _>`
|
||||
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`.
|
||||
|
@ -20,6 +20,17 @@ LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data
|
||||
= note: expected struct `A<'a, u16, _, _>`
|
||||
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`.
|
||||
|
@ -15,6 +15,8 @@ fn a<'a, 'b>() {
|
||||
//~^ ERROR mismatched types
|
||||
let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
|
||||
//~^ ERROR mismatched types
|
||||
let _: A<'a, u16, {4u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data: PhantomData };
|
||||
//~^ ERROR mismatched types
|
||||
}
|
||||
|
||||
pub fn main() {}
|
||||
|
Loading…
Reference in New Issue
Block a user