Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

member constraints leak through InferCtxt snapshots #109654

Closed
aliemjay opened this issue Mar 27, 2023 · 1 comment · Fixed by #134501
Closed

member constraints leak through InferCtxt snapshots #109654

aliemjay opened this issue Mar 27, 2023 · 1 comment · Fixed by #134501
Labels
A-inference Area: Type inference C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@aliemjay
Copy link
Member

RegionConstraintCollector::member_constraint doesn't register new constraints in the undo log.

pub(super) fn member_constraint(
&mut self,
key: ty::OpaqueTypeKey<'tcx>,
definition_span: Span,
hidden_ty: Ty<'tcx>,
member_region: ty::Region<'tcx>,
choice_regions: &Lrc<Vec<ty::Region<'tcx>>>,
) {
debug!("member_constraint({:?} in {:#?})", member_region, choice_regions);
if choice_regions.iter().any(|&r| r == member_region) {
return;
}
self.data.member_constraints.push(MemberConstraint {
key,
definition_span,
hidden_ty,
member_region,
choice_regions: choice_regions.clone(),
});
}

@aliemjay aliemjay added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Mar 27, 2023
@aliemjay aliemjay changed the title member constraints leaks through InferCtxt snapshots member constraints leak through InferCtxt snapshots Mar 27, 2023
@Enselic
Copy link
Member

Enselic commented Jun 12, 2024

Triage: Can you please elaborate a bit on what the consequences of this is, and what problems it causes for users? A minimal reproducer would also be very nice to have.

@Enselic Enselic added the A-inference Area: Type inference label Nov 14, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Dec 19, 2024
handle member constraints directly in the mir type checker

cleaner, faster, easier to change going forward :> fixes rust-lang#109654

r? `@oli-obk` `@compiler-errors`
@bors bors closed this as completed in 9bd5f33 Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inference Area: Type inference C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants