Resolver: add checked methods for Cm(Ref)Cell - #160345
Conversation
|
Ah, one extra thing. The // self is &mut Resolver
for _ in &self.iterable_field {
self.resolution().borrow(self.cm_token());
}because the iterator is shared on the resolver field, doing |
|
@bors delegate try |
|
✌️ @LorrensP-2158466, you can now perform try builds on this pull request! You can now post |
|
@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.
|
@rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (358e11b): 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 rustc-perf 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 -0.6%, secondary -2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 0.1%, secondary 2.4%)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: 490.553s -> 490.99s (0.09%) |
|
It's only |
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.
This comment has been minimized.
This comment has been minimized.
|
I wouldn't want to introduce a lot of unsafe code an copypaste of I'll review after the second benchmark run finishes and the manual ref counting commit is removed. |
|
Reminder, once the PR becomes ready for a review, use |
Understandable, I was mostly curious :). |
|
If we have methods taking a token, then panicking methods not taking a token are not necessary anymore (*). impl Resolver {
fn token1(&mut self) -> CmToken { debug_assert!(!self.assert_speculative); CmToken { ... } }
fn token2(&self) -> CmToken { assert!(!self.assert_speculative); CmToken { ... } }
}(*) Unless there are borrow checker issues like #160345 (comment), then we can have more unsafe methods taking a boolean or something. |
|
Finished benchmarking commit (5ea1493): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary 0.8%, secondary 0.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 0.3%, secondary 0.1%)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: 490.553s -> 489.78s (-0.16%) |
hmm, lets see, that would be nicer as well.
I don't think it would be more "problematic" as it is now. |
7f2cb4f to
9c15c08
Compare
|
I actually don't like this way of obtaining a token, I find it rather confusing. I thought of it as a way to circumvent the Also, this is not applicable to @rustbot ready. |
9c15c08 to
65839dd
Compare
I think this can be addressed by making obtaining a token from |
Yeah, agreed, something like |
This comment has been minimized.
This comment has been minimized.
…*_checked` requiring a `&Resolver` to check the speculative flag. The normal ones require a `&mut Resolver` thus not needing to check the speculative flag. Mostly to minimize per "penalty" of always checking it, even if we definitely know that we are not in speculative resolution (due to `&mut Resolver`).
65839dd to
ca89136
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. |
checked methods for Cm(Ref)Cell
|
@rustbot ready |
View all comments
part of #158845
Introduces extra functions for the mutating functions of
Cm(Ref)Cellwith acheckedsuffix that are the same logic as current ones. It allows for the functions without the suffix to ignore the check on the speculative flag by requiring a&mut Resolver, which is only possible if we are definitely not in speculative resolution.r? @petrochenkov