Add lazy normalization tests
This commit is contained in:
parent
4cfdd2178e
commit
3ef831069a
7 changed files with 167 additions and 3 deletions
24
src/test/ui/const-generics/issues/issue-61935.rs
Normal file
24
src/test/ui/const-generics/issues/issue-61935.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
|
||||
trait Foo {}
|
||||
|
||||
impl<const N: usize> Foo for [(); N]
|
||||
where
|
||||
Self:FooImpl<{N==0}>
|
||||
{}
|
||||
|
||||
trait FooImpl<const IS_ZERO: bool>{}
|
||||
|
||||
impl FooImpl<true> for [(); 0] {}
|
||||
|
||||
impl<const N:usize> FooImpl<false> for [();N] {}
|
||||
|
||||
fn foo(_: impl Foo) {}
|
||||
|
||||
fn main() {
|
||||
foo([]);
|
||||
foo([()]);
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
warning: the feature `const_generics` is incomplete and may not be safe to use and/or cause compiler crashes
|
||||
--> $DIR/issue-61336-1.rs:1:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
@ -7,5 +6,3 @@ LL | #![feature(const_generics)]
|
|||
= note: `#[warn(incomplete_features)]` on by default
|
||||
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
||||
32
src/test/ui/const-generics/issues/issue-67185-1.rs
Normal file
32
src/test/ui/const-generics/issues/issue-67185-1.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
|
||||
trait Baz {
|
||||
type Quaks;
|
||||
}
|
||||
impl Baz for u8 {
|
||||
type Quaks = [u16; 3];
|
||||
}
|
||||
|
||||
trait Bar {}
|
||||
impl Bar for [u16; 3] {}
|
||||
impl Bar for [[u16; 3]; 2] {}
|
||||
|
||||
trait Foo
|
||||
where
|
||||
[<u8 as Baz>::Quaks; 2]: Bar,
|
||||
<u8 as Baz>::Quaks: Bar,
|
||||
{
|
||||
}
|
||||
|
||||
struct FooImpl;
|
||||
|
||||
impl Foo for FooImpl {}
|
||||
|
||||
fn f(_: impl Foo) {}
|
||||
|
||||
fn main() {
|
||||
f(FooImpl)
|
||||
}
|
||||
8
src/test/ui/const-generics/issues/issue-67185-1.stderr
Normal file
8
src/test/ui/const-generics/issues/issue-67185-1.stderr
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
--> $DIR/issue-67185-1.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
34
src/test/ui/const-generics/issues/issue-67185-2.rs
Normal file
34
src/test/ui/const-generics/issues/issue-67185-2.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
|
||||
trait Baz {
|
||||
type Quaks;
|
||||
}
|
||||
impl Baz for u8 {
|
||||
type Quaks = [u16; 3];
|
||||
}
|
||||
|
||||
trait Bar {}
|
||||
impl Bar for [u16; 4] {}
|
||||
impl Bar for [[u16; 3]; 3] {}
|
||||
|
||||
trait Foo //~ ERROR mismatched types
|
||||
where
|
||||
[<u8 as Baz>::Quaks; 2]: Bar,
|
||||
<u8 as Baz>::Quaks: Bar,
|
||||
{
|
||||
}
|
||||
|
||||
struct FooImpl;
|
||||
|
||||
impl Foo for FooImpl {}
|
||||
//~^ ERROR mismatched types
|
||||
//~^^ ERROR mismatched types
|
||||
|
||||
fn f(_: impl Foo) {}
|
||||
//~^ ERROR mismatched types
|
||||
//~^^ ERROR mismatched types
|
||||
|
||||
fn main() {
|
||||
f(FooImpl)
|
||||
}
|
||||
61
src/test/ui/const-generics/issues/issue-67185-2.stderr
Normal file
61
src/test/ui/const-generics/issues/issue-67185-2.stderr
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
--> $DIR/issue-67185-2.rs:1:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(incomplete_features)]` on by default
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-67185-2.rs:15:1
|
||||
|
|
||||
LL | / trait Foo
|
||||
LL | | where
|
||||
LL | | [<u8 as Baz>::Quaks; 2]: Bar,
|
||||
LL | | <u8 as Baz>::Quaks: Bar,
|
||||
LL | | {
|
||||
LL | | }
|
||||
| |_^ expected `3usize`, found `4usize`
|
||||
|
|
||||
= note: expected type `3usize`
|
||||
found type `4usize`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-67185-2.rs:24:6
|
||||
|
|
||||
LL | impl Foo for FooImpl {}
|
||||
| ^^^ expected `3usize`, found `4usize`
|
||||
|
|
||||
= note: expected type `3usize`
|
||||
found type `4usize`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-67185-2.rs:24:6
|
||||
|
|
||||
LL | impl Foo for FooImpl {}
|
||||
| ^^^ expected `2usize`, found `3usize`
|
||||
|
|
||||
= note: expected type `2usize`
|
||||
found type `3usize`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-67185-2.rs:28:1
|
||||
|
|
||||
LL | fn f(_: impl Foo) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected `2usize`, found `3usize`
|
||||
|
|
||||
= note: expected type `2usize`
|
||||
found type `3usize`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-67185-2.rs:28:1
|
||||
|
|
||||
LL | fn f(_: impl Foo) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^ expected `3usize`, found `4usize`
|
||||
|
|
||||
= note: expected type `3usize`
|
||||
found type `4usize`
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// check-pass
|
||||
#![allow(incomplete_features)]
|
||||
#![feature(const_generics, lazy_normalization_consts)]
|
||||
|
||||
pub trait Foo<const B: bool> {}
|
||||
pub fn bar<T: Foo<{ true }>>() {}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue