Skip to content

Conversation

@BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Dec 31, 2025

r? lcnr

@rustbot
Copy link
Collaborator

rustbot commented Dec 31, 2025

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 31, 2025
Comment on lines -265 to -268
let (idx, _) = self.location_map.insert_full(location, borrow);
let idx = BorrowIndex::from(idx);

self.insert_as_pending_if_two_phase(location, assigned_place, kind, idx);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this felt very confusing to read to me. we first insert the borrow with the wrong activation location (we assume its not two phase). and then insert_as_pending_if_two_phase does more than it says and actually fixes up the activation location to what it should have been from the start

I inlined this function as it only had one call site and deferred inserting into the location map until we actually choose a TwoPhaseActivation to use.

/// Returns whether borrows represented by this kind are allowed to be split into separate
/// Reservation and Activation phases.
pub fn allows_two_phase_borrow(&self) -> bool {
pub fn is_two_phase_borrow(&self) -> bool {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in some sense its always a two phase borrow, just sometimes its activated at the same point its created I think?

The previous name confused me because it made it sound like a reference may or may not be a two phase borrow and then we went on to unconditionally treat it as two phase without ever checking if it "actually is".

constraints.push(c)
}

// Currently `implied_outlives_bounds` will normalize the provided
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how useful a lot of my comments here actually are given afaik @tiif is rewriting the logic for computing implies bounds so this code might just all get yoten soon:tm:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think the core logic here won't change too much, so it will still be very useful :3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants