Skip to content

Commit

Permalink
Make it clearer that the only infers we expect to see when processing…
Browse files Browse the repository at this point in the history
… outlives are regions
  • Loading branch information
compiler-errors committed Jan 2, 2025
1 parent f364674 commit 2a373d7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion compiler/rustc_infer/src/infer/outlives/obligations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,13 @@ where
return;
}

if alias_ty.has_non_region_infer() {
self.tcx
.dcx()
.span_delayed_bug(origin.span(), "an alias has infers during region solving");
return;
}

// This case is thorny for inference. The fundamental problem is
// that there are many cases where we have choice, and inference
// doesn't like choice (the current region inference in
Expand Down Expand Up @@ -408,7 +415,7 @@ where
let is_opaque = alias_ty.kind(self.tcx) == ty::Opaque;
if approx_env_bounds.is_empty()
&& trait_bounds.is_empty()
&& (alias_ty.has_infer() || is_opaque)
&& (alias_ty.has_infer_regions() || is_opaque)
{
debug!("no declared bounds");
let opt_variances = is_opaque.then(|| self.tcx.variances_of(alias_ty.def_id));
Expand Down

0 comments on commit 2a373d7

Please sign in to comment.