From 57ff5899d22fd0b898784b3b55b1dacad27664c6 Mon Sep 17 00:00:00 2001 From: varkor Date: Mon, 20 May 2019 23:03:38 +0100 Subject: [PATCH] Add broken MIR regression tests --- src/test/ui/const-generics/broken-mir-1.rs | 17 +++++++++++++++++ .../ui/const-generics/broken-mir-1.stderr | 6 ++++++ src/test/ui/const-generics/broken-mir-2.rs | 9 +++++++++ .../ui/const-generics/broken-mir-2.stderr | 19 +++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 src/test/ui/const-generics/broken-mir-1.rs create mode 100644 src/test/ui/const-generics/broken-mir-1.stderr create mode 100644 src/test/ui/const-generics/broken-mir-2.rs create mode 100644 src/test/ui/const-generics/broken-mir-2.stderr diff --git a/src/test/ui/const-generics/broken-mir-1.rs b/src/test/ui/const-generics/broken-mir-1.rs new file mode 100644 index 00000000000..9a11bd3d031 --- /dev/null +++ b/src/test/ui/const-generics/broken-mir-1.rs @@ -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 Foo for [T; N] { + fn foo(&self) { + let _ = &self; + } +} + +fn main() {} diff --git a/src/test/ui/const-generics/broken-mir-1.stderr b/src/test/ui/const-generics/broken-mir-1.stderr new file mode 100644 index 00000000000..55dc7fcb7cc --- /dev/null +++ b/src/test/ui/const-generics/broken-mir-1.stderr @@ -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)] + | ^^^^^^^^^^^^^^ + diff --git a/src/test/ui/const-generics/broken-mir-2.rs b/src/test/ui/const-generics/broken-mir-2.rs new file mode 100644 index 00000000000..2c93ed0defd --- /dev/null +++ b/src/test/ui/const-generics/broken-mir-2.rs @@ -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; N]); //~ ERROR `[T; N]` doesn't implement `std::fmt::Debug` + +fn main() {} diff --git a/src/test/ui/const-generics/broken-mir-2.stderr b/src/test/ui/const-generics/broken-mir-2.stderr new file mode 100644 index 00000000000..162153573a1 --- /dev/null +++ b/src/test/ui/const-generics/broken-mir-2.stderr @@ -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; 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`.