-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Sized Hierarchy: Part I #137944
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?
Sized Hierarchy: Part I #137944
Conversation
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
73f1b4f
to
7f509ab
Compare
This comment has been minimized.
This comment has been minimized.
2537bfb
to
b31fd85
Compare
cc @rust-lang/lang |
Does this perhaps fix #127336 by rejecting it? |
This comment was marked as resolved.
This comment was marked as resolved.
b31fd85
to
2beed43
Compare
It doesn't currently. |
2beed43
to
839b844
Compare
Undrafting now that CI passes |
As before, updating types using extern types to use `PointeeSized` bounds.
Unexpected Clippy lint triggering is fixed in upcoming commits but is necessary for `cfg(bootstrap)`.
Existing lints that had special-casing for `Sized` predicates ought to have these same special cases applied to `MetaSized` predicates.
One clippy test is `no_core` and needs to have `MetaSized` and `PointeeSized` added to it.
As in many previous commits, adding the new traits to minicore, but this time for cranelift and gcc.
It isn't clear why the `Deref` impl isn't found for this in a stage two build, but presumably relates to `rustc_middle::ty::RawList` containing an extern type and `Deref` not yet being relaxed to `PointeeSized` (this is technically a breaking change but unlikely to be one and will be tested in a follow-up).
These error messages include lines of the standard library which have changed and so need updated.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (bde19de): comparison URL. Overall result: ❌ regressions - please read the text belowBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary 2.6%, secondary 1.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary 3.1%, secondary -4.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResults (primary 0.0%, secondary 0.0%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 773.561s -> 774.546s (0.13%) |
Seems like addressing the review feedback above has regressed performance more :( |
84e7a29
to
e1ad8d3
Compare
Submitted a bunch of perf runs to go overnight to try and isolate the change that caused the regression: |
…<try> [PERF] Sized Hierarchy: Attempt 1 A perf run reverting changes to the unelaborated sizedness optimisation on rust-lang#137944 to determine if it caused the regression post-review feedback. r? `@ghost`
…<try> [PERF] Sized Hierarchy: Attempt 2 A perf run reverting changes to predicate elaboration on rust-lang#137944 to determine if it caused the regression post-review feedback. r? `@ghost`
…<try> [PERF] Sized Hierarchy: Attempt 3 A perf run reverting changes that made `PointeeSized`'s builtin impl unreachable on rust-lang#137944 to determine if it caused the regression post-review feedback. r? `@ghost`
…<try> [PERF] Sized Hierarchy: Attempt 4 A perf run reverting changes that used `as_lang_item` more over `is_lang_item` on rust-lang#137944 to determine if it caused the regression post-review feedback. r? `@ghost`
…<try> [PERF] Sized Hierarchy: Attempt 1 A perf run reverting changes to the unelaborated sizedness optimisation on rust-lang#137944 to determine if it caused the regression post-review feedback. r? `@ghost`
…trait-ref, r=<try> trait_sel: deep reject `match_normalize_trait_ref` Spotted during an in-person review of rust-lang#137944 at RustWeek: `match_normalize_trait_ref` could be using `DeepRejectCtxt` to exit early as an optimisation for projection candidates, like is done with param candidates. r? `@lcnr` cc `@oli-obk`
None of those partial reverts explain the 5% regression over the patch's previous regression. Some were mildly better or mildly worse, but not sufficient. I didn't revert each change to exactly what it was proor, but it should have been close enough. It could be a combination of things? Only thing I didn't check was the addition of the |
It appears that the difference is just changes in the benchmark suite. |
e1ad8d3
to
473fba9
Compare
…trait-ref, r=lcnr trait_sel: deep reject `match_normalize_trait_ref` Spotted during an in-person review of rust-lang#137944 at RustWeek: `match_normalize_trait_ref` could be using `DeepRejectCtxt` to exit early as an optimisation for projection candidates, like is done with param candidates. r? `@lcnr` cc `@oli-obk`
This comment was marked as resolved.
This comment was marked as resolved.
473fba9
to
20f1ece
Compare
This patch implements the non-const parts of rust-lang/rfcs#3729. It introduces two new traits to the standard library,
MetaSized
andPointeeSized
. See the RFC for the rationale behind these traits and to discuss whether this change makes sense in the abstract.These traits are unstable (as is their constness), so users cannot refer to them without opting-in to
feature(sized_hierarchy)
. These traits are not behindcfg
s as this would make implementation unfeasible, there would simply be too manycfg
s required to add the necessary bounds everywhere. So, likeSized
, these traits are automatically implemented by the compiler.RFC 3729 describes changes which are necessary to preserve backwards compatibility given the introduction of these traits, which are implemented and as follows:
?Sized
is rewritten asMetaSized
MetaSized
is added as a default supertrait for all traits w/out an explicit sizedness supertrait already.There are no edition migrations implemented in this, as these are primarily required for the constness parts of the RFC and prior to stabilisation of this (and so will come in follow-up PRs alongside the const parts). All diagnostic output should remain the same (showing
?Sized
even if the compiler seesMetaSized
) unless thesized_hierarchy
feature is enabled.Due to the use of unstable extern types in the standard library and rustc, some bounds in both projects have had to be relaxed already - this is unfortunate but unavoidable so that these extern types can continue to be used where they were before. Performing these relaxations in the standard library and rustc are desirable longer-term anyway, but some bounds are not as relaxed as they ideally would be due to the inability to relax
Deref::Target
(this will be investigated separately).It is hoped that this is implemented such that it could be merged and these traits could exist "under the hood" without that being observable to the user (other than in any performance impact this has on the compiler, etc). Some details might leak through due to the standard library relaxations, but this has not been observed in test output.
Notes:
PointeeSized
is a different name from the RFC just to make it more obvious that it is different fromstd::ptr::Pointee
but all the names are yet to be bikeshed anyway.Fixes #79409.
r? @ghost (I'll discuss this with relevant teams to find a reviewer)