Skip to content

Fix ICE in borrowck when recovering fn_sig for -> _#152323

Merged
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
JohnTitor:issue-135845-2
Feb 14, 2026
Merged

Fix ICE in borrowck when recovering fn_sig for -> _#152323
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
JohnTitor:issue-135845-2

Conversation

@JohnTitor
Copy link
Member

@JohnTitor JohnTitor commented Feb 8, 2026

(Should be) a proper fix for #135845, replaces a dummy binder with a concrete one not to ICE, as mentioned in #147631 (comment).
Fixes #135845
r? @lcnr @jackh726

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 8, 2026
);

let fn_sig = fold_regions(tcx, fn_sig, |r, _| match r.kind() {
ty::ReLateParam(lp) if lp.scope == scope => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if should be an assert, should it not?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, it's inconsistency and should be rejected.

Addressed in: 313959d

}
};

br.map(|br| ty::Region::new_bound(tcx, ty::INNERMOST, br))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty::INNERMOST is wrong, u need to use the binder from the closure argument.

Also, can you move this into a utility function fn late_param_regions_to_bound or sth like this. I think this code is too general (and somewhat subtle to understand) for it to be inline here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, we should be able to just unwrap here 🤔 having spurious late bound regions is a compiler bug

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extracted and used debruijn instead: 313959d

@rustbot

This comment has been minimized.

scope: DefId,
bound_vars: &'tcx ty::List<ty::BoundVariableKind<'tcx>>,
value: T,
) -> T
Copy link
Contributor

@lcnr lcnr Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return a Binder instead of doing so in the caller :3

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks 😊

r=me after nit

View changes since this review

@rustbot
Copy link
Collaborator

rustbot commented Feb 13, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@JohnTitor
Copy link
Member Author

Thank you for the review, too!
@bors r=lcnr

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 13, 2026

📌 Commit b0f2ac8 has been approved by lcnr

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 13, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 13, 2026
Fix ICE in borrowck when recovering `fn_sig` for `-> _`

(Should be) a proper fix for rust-lang#135845, replaces a dummy binder with a concrete one not to ICE, as mentioned in rust-lang#147631 (comment).
Fixes rust-lang#135845
r? @lcnr @jackh726
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 13, 2026
Fix ICE in borrowck when recovering `fn_sig` for `-> _`

(Should be) a proper fix for rust-lang#135845, replaces a dummy binder with a concrete one not to ICE, as mentioned in rust-lang#147631 (comment).
Fixes rust-lang#135845
r? @lcnr @jackh726
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 13, 2026
Fix ICE in borrowck when recovering `fn_sig` for `-> _`

(Should be) a proper fix for rust-lang#135845, replaces a dummy binder with a concrete one not to ICE, as mentioned in rust-lang#147631 (comment).
Fixes rust-lang#135845
r? @lcnr @jackh726
rust-bors bot pushed a commit that referenced this pull request Feb 13, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #152323 (Fix ICE in borrowck when recovering `fn_sig` for `-> _`)
 - #152469 (Remove unused features)
 - #152515 (Extract `DepKindVTable` constructors to their own module)
 - #152555 (Port `#[rustc_diagnostic_item]` to the new attribute parsers)
 - #152218 (Report unconstrained region in hidden types lazily)
 - #152356 (Improve the `inline_fluent!` macro)
 - #152392 (Fix ICE in supertrait_vtable_slot when supertrait has missing generics)
 - #152407 (Add regression test for type_const with unit struct ctor under mGCA)
 - #152440 (Fix typos and grammar in compiler and build documentation)
 - #152536 (bootstrap: add explicit UTF-8 encoding to text-mode open() calls)
 - #152554 (Remove `deprecated_safe` and its corresponding feature gate)
 - #152556 (doc: move riscv64a23-unknown-linux-gnu to tier 2)
 - #152563 (Replace "bug" with "issue" in triagebot ping messages)
 - #152565 (fix missleading error for tuple ctor)

Failed merges:

 - #152512 (core: Implement feature `float_exact_integer_constants`)
 - #152296 (Port `rust_nonnull_optimization_guaranteed` and `rustc_do_not_const_check` to the new attribute parser)
rust-bors bot pushed a commit that referenced this pull request Feb 13, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #152323 (Fix ICE in borrowck when recovering `fn_sig` for `-> _`)
 - #152469 (Remove unused features)
 - #152515 (Extract `DepKindVTable` constructors to their own module)
 - #152555 (Port `#[rustc_diagnostic_item]` to the new attribute parsers)
 - #152218 (Report unconstrained region in hidden types lazily)
 - #152356 (Improve the `inline_fluent!` macro)
 - #152392 (Fix ICE in supertrait_vtable_slot when supertrait has missing generics)
 - #152407 (Add regression test for type_const with unit struct ctor under mGCA)
 - #152440 (Fix typos and grammar in compiler and build documentation)
 - #152536 (bootstrap: add explicit UTF-8 encoding to text-mode open() calls)
 - #152554 (Remove `deprecated_safe` and its corresponding feature gate)
 - #152556 (doc: move riscv64a23-unknown-linux-gnu to tier 2)
 - #152563 (Replace "bug" with "issue" in triagebot ping messages)
 - #152565 (fix missleading error for tuple ctor)

Failed merges:

 - #152512 (core: Implement feature `float_exact_integer_constants`)
 - #152296 (Port `rust_nonnull_optimization_guaranteed` and `rustc_do_not_const_check` to the new attribute parser)
@rust-bors rust-bors bot merged commit 9d662b5 into rust-lang:main Feb 14, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 14, 2026
rust-timer added a commit that referenced this pull request Feb 14, 2026
Rollup merge of #152323 - JohnTitor:issue-135845-2, r=lcnr

Fix ICE in borrowck when recovering `fn_sig` for `-> _`

(Should be) a proper fix for #135845, replaces a dummy binder with a concrete one not to ICE, as mentioned in #147631 (comment).
Fixes #135845
r? @lcnr @jackh726
@JohnTitor JohnTitor deleted the issue-135845-2 branch February 14, 2026 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE: cannot convert ReLateParam to a region vid

3 participants