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

Rework name_regions to not rely on reverse scc graph for non-member-constrain usages #137102

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Feb 15, 2025

Fixes #137015

Splits the name_regions into two versions: One meant for member region constraint error reporting (which I've renamed to name_regions_for_member_constraint), and one meant just to replace region vids with an external region.

Use the latter in the usage sites I added in #136559, since the regions returned by name_regions_for_member_constraint are also not totally accurate (which is fine for how they're used for member region constraint error reporting -- they're intentionally returning overapproximated universal regions so that we have something to name in + use<'a> suggestions, because opaques can only capture universal regions and since member region constraints don't insert any edges into the region graph, the error region is probably gonna be shorter than a universal region) and because that function requires the reverse scc graph to have been computed which isn't done for our usages in #136559.

@rustbot
Copy link
Collaborator

rustbot commented Feb 15, 2025

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 15, 2025
/// that universal region. This is useful for member region constraints since
/// we want to suggest a universal region name to capture even if it's technically
/// not equal to the error region.
pub(crate) fn name_regions_for_member_constraint<T>(&self, tcx: TyCtxt<'tcx>, ty: T) -> T
Copy link
Member Author

Choose a reason for hiding this comment

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

This one stays living in regioncx bc it's paired with its partner function above.

@compiler-errors
Copy link
Member Author

r? oli-obk who (i think) knows about borrowck error reporting, but reassign if you don't want to review it

@rustbot rustbot assigned oli-obk and unassigned nnethercote Feb 15, 2025
@oli-obk
Copy link
Contributor

oli-obk commented Feb 16, 2025

Heh fun. From the description I assumed it would also fix some weird diagnostic, but I guess those were "avoided" by the ice.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Feb 16, 2025

📌 Commit 17071ff has been approved by oli-obk

It is now in the queue for this repository.

@bors bors 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 16, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 16, 2025
…li-obk

Rework `name_regions` to not rely on reverse scc graph for non-member-constrain usages

Fixes rust-lang#137015

Splits the `name_regions` into two versions: One meant for member region constraint error reporting (which I've renamed to `name_regions_for_member_constraint`), and one meant *just* to replace region vids with an external region.

Use the latter in the usage sites I added in rust-lang#136559, since the regions returned by `name_regions_for_member_constraint` are also not *totally* accurate (which is fine for how they're used for member region constraint error reporting -- they're intentionally returning overapproximated universal regions so that we have something to name in `+ use<'a>` suggestions, because opaques can only capture universal regions and since member region constraints don't insert any edges into the region graph, the error region is probably gonna be shorter than a universal region) and because that function requires the reverse scc graph to have been computed which isn't done for our usages in rust-lang#136559.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Feb 16, 2025
…li-obk

Rework `name_regions` to not rely on reverse scc graph for non-member-constrain usages

Fixes rust-lang#137015

Splits the `name_regions` into two versions: One meant for member region constraint error reporting (which I've renamed to `name_regions_for_member_constraint`), and one meant *just* to replace region vids with an external region.

Use the latter in the usage sites I added in rust-lang#136559, since the regions returned by `name_regions_for_member_constraint` are also not *totally* accurate (which is fine for how they're used for member region constraint error reporting -- they're intentionally returning overapproximated universal regions so that we have something to name in `+ use<'a>` suggestions, because opaques can only capture universal regions and since member region constraints don't insert any edges into the region graph, the error region is probably gonna be shorter than a universal region) and because that function requires the reverse scc graph to have been computed which isn't done for our usages in rust-lang#136559.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 16, 2025
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#125087 (Optimize `Seek::stream_len` impl for `File`)
 - rust-lang#136986 (Apply unsafe_op_in_unsafe_fn to the standard library)
 - rust-lang#137012 (add docs and ut for bootstrap util cc-detect)
 - rust-lang#137072 (Load all builtin targets at once instead of one by one in check-cfg)
 - rust-lang#137102 (Rework `name_regions` to not rely on reverse scc graph for non-member-constrain usages)
 - rust-lang#137112 (Don't project into `NonNull` when dropping a `Box`)
 - rust-lang#137114 (Add an example for `std::error::Error`)
 - rust-lang#137117 (Fix test that relies on error language)
 - rust-lang#137119 (fix broken `x {doc, build} core`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 16, 2025
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#136986 (Apply unsafe_op_in_unsafe_fn to the standard library)
 - rust-lang#137012 (add docs and ut for bootstrap util cc-detect)
 - rust-lang#137072 (Load all builtin targets at once instead of one by one in check-cfg)
 - rust-lang#137102 (Rework `name_regions` to not rely on reverse scc graph for non-member-constrain usages)
 - rust-lang#137112 (Don't project into `NonNull` when dropping a `Box`)
 - rust-lang#137114 (Add an example for `std::error::Error`)
 - rust-lang#137117 (Fix test that relies on error language)
 - rust-lang#137119 (fix broken `x {doc, build} core`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ea9c8d9 into rust-lang:master Feb 17, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Feb 17, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 17, 2025
Rollup merge of rust-lang#137102 - compiler-errors:name_regions2, r=oli-obk

Rework `name_regions` to not rely on reverse scc graph for non-member-constrain usages

Fixes rust-lang#137015

Splits the `name_regions` into two versions: One meant for member region constraint error reporting (which I've renamed to `name_regions_for_member_constraint`), and one meant *just* to replace region vids with an external region.

Use the latter in the usage sites I added in rust-lang#136559, since the regions returned by `name_regions_for_member_constraint` are also not *totally* accurate (which is fine for how they're used for member region constraint error reporting -- they're intentionally returning overapproximated universal regions so that we have something to name in `+ use<'a>` suggestions, because opaques can only capture universal regions and since member region constraints don't insert any edges into the region graph, the error region is probably gonna be shorter than a universal region) and because that function requires the reverse scc graph to have been computed which isn't done for our usages in rust-lang#136559.
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: None in compiler/rustc_borrowck/src/region_infer/opaque_types.rs
5 participants