Add broken MIR regression tests
This commit is contained in:
parent
193b748d5f
commit
57ff5899d2
4 changed files with 51 additions and 0 deletions
17
src/test/ui/const-generics/broken-mir-1.rs
Normal file
17
src/test/ui/const-generics/broken-mir-1.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
// run-pass
|
||||
|
||||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
|
||||
pub trait Foo {
|
||||
fn foo(&self);
|
||||
}
|
||||
|
||||
|
||||
impl<T, const N: usize> Foo for [T; N] {
|
||||
fn foo(&self) {
|
||||
let _ = &self;
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
6
src/test/ui/const-generics/broken-mir-1.stderr
Normal file
6
src/test/ui/const-generics/broken-mir-1.stderr
Normal file
|
@ -0,0 +1,6 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
--> $DIR/broken-mir-1.rs:3:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
9
src/test/ui/const-generics/broken-mir-2.rs
Normal file
9
src/test/ui/const-generics/broken-mir-2.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
#![feature(const_generics)]
|
||||
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
|
||||
use std::fmt::Debug;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct S<T: Debug, const N: usize>([T; N]); //~ ERROR `[T; N]` doesn't implement `std::fmt::Debug`
|
||||
|
||||
fn main() {}
|
19
src/test/ui/const-generics/broken-mir-2.stderr
Normal file
19
src/test/ui/const-generics/broken-mir-2.stderr
Normal file
|
@ -0,0 +1,19 @@
|
|||
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
|
||||
--> $DIR/broken-mir-2.rs:1:12
|
||||
|
|
||||
LL | #![feature(const_generics)]
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0277]: `[T; N]` doesn't implement `std::fmt::Debug`
|
||||
--> $DIR/broken-mir-2.rs:7:36
|
||||
|
|
||||
LL | struct S<T: Debug, const N: usize>([T; N]);
|
||||
| ^^^^^^ `[T; N]` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
||||
|
|
||||
= help: the trait `std::fmt::Debug` is not implemented for `[T; N]`
|
||||
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&[T; N]`
|
||||
= note: required for the cast to the object type `dyn std::fmt::Debug`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
Loading…
Add table
Add a link
Reference in a new issue