about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-02-18 16:23:30 +0100
committerGitHub <noreply@github.com>2022-02-18 16:23:30 +0100
commitcf3cd4c48a44ba833253a1f32e09bd6d7b120e13 (patch)
tree614cd20dfba4db693d5a1f2a16c31cb6535af2fc /compiler/rustc_trait_selection/src
parent659382fa47e9a7c29451ed407c4062f86dee07b1 (diff)
parentb651d5a1f4b3b8ab54926d4f5dd0390a94f5bac3 (diff)
downloadrust-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 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/codegen.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/codegen.rs b/compiler/rustc_trait_selection/src/traits/codegen.rs
index 603ab0622f0..bf6e6a4fcbb 100644
--- a/compiler/rustc_trait_selection/src/traits/codegen.rs
+++ b/compiler/rustc_trait_selection/src/traits/codegen.rs
@@ -64,6 +64,8 @@ pub fn codegen_fulfill_obligation<'tcx>(
             Err(Unimplemented) => {
                 // This can trigger when we probe for the source of a `'static` lifetime requirement
                 // on a trait object: `impl Foo for dyn Trait {}` has an implicit `'static` bound.
+                // This can also trigger when we have a global bound that is not actually satisfied,
+                // but was included during typeck due to the trivial_bounds feature.
                 infcx.tcx.sess.delay_span_bug(
                     rustc_span::DUMMY_SP,
                     &format!(