Skip to content

privacy: Assert that compared visibilities are (usually) ordered#155257

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
petrochenkov:visatleast
Apr 25, 2026
Merged

privacy: Assert that compared visibilities are (usually) ordered#155257
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
petrochenkov:visatleast

Conversation

@petrochenkov
Copy link
Copy Markdown
Contributor

@petrochenkov petrochenkov commented Apr 13, 2026

View all comments

And make "greater than" (>) the new primary operation for comparing visibilities instead of "is at least" (>=).

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

rustbot commented Apr 13, 2026

r? @adwinwhite

rustbot has assigned @adwinwhite.
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 69 candidates
  • Random selection from 12 candidates

@petrochenkov
Copy link
Copy Markdown
Contributor Author

@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 Apr 13, 2026
privacy: Assert that compared visibilities are (usually) ordered
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 13, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors Bot 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 13, 2026
@rust-bors

This comment was marked as resolved.

@rust-log-analyzer

This comment has been minimized.

@rustbot

This comment has been minimized.

@petrochenkov
Copy link
Copy Markdown
Contributor Author

@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 Apr 14, 2026
privacy: Assert that compared visibilities are (usually) ordered
@petrochenkov petrochenkov removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 14, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 14, 2026

☀️ Try build successful (CI)
Build commit: 0c52563 (0c5256376cfe5d7821eaee808f971cc64299b5ff, parent: 12f35ad39ed3e39df4d953c46d4f6cc6c82adc96)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (0c52563): comparison URL.

