diff options
| author | Ezra Shaw <ezrasure@outlook.com> | 2023-04-13 20:29:41 +1200 |
|---|---|---|
| committer | Ezra Shaw <ezrasure@outlook.com> | 2023-04-13 20:29:41 +1200 |
| commit | ecf2a9b75ec591db6e89f4bde391b87f35c2ea08 (patch) | |
| tree | a69def31d66dee17d3f9f2d1f633804206b58ea9 /compiler/rustc_trait_selection/src | |
| parent | a29dada983fa8d44f789d3a64408b7ad4f4c3487 (diff) | |
| download | rust-ecf2a9b75ec591db6e89f4bde391b87f35c2ea08.tar.gz rust-ecf2a9b75ec591db6e89f4bde391b87f35c2ea08.zip | |
fix: skip implied bounds if unconstrained lifetime exists
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/outlives_bounds.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs b/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs index cff3d277a78..64be4a55708 100644 --- a/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs +++ b/compiler/rustc_trait_selection/src/traits/outlives_bounds.rs @@ -55,7 +55,16 @@ impl<'a, 'tcx: 'a> InferCtxtExt<'a, 'tcx> for InferCtxt<'tcx> { ) -> Vec<OutlivesBound<'tcx>> { let ty = self.resolve_vars_if_possible(ty); let ty = OpportunisticRegionResolver::new(self).fold_ty(ty); - assert!(!ty.needs_infer()); + + // We must avoid processing constrained lifetime variables in implied + // bounds. See #110161 for context. + if ty.needs_infer() { + self.tcx.sess.delay_span_bug( + self.tcx.source_span_untracked(body_id), + "skipped implied_outlives_bounds due to unconstrained lifetimes", + ); + return vec![]; + } let span = self.tcx.def_span(body_id); let result = param_env |
