-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Implement unstable trait impl #140399
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
Implement unstable trait impl #140399
Conversation
d01f12a
to
9e139e1
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
486d3d3
to
02f780f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
567ec89
to
80fd239
Compare
☔ The latest upstream changes (presumably #142299) made this pull request unmergeable. Please resolve the merge conflicts. |
850e3e1
to
27d9e21
Compare
637b820
to
e331de1
Compare
[Perf] Remove call to hir_attrs in predicates_of <!-- homu-ignore:start --> <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r? <reviewer name> --> <!-- homu-ignore:end --> Test how much regression we still have if we remove the call to ``hir_attrs`` in ``predicates_of`` for #140399 r? ghost
looks like the cost is from just the new While I think changing Unless you want to try something to reduce the perf impact, r=me |
@bors r=lcnr rollup=never I would really like to get this perf back but also supporting stability of |
@bors r=lcnr,BoxyUwU |
💡 This pull request was already approved, no need to approve it again.
|
I am happy to send a follow-up PR to try more stuff to claw back the perf Thanks for all the reviews ❤️ |
☀️ Test successful - checks-actions |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing fd2eb39 (parent) -> 014bd82 (this PR) Test differencesShow 292 test diffsStage 1
Stage 2
(and 140 additional test diffs) Additionally, 52 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 014bd8290f084c714995205a9116e6c035419ae6 --output-dir test-dashboard And then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
Finished benchmarking commit (014bd82): comparison URL. Overall result: ❌ regressions - please read the text belowOur benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -1.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.3%, secondary 0.6%)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: 467.109s -> 462.752s (-0.93%) |
The perf regressions were deemed to be acceptable for the time being, to avoid delaying this feature. Interestingly this was a solid win on bootstrap time, maybe because of some refactoring/restructuring of code? @rustbot label: +perf-regression-triaged |
It’s just that bootstrap times are more unstable on the new benchmark machine. |
Really? I haven't seen that large swings recently. Usually it's ~2.5s at most (https://perf.rust-lang.org/bootstrap.html), so 4.5s seemed like it could be an actual change to me. But it could also be noise ofc, as you say, doesn't really matter. |
Hmm, unattended upgrades or anything similar doesn't seem to be it, per logs. I wonder if it might have been datadog, that seems like the only thing that consumes a bunch of CPU there. |
This PR allows marking impls of stable trait with stable type as unstable.
Approach
In std/core, an impl can be marked as unstable by annotating it with
#[unstable_feature_bound(feat_name)]
. This will add aClauseKind::Unstable_Feature(feat_name)
to the list of predicates inpredicates_of
.When an unstable impl's function is called, we will first iterate through all the goals in
param_env
to check if there is anyClauseKind::UnstableFeature(feat_name)
inparam_env
.The existence of
ClauseKind::Unstable_Feature(feat_name)
inparam_env
means an#[unstable_feature_bound(feat_name)]
is present at the call site of the function, so we allow the check to succeed in this case.If
ClauseKind::UnstableFeature(feat_name)
does not exist inparam_env
, we will still allow the check to succeed for either of the cases below:#[feature(feat_name)]
outside of std / core.For the rest of the case, it will fail with ambiguity.
Limitation
In this PR, we do not support:
#[unstable_feature_bound]
within stable APIs#[unstable_feature_bound]
#[unstable_feature_bound]
on items other than free function and implAcknowledgement
The design and mentoring are done by @BoxyUwU