diff options
| author | Michael Goulet <michael@errs.io> | 2022-10-31 21:24:39 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2022-10-31 21:25:08 +0000 |
| commit | 2768c2fb257fccc692712d5f38d979f4a8f127dd (patch) | |
| tree | 20b00aed9baefe5c23da9ea9a4737d41a399d7a2 | |
| parent | 4427af082797a1e477781efd09947bb27d9b19c3 (diff) | |
| download | rust-2768c2fb257fccc692712d5f38d979f4a8f127dd.tar.gz rust-2768c2fb257fccc692712d5f38d979f4a8f127dd.zip | |
Add bug! back to late_bound_vars query
| -rw-r--r-- | compiler/rustc_borrowck/src/universal_regions.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/context.rs | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_borrowck/src/universal_regions.rs b/compiler/rustc_borrowck/src/universal_regions.rs index 482e10d520b..618da9e3253 100644 --- a/compiler/rustc_borrowck/src/universal_regions.rs +++ b/compiler/rustc_borrowck/src/universal_regions.rs @@ -869,6 +869,10 @@ fn for_each_late_bound_region_in_item<'tcx>( mir_def_id: LocalDefId, mut f: impl FnMut(ty::Region<'tcx>), ) { + if !tcx.def_kind(mir_def_id).is_fn_like() { + return; + } + for bound_var in tcx.late_bound_vars(tcx.hir().local_def_id_to_hir_id(mir_def_id)) { let ty::BoundVariableKind::Region(bound_region) = bound_var else { continue; }; let liberated_region = tcx diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index a9c503585a1..3d7e2a0839a 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2895,7 +2895,9 @@ impl<'tcx> TyCtxt<'tcx> { self.mk_bound_variable_kinds( self.late_bound_vars_map(id.owner) .and_then(|map| map.get(&id.local_id).cloned()) - .unwrap_or_default() + .unwrap_or_else(|| { + bug!("No bound vars found for {:?} ({:?})", self.hir().node_to_string(id), id) + }) .iter(), ) } |
