diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-02-18 16:23:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-18 16:23:30 +0100 |
| commit | cf3cd4c48a44ba833253a1f32e09bd6d7b120e13 (patch) | |
| tree | 614cd20dfba4db693d5a1f2a16c31cb6535af2fc /src | |
| parent | 659382fa47e9a7c29451ed407c4062f86dee07b1 (diff) | |
| parent | b651d5a1f4b3b8ab54926d4f5dd0390a94f5bac3 (diff) | |
| download | rust-cf3cd4c48a44ba833253a1f32e09bd6d7b120e13.tar.gz rust-cf3cd4c48a44ba833253a1f32e09bd6d7b120e13.zip | |
Rollup merge of #93024 - compiler-errors:inline-mir-bad-bounds, r=estebank
Do not ICE when inlining a function with un-satisfiable bounds Fixes #93008 This is kinda a hack... but it's the fix I thought had the least blast-radius. We use `normalize_param_env_or_error` to verify that the predicates in the param env are self-consistent, since with RevealAll, a bad predicate like `<&'static () as Clone>` will be evaluated with an empty ParamEnv (since it references no generics), and we'll raise an error for it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/trait-bounds/issue-93008.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/trait-bounds/issue-93008.stderr | 12 |
2 files changed, 22 insertions, 0 deletions
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<T>(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`. |
