privacy: Assert that compared visibilities are (usually) ordered#155257
privacy: Assert that compared visibilities are (usually) ordered#155257petrochenkov wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
r? @adwinwhite rustbot has assigned @adwinwhite. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
privacy: Assert that compared visibilities are (usually) ordered
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
This comment has been minimized.
This comment has been minimized.
2b33358 to
8528576
Compare
This comment has been minimized.
This comment has been minimized.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
privacy: Assert that compared visibilities are (usually) ordered
This comment has been minimized.
This comment has been minimized.
|
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 @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
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.
CyclesResults (secondary -3.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 489.936s -> 490.568s (0.13%) |
|
One small regression on libc (which is a sort of stress test for large number of imports and other items). |
|
This could also be potentially blocked on #155213 which addresses on of the FIXMEs here. |
|
@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. |
|
Hm, this is a general visibility infra used everywhere from name resolution to type checking, I don't think anyone really specializes in it. |
|
@adwinwhite |
This comment has been minimized.
This comment has been minimized.
Also use `greater_than` instead of `is_at_least` for comparing visibilities, which we can do because visibilities are asserted to be ordered now.
8528576 to
7408ab0
Compare
|
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. |
|
@rustbot ready @adwinwhite feel free to reroll if the explanation in #155257 (comment) does not make it clear. |
| self, | ||
| vis: Visibility<impl Into<DefId>>, | ||
| tcx: TyCtxt<'_>, | ||
| ) -> Result<Ordering, (DefId, DefId)> { |
There was a problem hiding this comment.
This can be Option<Ordering>, but then we'll need to add some Debug and Copy bounds on fn greater_than.
Not sure what is better, maybe the bounds, because that would be a purely compile-time trouble.
#155608 has a way to avoid comparisons in both directions if this regression shows up again, so no need to switch to debug-only checking. |
View all comments
And make "greater than" (
>) the new primary operation for comparing visibilities instead of "is at least" (>=).