Skip to content

Stop using LinkedGraph in lexical_region_resolve#153012

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Zalathar:lexical
Feb 28, 2026
Merged

Stop using LinkedGraph in lexical_region_resolve#153012
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Zalathar:lexical

Conversation

@Zalathar
Copy link
Member

@Zalathar Zalathar commented Feb 23, 2026

There are only two users of the older LinkedGraph data structure, and this is one.

It turns out that this diagnostic-related code doesn't need any non-trivial graph operations (since it does its own graph traversal); it just needs the ability to get a list of in-edges or out-edges (constraints) for any particular node. That's easy enough to do with a simple custom data structure.

Inspired by #152621, which wants to make changes to LinkedGraph that wouldn't make sense for this use-site.

@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 23, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 23, 2026

r? @fmease

rustbot has assigned @fmease.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 68 candidates
  • Random selection from 15 candidates

@Zalathar
Copy link
Member Author

I don't expect this to be on a hot path for perf, but let's check.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 23, 2026
Stop using `LinkedGraph` in `lexical_region_resolve`
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 23, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 23, 2026

☀️ Try build successful (CI)
Build commit: 71438fe (71438fe7132483fe73da8fa49bc361feb85ab6dd, parent: d3e8bd94cc042c65e30a6c60146a8a00531d1292)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (71438fe): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary 1.8%, secondary 2.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.8% [1.5%, 2.1%] 2
Regressions ❌
(secondary)
2.4% [1.7%, 2.7%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.8% [1.5%, 2.1%] 2

Cycles

Results (secondary -1.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.9% [-1.9%, -1.9%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 480.206s -> 480.109s (-0.02%)
Artifact size: 397.91 MiB -> 397.93 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 23, 2026
@Zalathar
Copy link
Member Author

@bors rollup=maybe

@petrochenkov
Copy link
Contributor

This makes sense if the goal is to eliminate LinkedGraph entirely.
And maybe even makes sense by itself, the amount of duplication with LinkedGraph here is very tiny.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 25, 2026
@fmease fmease assigned petrochenkov and unassigned petrochenkov and fmease Feb 25, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 26, 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.

Comment on lines +31 to +37
// Only push a var out-edge for `VarSub...` constraints.
match c.kind {
ConstraintKind::VarSubVar | ConstraintKind::VarSubReg => {
out_edges[c.sub.as_var()].push(pair)
}
ConstraintKind::RegSubVar | ConstraintKind::RegSubReg => {}
}
Copy link
Member Author

@Zalathar Zalathar Feb 26, 2026

Choose a reason for hiding this comment

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

I applied the suggestions, but to me this new version seems more confusing, because the visual pattern from before is now obscured.

@Zalathar
Copy link
Member Author

I applied the suggested changes: (diff)

@rustbot ready

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 26, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 26, 2026
@petrochenkov
Copy link
Contributor

Thanks!
@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 26, 2026

📌 Commit 4b7a05e has been approved by petrochenkov

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 26, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 26, 2026
Stop using `LinkedGraph` in `lexical_region_resolve`

There are only two users of the older `LinkedGraph` data structure, and this is one.

It turns out that this diagnostic-related code doesn't need any non-trivial graph operations (since it does its own graph traversal); it just needs the ability to get a list of in-edges or out-edges (constraints) for any particular node. That's easy enough to do with a simple custom data structure.

Inspired by rust-lang#152621, which wants to make changes to `LinkedGraph` that wouldn't make sense for this use-site.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 27, 2026
Stop using `LinkedGraph` in `lexical_region_resolve`

There are only two users of the older `LinkedGraph` data structure, and this is one.

It turns out that this diagnostic-related code doesn't need any non-trivial graph operations (since it does its own graph traversal); it just needs the ability to get a list of in-edges or out-edges (constraints) for any particular node. That's easy enough to do with a simple custom data structure.

Inspired by rust-lang#152621, which wants to make changes to `LinkedGraph` that wouldn't make sense for this use-site.
rust-bors bot pushed a commit that referenced this pull request Feb 27, 2026
Rollup of 7 pull requests

Successful merges:

 - #151143 (explicit tail calls: support indirect arguments)
 - #153012 (Stop using `LinkedGraph` in `lexical_region_resolve`)
 - #150828 (Improved security section in rustdoc for `current_exe`)
 - #153117 (Remove mutation from macro path URL construction)
 - #153128 (Recover feature lang_items for emscripten)
 - #153138 (Print path root when printing path)
 - #153159 (Work around a false `err.emit();` type error in rust-analyzer)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 27, 2026
Stop using `LinkedGraph` in `lexical_region_resolve`

There are only two users of the older `LinkedGraph` data structure, and this is one.

It turns out that this diagnostic-related code doesn't need any non-trivial graph operations (since it does its own graph traversal); it just needs the ability to get a list of in-edges or out-edges (constraints) for any particular node. That's easy enough to do with a simple custom data structure.

Inspired by rust-lang#152621, which wants to make changes to `LinkedGraph` that wouldn't make sense for this use-site.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 27, 2026
Stop using `LinkedGraph` in `lexical_region_resolve`

There are only two users of the older `LinkedGraph` data structure, and this is one.

It turns out that this diagnostic-related code doesn't need any non-trivial graph operations (since it does its own graph traversal); it just needs the ability to get a list of in-edges or out-edges (constraints) for any particular node. That's easy enough to do with a simple custom data structure.

Inspired by rust-lang#152621, which wants to make changes to `LinkedGraph` that wouldn't make sense for this use-site.
rust-bors bot pushed a commit that referenced this pull request Feb 27, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #151431 (Add new unstable attribute: `#[export_visibility = ...]`.)
 - #153012 (Stop using `LinkedGraph` in `lexical_region_resolve`)
 - #153179 (Force a CI LLVM stamp bump)
 - #150828 (Improved security section in rustdoc for `current_exe`)
 - #152673 (rustc_public: rewrite `bridge_impl` to reduce boilerplate)
 - #152674 (rustc_public: remove the `CrateDefItems` trait)
 - #153073 (Fix mem::conjure_zst panic message to use any::type_name instead)
 - #153117 (Remove mutation from macro path URL construction)
 - #153128 (Recover feature lang_items for emscripten)
 - #153138 (Print path root when printing path)
 - #153159 (Work around a false `err.emit();` type error in rust-analyzer)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 27, 2026
Stop using `LinkedGraph` in `lexical_region_resolve`

There are only two users of the older `LinkedGraph` data structure, and this is one.

It turns out that this diagnostic-related code doesn't need any non-trivial graph operations (since it does its own graph traversal); it just needs the ability to get a list of in-edges or out-edges (constraints) for any particular node. That's easy enough to do with a simple custom data structure.

Inspired by rust-lang#152621, which wants to make changes to `LinkedGraph` that wouldn't make sense for this use-site.
rust-bors bot pushed a commit that referenced this pull request Feb 27, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #151143 (explicit tail calls: support indirect arguments)
 - #153012 (Stop using `LinkedGraph` in `lexical_region_resolve`)
 - #153175 (Clarify a confusing green-path function)
 - #153179 (Force a CI LLVM stamp bump)
 - #150828 (Improved security section in rustdoc for `current_exe`)
 - #152673 (rustc_public: rewrite `bridge_impl` to reduce boilerplate)
 - #152674 (rustc_public: remove the `CrateDefItems` trait)
 - #153073 (Fix mem::conjure_zst panic message to use any::type_name instead)
 - #153117 (Remove mutation from macro path URL construction)
 - #153128 (Recover feature lang_items for emscripten)
 - #153138 (Print path root when printing path)
 - #153159 (Work around a false `err.emit();` type error in rust-analyzer)
rust-bors bot pushed a commit that referenced this pull request Feb 27, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #151143 (explicit tail calls: support indirect arguments)
 - #153012 (Stop using `LinkedGraph` in `lexical_region_resolve`)
 - #153175 (Clarify a confusing green-path function)
 - #153179 (Force a CI LLVM stamp bump)
 - #150828 (Improved security section in rustdoc for `current_exe`)
 - #152673 (rustc_public: rewrite `bridge_impl` to reduce boilerplate)
 - #152674 (rustc_public: remove the `CrateDefItems` trait)
 - #153073 (Fix mem::conjure_zst panic message to use any::type_name instead)
 - #153117 (Remove mutation from macro path URL construction)
 - #153128 (Recover feature lang_items for emscripten)
 - #153138 (Print path root when printing path)
 - #153159 (Work around a false `err.emit();` type error in rust-analyzer)
@rust-bors rust-bors bot merged commit 383ef53 into rust-lang:main Feb 28, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 28, 2026
@Zalathar Zalathar deleted the lexical branch February 28, 2026 01:38
rust-timer added a commit that referenced this pull request Feb 28, 2026
Rollup merge of #153012 - Zalathar:lexical, r=petrochenkov

Stop using `LinkedGraph` in `lexical_region_resolve`

There are only two users of the older `LinkedGraph` data structure, and this is one.

It turns out that this diagnostic-related code doesn't need any non-trivial graph operations (since it does its own graph traversal); it just needs the ability to get a list of in-edges or out-edges (constraints) for any particular node. That's easy enough to do with a simple custom data structure.

Inspired by #152621, which wants to make changes to `LinkedGraph` that wouldn't make sense for this use-site.
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.

5 participants