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
/// 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".

// and we know that `&'a T::Out` is WF, then we want to imply `U: 'a`.
let normalized_ty = ocx
.deeply_normalize(&ObligationCause::dummy_with_span(span), param_env, ty)
.map_err(|_| NoSolution)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

did you test removing the normalized_ty here and does that break anything?

Comment on lines +297 to +307
let old_value = self.pending_activations.insert(temp, idx);
if let Some(old_index) = old_value {
span_bug!(
self.body.source_info(location).span,
"found already pending activation for temp: {:?} \
at idx: {:?} with associated data {:?}",
temp,
old_index,
self.location_map[old_index.as_usize()]
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let old_value = self.pending_activations.insert(temp, idx);
if let Some(old_index) = old_value {
span_bug!(
self.body.source_info(location).span,
"found already pending activation for temp: {:?} \
at idx: {:?} with associated data {:?}",
temp,
old_index,
self.location_map[old_index.as_usize()]
);
}
let prev = self.pending_activations.insert(temp, idx);
assert_eq!(prev, None);

I feel like this if let is too much code for an assert and it was actually slightly confusing to me

@lcnr
Copy link
Contributor

lcnr commented Jan 6, 2026

nits, then r=me

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