diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/crashes/140100.rs | 7 | ||||
| -rw-r--r-- | tests/crashes/140365.rs | 8 | ||||
| -rw-r--r-- | tests/ui/mir/meaningless-bound.rs | 20 | ||||
| -rw-r--r-- | tests/ui/mir/meaningless-bound.stderr | 19 |
4 files changed, 39 insertions, 15 deletions
diff --git a/tests/crashes/140100.rs b/tests/crashes/140100.rs deleted file mode 100644 index 0836ffe2d92..00000000000 --- a/tests/crashes/140100.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ known-bug: #140100 -fn a() -where - b: Sized, -{ - println!() -} diff --git a/tests/crashes/140365.rs b/tests/crashes/140365.rs deleted file mode 100644 index 809ceaf35a0..00000000000 --- a/tests/crashes/140365.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ known-bug: #140365 -//@compile-flags: -C opt-level=1 -Zvalidate-mir -fn f() -> &'static str -where - Self: Sized, -{ - "" -} diff --git a/tests/ui/mir/meaningless-bound.rs b/tests/ui/mir/meaningless-bound.rs new file mode 100644 index 00000000000..c9427e7ece5 --- /dev/null +++ b/tests/ui/mir/meaningless-bound.rs @@ -0,0 +1,20 @@ +//! Regression test for #140100 and #140365 +//@compile-flags: -C opt-level=1 -Zvalidate-mir + +fn a() +where + b: Sized, + //~^ ERROR cannot find type `b` in this scope +{ + println!() +} + +fn f() -> &'static str +where + Self: Sized, + //~^ ERROR cannot find type `Self` in this scope +{ + "" +} + +fn main() {} diff --git a/tests/ui/mir/meaningless-bound.stderr b/tests/ui/mir/meaningless-bound.stderr new file mode 100644 index 00000000000..dc08def83b6 --- /dev/null +++ b/tests/ui/mir/meaningless-bound.stderr @@ -0,0 +1,19 @@ +error[E0412]: cannot find type `b` in this scope + --> $DIR/meaningless-bound.rs:6:5 + | +LL | b: Sized, + | ^ not found in this scope + +error[E0411]: cannot find type `Self` in this scope + --> $DIR/meaningless-bound.rs:14:5 + | +LL | fn f() -> &'static str + | - `Self` not allowed in a function +LL | where +LL | Self: Sized, + | ^^^^ `Self` is only available in impls, traits, and type definitions + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0411, E0412. +For more information about an error, try `rustc --explain E0411`. |
