Skip to content

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

Open
petrochenkov wants to merge 4 commits intorust-lang:mainfrom
petrochenkov:visatleast
Open

privacy: Assert that compared visibilities are (usually) ordered#155257
petrochenkov wants to merge 4 commits intorust-lang:mainfrom
petrochenkov:visatleast

Conversation

@petrochenkov
Copy link
Copy Markdown
Contributor

And make "greater than" (>) the new base 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
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 13, 2026

💔 Test for 5f54327 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 14, 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

@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

Hm, this is a general visibility infra used everywhere from name resolution to type checking, I don't think anyone really specializes in it.
I'll block it on #155213 and then maybe reroll.

@petrochenkov
Copy link
Copy Markdown
Contributor Author

@adwinwhite
Visibilities (pub or pub(in module)) form a tree, the same tree as crate root and mod items.
So, like modules they are partially ordered, if module A is an ancestor of module B, then they are ordered and pub(in A) > pub(in b).
However, modules are not always ancestors of each other, they can be neighbors, for example, then the corresponding visibilities are unordered.

@petrochenkov petrochenkov added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 17, 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-blocked Status: Blocked on something else such as an RFC or other implementation work. 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.

5 participants