Skip to content

Conversation

RalfJung
Copy link
Member

This effectively reverts #97684 for CTFE.

Undoes the diagnostic changes that are tracked in #99923, only for beta.
(On master this patch wouldn't apply any more, enforce_number_no_provenance is gone with #99644 since the interpreter engine is not supposed to ever have provenance on integers.)

The test changes are an exact un-do of #97684. However there is still some risk here since this exact code is not what has been battle-tested.

r? @Mark-Simulacrum

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jul 30, 2022
@rustbot
Copy link
Collaborator

rustbot commented Jul 30, 2022

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

@rust-highfive
Copy link
Contributor

⚠️ Warning ⚠️

  • Pull requests are usually filed against the master branch for this repo, but this one is against beta. Please double check that you specified the right target!

@RalfJung
Copy link
Member Author

Or should someone from @rust-lang/wg-const-eval review this? @oli-obk is on vacation this week and next week it is too late to merge this...

@Mark-Simulacrum
Copy link
Member

I think it would be good to get some more compiler-y eyes on this, yes - not sure who a good candidate would be.

@RalfJung
Copy link
Member Author

@eddyb maybe? You looked at this code already anyway, judging from your comments in #99923.

@Mark-Simulacrum Mark-Simulacrum added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jul 30, 2022
@Mark-Simulacrum
Copy link
Member

beta-nominating, since this is ultimately a beta backport of sorts.

I'd also personally like to see a similar revert on master, so that we have ~12 weeks to discuss and not ~6 (since master branches into beta in ~6 days).

@RalfJung
Copy link
Member Author

I'd also personally like to see a similar revert on master,

That would be a much bigger endeavor, since enforce_number_no_provenance does not exist there any more -- and I don't think we want to bring it back, it goes against the design of the interpreter.

@Mark-Simulacrum
Copy link
Member

Ah, OK. In that case we should make sure that the discussion concludes before 1.64 releases, presuming this gets merged :)

Comment on lines 467 to +468
fn enforce_number_no_provenance(_ecx: &InterpCx<$mir, $tcx, Self>) -> bool {
true
false
Copy link
Member

Choose a reason for hiding this comment

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

Was this only read during "CTFE validation", before? Could self.ctfe_mode.is_some() calls be moved into here instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Was this only read during "CTFE validation", before?

Yes. #97684 made it also relevant for read_immediate.

Could self.ctfe_mode.is_some() calls be moved into here instead?

No; the self in validation is the validation visitor, and that has the ctfe_mode -- but that doesn't exist in read_immediate.

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 guess alternatively in this PR we could make enforce_number_no_provenance again only relevant for validation, and not for read_immediate. That would break Miri but we don't care about Miri on the beta branch.

Copy link
Member

@eddyb eddyb left a comment

Choose a reason for hiding this comment

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

LGTM, and normally I'd say "r=me" but I'm not sure what the beta policy here is.

@RalfJung
Copy link
Member Author

RalfJung commented Aug 3, 2022

So do we want to land this? We don't have that much time left...

@apiraino
Copy link
Contributor

apiraino commented Aug 4, 2022

Beta backport accepted as per compiler team on Zulip

@rustbot label +beta-accepted

@rustbot rustbot added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Aug 4, 2022
@RalfJung
Copy link
Member Author

RalfJung commented Aug 4, 2022

So can we ask bors to land this now? @Mark-Simulacrum I don't know the process for beta PRs.

@eddyb
Copy link
Member

eddyb commented Aug 4, 2022

@bors r+ (hopefully enough)

@bors
Copy link
Collaborator

bors commented Aug 4, 2022

📌 Commit 29ce4d5 has been approved by eddyb

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2022
@RalfJung
Copy link
Member Author

RalfJung commented Aug 4, 2022

@bors p=10

@bors
Copy link
Collaborator

bors commented Aug 4, 2022

⌛ Testing commit 29ce4d5 with merge 7410ebb...

@bors
Copy link
Collaborator

bors commented Aug 4, 2022

☀️ Test successful - checks-actions
Approved by: eddyb
Pushing 7410ebb to beta...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 4, 2022
@bors bors merged commit 7410ebb into rust-lang:beta Aug 4, 2022
@rustbot rustbot added this to the 1.63.0 milestone Aug 4, 2022
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Aug 5, 2022
@RalfJung RalfJung deleted the ctfe-number-prov branch September 2, 2022 11:14
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 9, 2022
…=pnkfelix

beta-backport of provenance-related CTFE changes

This is all part of dealing with rust-lang#99923.

The first commit backports the effects of rust-lang#101101. `@pnkfelix` asked for this and it turned out to be easy, so I think this is uncontroversial.

The second commit effectively repeats rust-lang#99965, which un-does the effects of rust-lang#97684 and therefore means rust-lang#99923 does not apply to the beta branch. I honestly don't think we should do this; the sentiment in rust-lang#99923 was that we should go ahead with the change but improve diagnostics. But `@pnkfelix` seemed to request such a change so I figured I would offer the option.

I'll be on vacation soon, so if you all decide to take the first commit only, then someone please just force-push to this branch and remove the 2nd commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

7 participants