Skip to content

Move methods from Map to TyCtxt, part 5. #139232

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

Merged
merged 1 commit into from
Apr 2, 2025

Conversation

nnethercote
Copy link
Contributor

This eliminates all methods on Map. Actually removing Map will occur in a follow-up PR.

A follow-up to #137504.

r? @Zalathar

This eliminates all methods on `Map`. Actually removing `Map` will occur
in a follow-up PR.
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Apr 2, 2025
@nnethercote nnethercote marked this pull request as ready for review April 2, 2025 03:08
@rustbot
Copy link
Collaborator

rustbot commented Apr 2, 2025

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann

HIR ty lowering was modified

cc @fmease

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred in match checking

cc @Nadrieril

Some changes occurred in need_type_info.rs

cc @lcnr

@Zalathar
Copy link
Contributor

Zalathar commented Apr 2, 2025

Nice.

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 2, 2025

📌 Commit 6713f34 has been approved by Zalathar

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 Apr 2, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 2, 2025
Move methods from `Map` to `TyCtxt`, part 5.

This eliminates all methods on `Map`. Actually removing `Map` will occur in a follow-up PR.

A follow-up to rust-lang#137504.

r? `@Zalathar`
Comment on lines +1045 to 1047
pub fn hir_span_if_local(self, id: DefId) -> Option<Span> {
id.is_local().then(|| self.def_span(id))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

followup once this PR lands

I think we should remove this method. It's just a wrapper for def_span which doesn't return stuff if the definition isn't local. I feel like this behavior should be explicit and that most places actually should to use the span regardless of whether it's local 🤔

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 2, 2025
Rollup of 5 pull requests

Successful merges:

 - rust-lang#139178 (Remove cjgillot from automated review assignment)
 - rust-lang#139184 (Add unstable `--print=crate-root-lint-levels`)
 - rust-lang#139215 (Add `opt-level = "s"` for more std symbolication crates)
 - rust-lang#139232 (Move methods from `Map` to `TyCtxt`, part 5.)
 - rust-lang#139239 (Remove `aux_build` run-make rustc helpers)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit bda2ea4 into rust-lang:master Apr 2, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 2, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 2, 2025
Rollup merge of rust-lang#139232 - nnethercote:remove-Map-5, r=Zalathar

Move methods from `Map` to `TyCtxt`, part 5.

This eliminates all methods on `Map`. Actually removing `Map` will occur in a follow-up PR.

A follow-up to rust-lang#137504.

r? `@Zalathar`
@nnethercote nnethercote deleted the remove-Map-5 branch April 2, 2025 20:18
@Kobzol
Copy link
Contributor

Kobzol commented Apr 2, 2025

@rust-timer build 5c9cf68

Trying if this caused the regression from #139257.

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5c9cf68): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

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

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.4%] 14
Regressions ❌
(secondary)
0.2% [0.1%, 0.6%] 40
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.2%, 0.4%] 14

Max RSS (memory usage)

Results (primary -0.3%, secondary -2.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.6% [3.0%, 4.3%] 2
Regressions ❌
(secondary)
2.1% [1.5%, 2.7%] 2
Improvements ✅
(primary)
-2.3% [-3.2%, -1.4%] 4
Improvements ✅
(secondary)
-2.8% [-5.2%, -0.8%] 22
All ❌✅ (primary) -0.3% [-3.2%, 4.3%] 6

Cycles

Results (secondary -2.5%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.5% [-3.0%, -2.0%] 4
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 776.507s -> 776.299s (-0.03%)
Artifact size: 366.05 MiB -> 365.96 MiB (-0.03%)

@rustbot rustbot added the perf-regression Performance regression. label Apr 2, 2025
@nnethercote
Copy link
Contributor Author

Huh, surprising this had a perf effect! I will try to work out what happened.

@nnethercote
Copy link
Contributor Author

I wonder if the measured regressions are bogus/transient.

The affected benchmarks (html5ever, deep-vector, tuple-stress, etc.) look like they've gotten noisy over the past few measurements.

I tried reproducing the regression with deep-vector locally, but couldn't reproduce it. I then ran Cachegrind on deep-vector using the built artifacts from the perf run and the small differences were all in the allocator, functions like tcache_bin_flush_small and emap_try_acquire_edata_neighbor and extent_try_coalesce_impl.

And this PR should be perf-neutral: it just moves some methods from Map (a trivial wrapper around TyCtxt) to TyCtxt. I did the same thing in #136466, #137162, #137350, and #137504, and none of those had a performance effect.

@Kobzol
Copy link
Contributor

Kobzol commented Apr 3, 2025

The primary benchmarks do look a bit noisy recently, yeah. It could indeed be a fluke, I'll leave it up to you to mark it as triaged, unless you want to continue investigating.

@nnethercote
Copy link
Contributor Author

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Apr 3, 2025
flip1995 pushed a commit to flip1995/rust that referenced this pull request Apr 3, 2025
Move methods from `Map` to `TyCtxt`, part 5.

This eliminates all methods on `Map`. Actually removing `Map` will occur in a follow-up PR.

A follow-up to rust-lang#137504.

r? `@Zalathar`
@nnethercote nnethercote mentioned this pull request Apr 13, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Apr 15, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 15, 2025
Rollup merge of rust-lang#139772 - nnethercote:rm-hir-Map, r=Zalathar

Remove `hir::Map`

A follow-up to rust-lang#139232.

r? `@Zalathar`
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants