Skip to content

Conversation

@petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Dec 30, 2025

Also, avoid creating fresh name declarations and overwriting declarations in modules to update some fields in DeclData, when possible.
Instead, change the fields directly in DeclData using cells.

Unblocks #149195.

@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 Dec 30, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 30, 2025

r? @lcnr

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

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@petrochenkov
Copy link
Contributor Author

r? @yaahc maybe

@bors

This comment was marked as resolved.

@rust-bors

This comment was marked as resolved.

@yaahc yaahc added the A-resolve Area: Name/path resolution done by `rustc_resolve` specifically label Jan 5, 2026
Copy link
Member

@yaahc yaahc left a comment

Choose a reason for hiding this comment

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

Still reviewing. I'm struggling to fully understand what this does and how it works. I might need a more in-depth explanation in order to feel comfortable approving but I'm not done reviewing this yet and plan to pick it up tomorrow so I'll let you know if I get stuck and need said help understanding.

View changes since this review

// - A glob binding is overwritten by its clone after setting ambiguity in it.
// FIXME: avoid this by removing `warn_ambiguity`, or by triggering glob re-fetch
Copy link
Member

Choose a reason for hiding this comment

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

confirming, this is the case with this PR right, not just before it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, previously these cases fell under a slightly different FIXME ("avoid this by putting NameBindingData::ambiguity under a cell and updating it in place").

// - A glob binding is overwritten by its clone after setting ambiguity in it.
// FIXME: avoid this by removing `warn_ambiguity`, or by triggering glob re-fetch
// with the same binding in some way.
// - A glob binding is overwritten by a glob binding re-fetching an
Copy link
Member

Choose a reason for hiding this comment

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

struggling to understand what this means and how it interacts w/ the 55884 testcase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So suppose we have a glob g1 importing from module m1, and m1 has another glob g2 importing from module m2.
What this says is that when something in m2 changes, we are re-fetching not only g2, but g1 as well.
And g1 will re-fetch updated bindings from g2.
(And of course there also may be more than 2 globs referring to each other in this chain.)

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 don't think this is the case that applies to the diagnostic change in tests/ui/imports/issue-55884-1.rs.
(The diagnostic change itself looks right, not sure why it wasn't reported before, maybe due to the deduplication from matches_previous_ambiguity_error, I'll check.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests/ui/imports/issue-55884-1.rs change is not due to the deduplication.

Previously use m::S recorded the outdated resolution of m::S that is not yet ambiguous, and S {} used it.
(Import validation later observed the updated ambiguous resolution though, and reported an error.)
Now the resolution is updated in place, so S {} sees it too, and reports the ambiguity error on use too.

Copy link
Member

Choose a reason for hiding this comment

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

What this says is that when something in m2 changes, we are re-fetching not only g2, but g1 as well.

Aah, I think I understand, and when you say "when something in m2 changes" you mean "a macro gets expanded or an import gets materialized", not anything related to incremental compilation.

@petrochenkov
Copy link
Contributor Author

FWIW, this was tested with crater as a part of #149195 (without the update in place part).

@rustbot

This comment has been minimized.

@petrochenkov
Copy link
Contributor Author

(Now after #149681 this should be a bit simpler.)

@bors

This comment was marked as resolved.

@rust-bors

This comment was marked as resolved.

Copy link
Member

@yaahc yaahc left a comment

Choose a reason for hiding this comment

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

Alright, I think I understand and it seems to make sense.

I'm not 100% sure I understand this well enough to say "Would I be able to spot non-obvious side effects?"1, but I'm also not confident there's anyone else on t-compiler that would be better suited to approve this so given it's already been cratered I'm going to go ahead and say r=me when conflicts are fixed.

View changes since this review

Footnotes

  1. https://forge.rust-lang.org/compiler/reviews.html#checklist-for-reviewers

instead of overwriting bindings in modules.
Do not overwrite unless necessary, and combine both globs instead of losing the first one.
instead of creating fresh bindings, except in one case.
@rustbot
Copy link
Collaborator

rustbot commented Jan 8, 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.

@petrochenkov
Copy link
Contributor Author

@bors r=yaahc

@rust-bors rust-bors bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 8, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 8, 2026

📌 Commit a251ae2 has been approved by yaahc

It is now in the queue for this repository.

@rust-bors rust-bors bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 8, 2026
@matthiaskrgr
Copy link
Member

@bors rollup=never
for perf, also probably want to be able to bisect to this so lets not bury it in a rollup

@rust-bors

This comment has been minimized.

@rust-bors rust-bors bot added the merged-by-bors This PR was explicitly merged by bors. label Jan 10, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 10, 2026

☀️ Test successful - CI
Approved by: yaahc
Pushing 1b9ae9e to main...

@rust-bors rust-bors bot merged commit 1b9ae9e into rust-lang:main Jan 10, 2026
12 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Jan 10, 2026
@github-actions
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 2b82e05 (parent) -> 1b9ae9e (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 1b9ae9eddcbd3b0105a0828e323c6db5f1e6ad0c --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. pr-check-1: 2033.6s -> 1668.6s (-18.0%)
  2. aarch64-apple: 11818.5s -> 9927.4s (-16.0%)
  3. x86_64-gnu-llvm-20-1: 4475.1s -> 3821.5s (-14.6%)
  4. i686-gnu-2: 6146.6s -> 5277.0s (-14.1%)
  5. x86_64-gnu-llvm-20-2: 5901.1s -> 5098.1s (-13.6%)
  6. pr-check-2: 2576.4s -> 2263.1s (-12.2%)
  7. x86_64-rust-for-linux: 3119.4s -> 2747.2s (-11.9%)
  8. x86_64-gnu-llvm-20: 5162.0s -> 4554.9s (-11.8%)
  9. x86_64-gnu-miri: 5020.5s -> 4447.2s (-11.4%)
  10. aarch64-msvc-1: 6684.1s -> 7405.0s (+10.8%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1b9ae9e): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (primary 2.2%)

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

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

Cycles

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

Binary size

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

Bootstrap: 474.298s -> 472.721s (-0.33%)
Artifact size: 391.29 MiB -> 391.33 MiB (0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-resolve Area: Name/path resolution done by `rustc_resolve` specifically 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