1
Fork 0

Add broken MIR regression tests

This commit is contained in:
varkor 2019-05-20 23:03:38 +01:00
parent 193b748d5f
commit 57ff5899d2
4 changed files with 51 additions and 0 deletions

View 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() {}

View 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)]
| ^^^^^^^^^^^^^^

View 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() {}

View 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`.