-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Show whether ?Sized
parameters are actually Sized
#143559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
The job Click to see the possible cause of the failure (guessed by this bot)
|
I know this is WIP but if I may let me collect initial perf data (I've only skimmed the changes and haven't reviewed anything yet). [@]bors2 try [@]rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Show whether `?Sized` parameters are actually `Sized` A mostly-working, "some polish still required" attempt at fixing #143197 - Add a new `allow_unsized: bool` field to `GenericParamDefKind::Type`. - Expose that field as-is to rustdoc JSON, without tampering with `?Sized` clauses there. - Suppress `?Sized` from HTML where `Sized` is implied. I haven't figured out a good way to suppress `?Sized` from `impl Trait` in function parameters in HTML yet. The synthetic generics data doesn't seem to be "nearby" so more refactoring might be needed. I included a failing test case to remind me of this. r? fmease
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (55a9833): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient 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%, secondary 2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.4%, secondary 2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 463.852s -> 465.016s (0.25%) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I've not looked at the impl).
I agree that we should probably remove these misleading bounds in HTML.
But I wounder if we should do the same in JSON? Rather than having a separate bool
field?
|
||
// Generic functions | ||
//@ is "$.index[?(@.name=='func_custom')].inner.function.generics.params[0].kind.type.allow_unsized" false | ||
pub fn func_custom<T: ?Sized + CustomSized>() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should test that we don't remove the ?Sized
bound from the bounds list, even though it ends up not mattering.
It's a good question. I think there are two broadly-speaking reasonable choices, and one option we should avoid. We should avoid stripping Then the two broadly-acceptable options are both adding a bool, and differ over what the bool says:
I'm ambivalent between the two options, and could easily be talked into going for the second one if you have a strong preference that way. |
Taking a look at the benchmarks, I'm surprised that e.g. a simple "hello world" program takes 3% more instructions to document when there are no generics in it. This seems suspect — I wouldn't expect my code changes to get hit basically at all, let alone to the tune of a 3% slowdown. |
A mostly-working, "some polish still required" attempt at fixing #143197
allow_unsized: bool
field toGenericParamDefKind::Type
.?Sized
clauses there.?Sized
from HTML whereSized
is implied.I haven't figured out a good way to suppress
?Sized
fromimpl Trait
in function parameters in HTML yet. The synthetic generics data doesn't seem to be "nearby" so more refactoring might be needed. I included a failing test case to remind me of this.r? fmease