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

hir: Refactor getters for owner nodes #120346

Merged
merged 3 commits into from
Jan 31, 2024
Merged

Conversation

petrochenkov
Copy link
Contributor

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Jan 25, 2024

r? @wesleywiser

(rustbot has picked a reviewer for you, use r? to override)

@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 Jan 25, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jan 25, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rust-log-analyzer

This comment has been minimized.

@@ -53,7 +53,7 @@ impl Foo {
#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(cfg="cfail5", except="opt_hir_owner_nodes")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure what made the incremental tests change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Before this PR MaybeOwner::Phantom was returned either when that was the entry (can that happen?) or when there was no entry. Now there is a difference between None and MaybeOwner::Phantom.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, the current logic is tcx.hir_crate(()).owners.get(id)?.as_owner().map(|i| &i.nodes), that means None is returned for all cases without actual .nodes (no entry, Phantom entry, NonOwner entry).

So, I'd expect the opposite effect - more clean queries, not less.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is due to relative spans, which are sensitive to the number of characters in the item's span. By adding the opt_ prefix, you have more characters in inside the curly braces than the original version has. This is the reason for the silly filler comments.

TBH, I'm starting to reconsider the usefulness of these filler comments, and go towards testing the realistic version.

The query accept arbitrary DefIds, not just owner DefIds.
The return can be an `Option` because if there are no nodes, then it doesn't matter whether it's due to NonOwner or Phantom.
Also rename the query to `opt_hir_owner_nodes`.
@petrochenkov
Copy link
Contributor Author

Ok, I have updated the padding comments in incremental tests.
@rustbot ready

@oli-obk
Copy link
Contributor

oli-obk commented Jan 30, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Jan 30, 2024

📌 Commit db41f4a 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 Jan 30, 2024
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 30, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 30, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 30, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#120207 (check `RUST_BOOTSTRAP_CONFIG` in `profile_user_dist` test)
 - rust-lang#120321 (pattern_analysis: cleanup the contexts)
 - rust-lang#120346 (hir: Refactor getters for owner nodes)
 - rust-lang#120396 (Account for unbounded type param receiver in suggestions)
 - rust-lang#120435 (Suggest name value cfg when only value is used for check-cfg)
 - rust-lang#120470 (Mark "unused binding" suggestion as maybe incorrect)
 - rust-lang#120495 (Remove the `abi_amdgpu_kernel` feature)
 - rust-lang#120501 (rustdoc: Correctly handle attribute merge if this is a glob reexport)

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

Rollup of 8 pull requests

Successful merges:

 - rust-lang#120207 (check `RUST_BOOTSTRAP_CONFIG` in `profile_user_dist` test)
 - rust-lang#120321 (pattern_analysis: cleanup the contexts)
 - rust-lang#120346 (hir: Refactor getters for owner nodes)
 - rust-lang#120396 (Account for unbounded type param receiver in suggestions)
 - rust-lang#120435 (Suggest name value cfg when only value is used for check-cfg)
 - rust-lang#120470 (Mark "unused binding" suggestion as maybe incorrect)
 - rust-lang#120495 (Remove the `abi_amdgpu_kernel` feature)
 - rust-lang#120501 (rustdoc: Correctly handle attribute merge if this is a glob reexport)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 31, 2024
Rollup of 12 pull requests

Successful merges:

 - rust-lang#120207 (check `RUST_BOOTSTRAP_CONFIG` in `profile_user_dist` test)
 - rust-lang#120321 (pattern_analysis: cleanup the contexts)
 - rust-lang#120323 (On E0277 be clearer about implicit `Sized` bounds on type params and assoc types)
 - rust-lang#120355 (document `FromIterator for Vec` allocation behaviors)
 - rust-lang#120396 (Account for unbounded type param receiver in suggestions)
 - rust-lang#120430 (std: thread_local::register_dtor fix proposal for FreeBSD.)
 - rust-lang#120435 (Suggest name value cfg when only value is used for check-cfg)
 - rust-lang#120470 (Mark "unused binding" suggestion as maybe incorrect)
 - rust-lang#120472 (Make duplicate lang items fatal)
 - rust-lang#120490 (Don't hash lints differently to non-lints.)
 - rust-lang#120495 (Remove the `abi_amdgpu_kernel` feature)
 - rust-lang#120501 (rustdoc: Correctly handle attribute merge if this is a glob reexport)

Failed merges:

 - rust-lang#120346 (hir: Refactor getters for owner nodes)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Contributor

bors commented Jan 31, 2024

⌛ Testing commit db41f4a with merge d53ddcd...

@bors
Copy link
Contributor

bors commented Jan 31, 2024

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing d53ddcd to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 31, 2024
@bors bors merged commit d53ddcd into rust-lang:master Jan 31, 2024
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 31, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d53ddcd): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.6% [-3.6%, -3.6%] 1
Improvements ✅
(secondary)
-0.6% [-1.0%, -0.5%] 7
All ❌✅ (primary) -3.6% [-3.6%, -3.6%] 1

Max RSS (memory usage)

Results

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)
2.0% [1.3%, 2.6%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.7% [-1.7%, -1.7%] 1
All ❌✅ (primary) - - 0

Cycles

Results

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)
-3.4% [-3.4%, -3.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.4% [-3.4%, -3.4%] 1

Binary size

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

Bootstrap: 661.683s -> 661.023s (-0.10%)
Artifact size: 308.09 MiB -> 308.12 MiB (0.01%)

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 3, 2024
hir: Remove the generic type parameter from `MaybeOwned`

It's only ever used with a reference to `OwnerInfo` as an argument.

Follow up to rust-lang#120346.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 4, 2024
Rollup merge of rust-lang#120610 - petrochenkov:maybeownogen, r=cjgillot

hir: Remove the generic type parameter from `MaybeOwned`

It's only ever used with a reference to `OwnerInfo` as an argument.

Follow up to rust-lang#120346.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

8 participants