Skip to content

privacy: share effective visibility initialization#155794

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
SynapLink:share-effective-vis-private-init
Apr 30, 2026
Merged

privacy: share effective visibility initialization#155794
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
SynapLink:share-effective-vis-private-init

Conversation

@SynapLink
Copy link
Copy Markdown
Contributor

Address one FIXME in EffectiveVisibilities by sharing the private effective visibility initialization path between effective_vis_or_private and update.

update now mutates the map entry in place instead of copying the effective visibility out and inserting it back at the end. The inserted default value and update logic are unchanged.

Validation:

  • git diff --check
  • python x.py check compiler/rustc_middle

@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 Apr 25, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 25, 2026

r? @dingxiangfei2009

rustbot has assigned @dingxiangfei2009.
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 73 candidates
  • Random selection from 20 candidates

@petrochenkov
Copy link
Copy Markdown
Contributor

r? @petrochenkov

Comment thread compiler/rustc_middle/src/middle/privacy.rs Outdated
@petrochenkov petrochenkov 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 Apr 27, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 28, 2026
@petrochenkov
Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 28, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Apr 28, 2026
…=<try>

privacy: share effective visibility initialization
@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 28, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 28, 2026

☀️ Try build successful (CI)
Build commit: 0794e59 (0794e594be25bac7bfb2f1ae3c188b2020623ab9, parent: 03c609abb6638f9d7f49f34326d4137d07f5cd61)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (0794e59): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.5% [-0.6%, -0.2%] 19
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-0.6%, -0.2%] 19

Max RSS (memory usage)

Results (primary 4.0%)

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

