Skip to content

Privacy: fix effective visibility calculation for items reachable through RPIT#156673

Open
Bryanskiy wants to merge 1 commit into
rust-lang:mainfrom
Bryanskiy:privacy_rtit
Open

Privacy: fix effective visibility calculation for items reachable through RPIT#156673
Bryanskiy wants to merge 1 commit into
rust-lang:mainfrom
Bryanskiy:privacy_rtit

Conversation

@Bryanskiy
Copy link
Copy Markdown
Contributor

For example, if a trait is ReachableThroughImplTrait, then the defs reachable from the trait should also be marked as ReachableThroughImplTrait. However, this is not the case, since effective visibility is incorrectly limited by nominal visibility.
r? @petrochenkov

@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 May 17, 2026
@petrochenkov
Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 17, 2026
rust-bors Bot pushed a commit that referenced this pull request May 17, 2026
Privacy: fix effective visibility calculation for items reachable through RPIT
Comment thread compiler/rustc_privacy/src/lib.rs
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 17, 2026

☀️ Try build successful (CI)
Build commit: e9de5d9 (e9de5d9b70ebe43e1edce7a1ee56737608d099c3, parent: ba0949ab745985a442e274ba52e8fb348cb0c662)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (e9de5d9): 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.5% [0.2%, 5.6%] 25
Regressions ❌
(secondary)
0.4% [0.2%, 1.3%] 21
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.2%, 5.6%] 25

Max RSS (memory usage)

Results (primary -3.7%, secondary -2.0%)

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)
-3.7% [-4.7%, -2.9%] 3
Improvements ✅
(secondary)
-2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) -3.7% [-4.7%, -2.9%] 3

Cycles

Results (primary 2.4%, secondary -0.3%)

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

mean range count
Regressions ❌
(primary)
4.8% [3.0%, 6.6%] 2
Regressions ❌
(secondary)
2.8% [2.8%, 2.8%] 1
Improvements ✅
(primary)
-2.5% [-2.5%, -2.5%] 1
Improvements ✅
(secondary)
-3.4% [-3.4%, -3.4%] 1
All ❌✅ (primary) 2.4% [-2.5%, 6.6%] 3

Binary size

Results (primary 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.2% [0.2%, 0.2%] 4
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [-0.4%, 0.2%] 5

Bootstrap: 511.658s -> 511.881s (0.04%)
Artifact size: 398.51 MiB -> 400.43 MiB (0.48%)

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

Bryanskiy commented May 18, 2026

The fix is too conservative. Even if there is no RPIT in the crate, it will mark private items as ReachableThroughImplTrait.

@petrochenkov
Copy link
Copy Markdown
Contributor

This needs an issue reproduction using impl Trait, but not involving associated type bounds, which are a known type privacy hole.
Otherwise it's not clear whether this change actually fixes anything.
@rustbot author

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

rustbot commented May 18, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 19, 2026

☔ The latest upstream changes (presumably #156228) made this pull request unmergeable. Please resolve the merge conflicts.

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-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

4 participants