From b651d5a1f4b3b8ab54926d4f5dd0390a94f5bac3 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 17 Jan 2022 20:38:38 -0800 Subject: Fix Inline MIR pass on a function with un-satisfiable bounds --- src/test/ui/trait-bounds/issue-93008.rs | 10 ++++++++++ src/test/ui/trait-bounds/issue-93008.stderr | 12 ++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/test/ui/trait-bounds/issue-93008.rs create mode 100644 src/test/ui/trait-bounds/issue-93008.stderr (limited to 'src') diff --git a/src/test/ui/trait-bounds/issue-93008.rs b/src/test/ui/trait-bounds/issue-93008.rs new file mode 100644 index 00000000000..1b010566cbc --- /dev/null +++ b/src/test/ui/trait-bounds/issue-93008.rs @@ -0,0 +1,10 @@ +// compile-flags: -Zmir-opt-level=4 + +pub fn bar(s: &'static mut ()) +where + &'static mut (): Clone, //~ ERROR the trait bound +{ + <&'static mut () as Clone>::clone(&s); +} + +fn main() {} diff --git a/src/test/ui/trait-bounds/issue-93008.stderr b/src/test/ui/trait-bounds/issue-93008.stderr new file mode 100644 index 00000000000..10f80f8de0c --- /dev/null +++ b/src/test/ui/trait-bounds/issue-93008.stderr @@ -0,0 +1,12 @@ +error[E0277]: the trait bound `&'static mut (): Clone` is not satisfied + --> $DIR/issue-93008.rs:5:5 + | +LL | &'static mut (): Clone, + | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `&'static mut ()` + | + = help: see issue #48214 + = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. -- cgit 1.4.1-3-g733a5