about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/util.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-11-10 00:34:47 +0000
committerbors <bors@rust-lang.org>2023-11-10 00:34:47 +0000
commitfbf0758499f6786502ed3b03ec355c4c87dfbe65 (patch)
treedf72f61c38f72361f63832d1e963849e21087339 /compiler/rustc_middle/src/ty/util.rs
parentefc300e5460fd1ed057b882e9e29adfdd217eeef (diff)
parent015d4b6a5a6968fe082e3d00422565942dd5898c (diff)
downloadrust-fbf0758499f6786502ed3b03ec355c4c87dfbe65.tar.gz
rust-fbf0758499f6786502ed3b03ec355c4c87dfbe65.zip
Auto merge of #117764 - cuviper:beta-next, r=cuviper
[beta] backports

- dropck_outlives check whether generator witness needs_drop #117134
- Make sure that predicates with unmentioned bound vars are still considered global in the old solver #117589
- Check binders with bound vars for global bounds that don't hold #117637
- generator layout: ignore fake borrows #117712

r? ghost
Diffstat (limited to 'compiler/rustc_middle/src/ty/util.rs')
-rw-r--r--compiler/rustc_middle/src/ty/util.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs
index 31b52677b27..964f38a651a 100644
--- a/compiler/rustc_middle/src/ty/util.rs
+++ b/compiler/rustc_middle/src/ty/util.rs
@@ -1097,8 +1097,10 @@ impl<'tcx> Ty<'tcx> {
                 // This doesn't depend on regions, so try to minimize distinct
                 // query keys used.
                 // If normalization fails, we just use `query_ty`.
-                let query_ty =
-                    tcx.try_normalize_erasing_regions(param_env, query_ty).unwrap_or(query_ty);
+                debug_assert!(!param_env.has_infer());
+                let query_ty = tcx
+                    .try_normalize_erasing_regions(param_env, query_ty)
+                    .unwrap_or_else(|_| tcx.erase_regions(query_ty));
 
                 tcx.needs_drop_raw(param_env.and(query_ty))
             }
@@ -1287,7 +1289,6 @@ pub fn needs_drop_components<'tcx>(
         | ty::FnDef(..)
         | ty::FnPtr(_)
         | ty::Char
-        | ty::GeneratorWitness(..)
         | ty::RawPtr(_)
         | ty::Ref(..)
         | ty::Str => Ok(SmallVec::new()),
@@ -1327,7 +1328,8 @@ pub fn needs_drop_components<'tcx>(
         | ty::Placeholder(..)
         | ty::Infer(_)
         | ty::Closure(..)
-        | ty::Generator(..) => Ok(smallvec![ty]),
+        | ty::Generator(..)
+        | ty::GeneratorWitness(..) => Ok(smallvec![ty]),
     }
 }