Overall result: ❌ regressions - 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.2% [0.2%, 0.2%] 9
Regressions ❌
(secondary)
0.6% [0.3%, 1.7%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.2% [0.2%, 0.2%] 9

Max RSS (memory usage)

Results (primary 1.6%)

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

mean range count
Regressions ❌
(primary)
1.6% [1.1%, 2.1%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.6% [1.1%, 2.1%] 2

Cycles

Results (secondary -3.3%)

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)
-3.3% [-4.4%, -2.1%] 2
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 489.936s -> 490.568s (0.13%)
Artifact size: 394.18 MiB -> 394.10 MiB (-0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Apr 14, 2026
@petrochenkov
Copy link
Copy Markdown
Contributor Author

One small regression on libc (which is a sort of stress test for large number of imports and other items).
I think we can merge like this, or switch to debug_assert, but then only @matthiaskrgr's fuzzing or something like that will find the potential issues.

@petrochenkov petrochenkov added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 14, 2026
@petrochenkov
Copy link
Copy Markdown
Contributor Author

This could also be potentially blocked on #155213 which addresses on of the FIXMEs here.

@adwinwhite
Copy link
Copy Markdown
Contributor

@petrochenkov Sorry but perhaps you can manually pick a reviewer who's familiar with this part? I'm not sure that reroll can get to the right person.

@petrochenkov
Copy link
Copy Markdown
Contributor Author

I analyzed one of the FIXMEs, it will only be unordered in erroneous cases after some fixes, so we'll need a delayed_bug instead of panic, so I'll just change it now.

Also use `greater_than` instead of `is_at_least` for comparing visibilities, which we can do because visibilities are asserted to be ordered now.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 23, 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
Copy Markdown
Contributor Author

@rustbot ready

@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 23, 2026
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

--- BACKTRACE vvv
   0: <bootstrap::utils::exec::DeferredCommand>::finish_process
             at /checkout/src/bootstrap/src/utils/exec.rs:939:17
   1: <bootstrap::utils::exec::DeferredCommand>::wait_for_output::<&bootstrap::utils::exec::ExecutionContext>
             at /checkout/src/bootstrap/src/utils/exec.rs:831:21
   2: <bootstrap::utils::exec::ExecutionContext>::run
             at /checkout/src/bootstrap/src/utils/exec.rs:741:45
   3: <bootstrap::utils::exec::BootstrapCommand>::run::<&bootstrap::core::builder::Builder>
             at /checkout/src/bootstrap/src/utils/exec.rs:339:27
   4: bootstrap::core::build_steps::toolstate::checkout_toolstate_repo
             at /checkout/src/bootstrap/src/core/build_steps/toolstate.rs:319:10
   5: <bootstrap::core::build_steps::toolstate::ToolStateCheck as bootstrap::core::builder::Step>::run
             at /checkout/src/bootstrap/src/core/build_steps/toolstate.rs:177:9
   6: <bootstrap::core::builder::Builder>::ensure::<bootstrap::core::build_steps::toolstate::ToolStateCheck>
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1579:36
   7: <bootstrap::core::build_steps::toolstate::ToolStateCheck as bootstrap::core::builder::Step>::make_run
             at /checkout/src/bootstrap/src/core/build_steps/toolstate.rs:230:21
   8: <bootstrap::core::builder::StepDescription>::maybe_run
             at /checkout/src/bootstrap/src/core/builder/mod.rs:476:13
   9: bootstrap::core::builder::cli_paths::match_paths_to_steps_and_run
             at /checkout/src/bootstrap/src/core/builder/cli_paths.rs:232:18
  10: <bootstrap::core::builder::Builder>::run_step_descriptions
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1122:9
  11: <bootstrap::core::builder::Builder>::execute_cli
             at /checkout/src/bootstrap/src/core/builder/mod.rs:1101:14
  12: <bootstrap::Build>::build
             at /checkout/src/bootstrap/src/lib.rs:799:25
  13: bootstrap::main
             at /checkout/src/bootstrap/src/bin/main.rs:130:11
  14: <fn() as core::ops::function::FnOnce<()>>::call_once
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/ops/function.rs:250:5
  15: std::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/sys/backtrace.rs:166:18
  16: std::rt::lang_start::<()>::{closure#0}
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/rt.rs:206:18
  17: <&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe as core::ops::function::FnOnce<()>>::call_once
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/core/src/ops/function.rs:287:21
  18: std::panicking::catch_unwind::do_call::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:581:40
  19: std::panicking::catch_unwind::<i32, &dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:544:19
  20: std::panic::catch_unwind::<&dyn core::ops::function::Fn<(), Output = i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe, i32>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panic.rs:359:14
  21: std::rt::lang_start_internal::{closure#0}
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/rt.rs:175:24
  22: std::panicking::catch_unwind::do_call::<std::rt::lang_start_internal::{closure#0}, isize>
             at /rustc/ef0fb8a2563200e322fa4419f09f65a63742038c/library/std/src/panicking.rs:581:40
---
  29: __libc_start_main
  30: _start


Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:00:03
  local time: Thu Apr 23 16:34:01 UTC 2026
  network time: Thu, 23 Apr 2026 16:34:01 GMT
##[error]Process completed with exit code 1.
##[group]Run echo "disk usage:"

@petrochenkov
Copy link
Copy Markdown
Contributor Author

(The CI failure is spurious.)

@adwinwhite
Copy link
Copy Markdown
Contributor

I guess unordered comparison doesn't make sense anyway so it's intended and fine to err in those cases.

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 25, 2026

📌 Commit 714df2b has been approved by adwinwhite

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 Apr 25, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 25, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 25, 2026

☀️ Test successful - CI
Approved by: adwinwhite
Duration: 3h 16m 30s
Pushing 9838411 to main...

@rust-bors rust-bors Bot merged commit 9838411 into rust-lang:main Apr 25, 2026
4 of 12 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 25, 2026
@github-actions
Copy link
Copy Markdown
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 fb76025 (parent) -> 9838411 (this PR)

Test differences

Show 25 test diffs

25 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 9838411cb723b60dc62b1625751075c4d933b992 --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. x86_64-gnu-llvm-22-3: 1h 37m -> 2h 2m (+25.7%)
  2. dist-i686-mingw: 2h 12m -> 2h 44m (+24.1%)
  3. dist-x86_64-illumos: 1h 23m -> 1h 42m (+23.4%)
  4. aarch64-apple: 3h 17m -> 2h 52m (-12.3%)
  5. x86_64-msvc-ext3: 1h 43m -> 1h 56m (+12.2%)
  6. x86_64-gnu-llvm-21-1: 1h 7m -> 1h 14m (+11.0%)
  7. dist-aarch64-apple: 1h 38m -> 1h 48m (+10.1%)
  8. x86_64-gnu-gcc: 1h 10m -> 1h 3m (-10.0%)
  9. dist-aarch64-llvm-mingw: 1h 36m -> 1h 45m (+9.6%)
  10. x86_64-msvc-1: 2h 45m -> 2h 29m (-9.4%)
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
Copy Markdown
Collaborator

Finished benchmarking commit (9838411): comparison URL.

Overall result: ❌ regressions - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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.4% [0.2%, 0.7%] 12
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.2%, 0.7%] 12

Max RSS (memory usage)

Results (secondary -2.2%)

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)
3.6% [1.0%, 6.2%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.0% [-7.7%, -2.8%] 3
All ❌✅ (primary) - - 0

Cycles

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

Binary size

Results (secondary 0.1%)

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

Bootstrap: 487.131s -> 486.61s (-0.11%)
Artifact size: 394.07 MiB -> 394.05 MiB (-0.01%)

@Mark-Simulacrum Mark-Simulacrum added the perf-regression-triaged The performance regression has been triaged. label Apr 27, 2026
@Mark-Simulacrum
Copy link
Copy Markdown
Member

Marking perf regression as triaged. The tradeoff was evaluated as part of PR discussion and we have a follow-up that may mitigate some of the impact in #155608.

jhpratt added a commit to jhpratt/rust that referenced this pull request May 5, 2026
resolve: Catch "cannot reexport" errors from macros 2.0 better

After the macro 2.0 related holes are closed we can report `span_delayed_bug`s in more situations.

Merging rust-lang#155945 would make changes in this PR simpler, but that PR will probably have to wait for quite some time.

This is a continuation of my import & privacy invariant hardening changes from rust-lang#155257, rust-lang#155213, rust-lang#154149, etc.

r? @mu001999
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request May 5, 2026
resolve: Catch "cannot reexport" errors from macros 2.0 better

After the macro 2.0 related holes are closed we can report `span_delayed_bug`s in more situations.

Merging rust-lang#155945 would make changes in this PR simpler, but that PR will probably have to wait for quite some time.

This is a continuation of my import & privacy invariant hardening changes from rust-lang#155257, rust-lang#155213, rust-lang#154149, etc.

r? @mu001999
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 5, 2026
resolve: Catch "cannot reexport" errors from macros 2.0 better

After the macro 2.0 related holes are closed we can report `span_delayed_bug`s in more situations.

Merging rust-lang#155945 would make changes in this PR simpler, but that PR will probably have to wait for quite some time.

This is a continuation of my import & privacy invariant hardening changes from rust-lang#155257, rust-lang#155213, rust-lang#154149, etc.

r? @mu001999
rust-timer added a commit that referenced this pull request May 5, 2026
Rollup merge of #156014 - petrochenkov:kvak, r=mu001999

resolve: Catch "cannot reexport" errors from macros 2.0 better

After the macro 2.0 related holes are closed we can report `span_delayed_bug`s in more situations.

Merging #155945 would make changes in this PR simpler, but that PR will probably have to wait for quite some time.

This is a continuation of my import & privacy invariant hardening changes from #155257, #155213, #154149, etc.

r? @mu001999
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. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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