Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit d983845

Browse files
committed
Removing unhandled region constraint error that is only for impl_trait_in_bindings
1 parent 962ac81 commit d983845

File tree

2 files changed

+5
-34
lines changed

2 files changed

+5
-34
lines changed

compiler/rustc_mir/src/borrow_check/member_constraints.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use rustc_data_structures::fx::FxHashMap;
2-
use rustc_hir::def_id::DefId;
32
use rustc_index::vec::IndexVec;
43
use rustc_middle::infer::MemberConstraint;
54
use rustc_middle::ty::{self, Ty};
@@ -32,9 +31,6 @@ where
3231
crate struct NllMemberConstraint<'tcx> {
3332
next_constraint: Option<NllMemberConstraintIndex>,
3433

35-
/// The opaque type whose hidden type is being inferred. (Used in error reporting.)
36-
crate opaque_type_def_id: DefId,
37-
3834
/// The span where the hidden type was instantiated.
3935
crate definition_span: Span,
4036

@@ -91,7 +87,6 @@ impl<'tcx> MemberConstraintSet<'tcx, ty::RegionVid> {
9187
let constraint_index = self.constraints.push(NllMemberConstraint {
9288
next_constraint,
9389
member_region_vid,
94-
opaque_type_def_id: m_c.opaque_type_def_id,
9590
definition_span: m_c.definition_span,
9691
hidden_ty: m_c.hidden_ty,
9792
start_index,

compiler/rustc_mir/src/borrow_check/region_infer/mod.rs

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
551551
polonius_output: Option<Rc<PoloniusOutput>>,
552552
) -> (Option<ClosureRegionRequirements<'tcx>>, RegionErrors<'tcx>) {
553553
let mir_def_id = body.source.def_id();
554-
self.propagate_constraints(body, infcx.tcx);
554+
self.propagate_constraints(body);
555555

556556
let mut errors_buffer = RegionErrors::new();
557557

@@ -599,7 +599,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
599599
/// for each region variable until all the constraints are
600600
/// satisfied. Note that some values may grow **too** large to be
601601
/// feasible, but we check this later.
602-
fn propagate_constraints(&mut self, _body: &Body<'tcx>, tcx: TyCtxt<'tcx>) {
602+
fn propagate_constraints(&mut self, _body: &Body<'tcx>) {
603603
debug!("propagate_constraints()");
604604

605605
debug!("propagate_constraints: constraints={:#?}", {
@@ -617,7 +617,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
617617
// own.
618618
let constraint_sccs = self.constraint_sccs.clone();
619619
for scc in constraint_sccs.all_sccs() {
620-
self.compute_value_for_scc(scc, tcx);
620+
self.compute_value_for_scc(scc);
621621
}
622622

623623
// Sort the applied member constraints so we can binary search
@@ -629,7 +629,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
629629
/// computed, by unioning the values of its successors.
630630
/// Assumes that all successors have been computed already
631631
/// (which is assured by iterating over SCCs in dependency order).
632-
fn compute_value_for_scc(&mut self, scc_a: ConstraintSccIndex, tcx: TyCtxt<'tcx>) {
632+
fn compute_value_for_scc(&mut self, scc_a: ConstraintSccIndex) {
633633
let constraint_sccs = self.constraint_sccs.clone();
634634

635635
// Walk each SCC `B` such that `A: B`...
@@ -652,12 +652,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
652652
// Now take member constraints into account.
653653
let member_constraints = self.member_constraints.clone();
654654
for m_c_i in member_constraints.indices(scc_a) {
655-
self.apply_member_constraint(
656-
tcx,
657-
scc_a,
658-
m_c_i,
659-
member_constraints.choice_regions(m_c_i),
660-
);
655+
self.apply_member_constraint(scc_a, m_c_i, member_constraints.choice_regions(m_c_i));
661656
}
662657

663658
debug!(
@@ -680,31 +675,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
680675
/// If we make any changes, returns true, else false.
681676
fn apply_member_constraint(
682677
&mut self,
683-
tcx: TyCtxt<'tcx>,
684678
scc: ConstraintSccIndex,
685679
member_constraint_index: NllMemberConstraintIndex,
686680
choice_regions: &[ty::RegionVid],
687681
) -> bool {
688682
debug!("apply_member_constraint(scc={:?}, choice_regions={:#?})", scc, choice_regions,);
689683

690-
if let Some(uh_oh) =
691-
choice_regions.iter().find(|&&r| !self.universal_regions.is_universal_region(r))
692-
{
693-
// FIXME(#61773): This case can only occur with
694-
// `impl_trait_in_bindings`, I believe, and we are just
695-
// opting not to handle it for now. See #61773 for
696-
// details.
697-
tcx.sess.delay_span_bug(
698-
self.member_constraints[member_constraint_index].definition_span,
699-
&format!(
700-
"member constraint for `{:?}` has an option region `{:?}` \
701-
that is not a universal region",
702-
self.member_constraints[member_constraint_index].opaque_type_def_id, uh_oh,
703-
),
704-
);
705-
return false;
706-
}
707-
708684
// Create a mutable vector of the options. We'll try to winnow
709685
// them down.
710686
let mut choice_regions: Vec<ty::RegionVid> = choice_regions.to_vec();

0 commit comments

Comments
 (0)