mean range count
Regressions ❌
(primary)
4.0% [3.2%, 5.5%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.0% [3.2%, 5.5%] 3

Cycles

This perf run didn't have relevant results for this metric.

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 487.089s -> 488.515s (0.29%)
Artifact size: 393.44 MiB -> 393.40 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 28, 2026
@petrochenkov
Copy link
Copy Markdown
Contributor

Nice.
r=me after squashing commits.

@bors rollup=maybe
The improvements in libc-0.2.172 and typenum-1.18.0 will be easily identifiable in a rollup.

@petrochenkov petrochenkov added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 29, 2026
@SynapLink SynapLink force-pushed the share-effective-vis-private-init branch from d4d7fce to 89e272c Compare April 29, 2026 07:57
@SynapLink
Copy link
Copy Markdown
Contributor Author

squashed, thanks.

@petrochenkov
Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 29, 2026

📌 Commit 89e272c has been approved by petrochenkov

It is now in the queue for this repository.

@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 Apr 29, 2026
@rust-bors rust-bors Bot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 29, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 29, 2026
…ate-init, r=petrochenkov

privacy: share effective visibility initialization

Address one `FIXME` in `EffectiveVisibilities` by sharing the private effective visibility initialization path between `effective_vis_or_private` and `update`.

`update` now mutates the map entry in place instead of copying the effective visibility out and inserting it back at the end. The inserted default value and update logic are unchanged.

Validation:
- `git diff --check`
- `python x.py check compiler/rustc_middle`
rust-bors Bot pushed a commit that referenced this pull request Apr 29, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #155189 (simd_reduce_min/max: remove float support)
 - #155721 (When archive format is wrong produce an error instead of ICE)
 - #155794 (privacy: share effective visibility initialization)
 - #155856 (std_detect: support detecting more features on aarch64 Windows)
 - #155861 (Suggest `[const] Trait` bounds in more places)
 - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - #155916 (Update with new LLVM 22 target for `wasm32-wali-linux-musl` target)
 - #155935 (remap OUT_DIR paths to fix build script path leakage in crate metadata. )
 - #155950 (use the new `//@ needs-asm-mnemonic: ret` more)
 - #155958 (ci(free-disk-space): remove more tools and fix warnings)
 - #155949 (Update `opt_ast_lowering_delayed_lints` query to allow "stealing" lints, allowing to use `FnOnce` instead of `Fn`)
 - #155951 (Make `FlatMapInPlaceVec` an unsafe trait.)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 29, 2026
…ate-init, r=petrochenkov

privacy: share effective visibility initialization

Address one `FIXME` in `EffectiveVisibilities` by sharing the private effective visibility initialization path between `effective_vis_or_private` and `update`.

`update` now mutates the map entry in place instead of copying the effective visibility out and inserting it back at the end. The inserted default value and update logic are unchanged.

Validation:
- `git diff --check`
- `python x.py check compiler/rustc_middle`
rust-bors Bot pushed a commit that referenced this pull request Apr 29, 2026
…uwer

Rollup of 22 pull requests

Successful merges:

 - #154149 (resolve: Extend `ambiguous_import_visibilities` deprecation lint to glob-vs-glob ambiguities)
 - #155189 (simd_reduce_min/max: remove float support)
 - #155453 (apply Cortex-A53 errata 843419 mitigation to the AArch64 Linux targets)
 - #155562 (Add a missing `GenericTypeVisitable`, and avoid having interner traits for `FnSigKind` and `Abi`)
 - #155608 (rustc_middle: Implement the `partial_cmp` operation for `DefId`s)
 - #155721 (When archive format is wrong produce an error instead of ICE)
 - #155794 (privacy: share effective visibility initialization)
 - #155832 (c-variadic: more precise compatibility check in const-eval)
 - #155856 (std_detect: support detecting more features on aarch64 Windows)
 - #155861 (Suggest `[const] Trait` bounds in more places)
 - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - #155916 (Update with new LLVM 22 target for `wasm32-wali-linux-musl` target)
 - #155935 (remap OUT_DIR paths to fix build script path leakage in crate metadata. )
 - #155950 (use the new `//@ needs-asm-mnemonic: ret` more)
 - #155958 (ci(free-disk-space): remove more tools and fix warnings)
 - #155966 (miri subtree update)
 - #155711 (bump curl-sys and openssl-sys to support OpenSSL 4.0.x)
 - #155831 (Add `AcceptContext::expect_key_value`)
 - #155877 (Avoid misleading return-type note for foreign `Fn` callees)
 - #155949 (Update `opt_ast_lowering_delayed_lints` query to allow "stealing" lints, allowing to use `FnOnce` instead of `Fn`)
 - #155951 (Make `FlatMapInPlaceVec` an unsafe trait.)
 - #155967 (Fix `doc_cfg` feature for extern items)
rust-bors Bot pushed a commit that referenced this pull request Apr 29, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - #155966 (miri subtree update)
 - #154149 (resolve: Extend `ambiguous_import_visibilities` deprecation lint to glob-vs-glob ambiguities)
 - #155189 (simd_reduce_min/max: remove float support)
 - #155562 (Add a missing `GenericTypeVisitable`, and avoid having interner traits for `FnSigKind` and `Abi`)
 - #155608 (rustc_middle: Implement the `partial_cmp` operation for `DefId`s)
 - #155721 (When archive format is wrong produce an error instead of ICE)
 - #155794 (privacy: share effective visibility initialization)
 - #155832 (c-variadic: more precise compatibility check in const-eval)
 - #155856 (std_detect: support detecting more features on aarch64 Windows)
 - #155861 (Suggest `[const] Trait` bounds in more places)
 - #155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - #155916 (Update with new LLVM 22 target for `wasm32-wali-linux-musl` target)
 - #155935 (remap OUT_DIR paths to fix build script path leakage in crate metadata. )
 - #155950 (use the new `//@ needs-asm-mnemonic: ret` more)
 - #155958 (ci(free-disk-space): remove more tools and fix warnings)
 - #155711 (bump curl-sys and openssl-sys to support OpenSSL 4.0.x)
 - #155831 (Add `AcceptContext::expect_key_value`)
 - #155877 (Avoid misleading return-type note for foreign `Fn` callees)
 - #155949 (Update `opt_ast_lowering_delayed_lints` query to allow "stealing" lints, allowing to use `FnOnce` instead of `Fn`)
 - #155951 (Make `FlatMapInPlaceVec` an unsafe trait.)
 - #155967 (Fix `doc_cfg` feature for extern items)
@rust-bors rust-bors Bot merged commit fb08236 into rust-lang:main Apr 30, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 30, 2026
rust-timer added a commit that referenced this pull request Apr 30, 2026
Rollup merge of #155794 - SynapLink:share-effective-vis-private-init, r=petrochenkov

privacy: share effective visibility initialization

Address one `FIXME` in `EffectiveVisibilities` by sharing the private effective visibility initialization path between `effective_vis_or_private` and `update`.

`update` now mutates the map entry in place instead of copying the effective visibility out and inserting it back at the end. The inserted default value and update logic are unchanged.

Validation:
- `git diff --check`
- `python x.py check compiler/rustc_middle`
@JonathanBrouwer
Copy link
Copy Markdown
Contributor

JonathanBrouwer commented Apr 30, 2026

@rust-timer build 71f495b

Let's see if the rust-timer results above reproduce, the rollup had a few more regressions & improvements than the results above

@rust-timer

This comment has been minimized.

pull Bot pushed a commit to LeeeeeeM/miri that referenced this pull request Apr 30, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - rust-lang/rust#155966 (miri subtree update)
 - rust-lang/rust#154149 (resolve: Extend `ambiguous_import_visibilities` deprecation lint to glob-vs-glob ambiguities)
 - rust-lang/rust#155189 (simd_reduce_min/max: remove float support)
 - rust-lang/rust#155562 (Add a missing `GenericTypeVisitable`, and avoid having interner traits for `FnSigKind` and `Abi`)
 - rust-lang/rust#155608 (rustc_middle: Implement the `partial_cmp` operation for `DefId`s)
 - rust-lang/rust#155721 (When archive format is wrong produce an error instead of ICE)
 - rust-lang/rust#155794 (privacy: share effective visibility initialization)
 - rust-lang/rust#155832 (c-variadic: more precise compatibility check in const-eval)
 - rust-lang/rust#155856 (std_detect: support detecting more features on aarch64 Windows)
 - rust-lang/rust#155861 (Suggest `[const] Trait` bounds in more places)
 - rust-lang/rust#155899 (`dlltool`: Set the working directory to workaround `--temp-prefix` bug)
 - rust-lang/rust#155916 (Update with new LLVM 22 target for `wasm32-wali-linux-musl` target)
 - rust-lang/rust#155935 (remap OUT_DIR paths to fix build script path leakage in crate metadata. )
 - rust-lang/rust#155950 (use the new `//@ needs-asm-mnemonic: ret` more)
 - rust-lang/rust#155958 (ci(free-disk-space): remove more tools and fix warnings)
 - rust-lang/rust#155711 (bump curl-sys and openssl-sys to support OpenSSL 4.0.x)
 - rust-lang/rust#155831 (Add `AcceptContext::expect_key_value`)
 - rust-lang/rust#155877 (Avoid misleading return-type note for foreign `Fn` callees)
 - rust-lang/rust#155949 (Update `opt_ast_lowering_delayed_lints` query to allow "stealing" lints, allowing to use `FnOnce` instead of `Fn`)
 - rust-lang/rust#155951 (Make `FlatMapInPlaceVec` an unsafe trait.)
 - rust-lang/rust#155967 (Fix `doc_cfg` feature for extern items)
@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (71f495b): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.2% [0.1%, 0.2%] 3
Improvements ✅
(primary)
-0.5% [-0.6%, -0.4%] 18
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.0%] 3
All ❌✅ (primary) -0.5% [-0.6%, -0.4%] 18

Max RSS (memory usage)

Results (secondary 1.6%)

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

Cycles

Results (secondary -1.7%)

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)
2.6% [2.2%, 2.9%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.9% [-7.9%, -2.0%] 4
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 487.214s -> 483.892s (-0.68%)
Artifact size: 390.94 MiB -> 392.96 MiB (0.52%)

@rustbot rustbot added the perf-regression Performance regression. label Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. 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.

6 participants