Skip to content
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

const_eval: update for const_mut_refs and const_refs_to_cell stabilization #1590

Merged
merged 2 commits into from
Sep 15, 2024

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Aug 27, 2024

This is the reference PR accompanying rust-lang/rust#129195.

Fixes rust-lang/rust#57349
Fixes rust-lang/rust#80384

* All forms of [borrow]s, including raw borrows, with one limitation:
mutable borrows and shared borrows to values with interior mutability
are only allowed to refer to *transient* places. A place is *transient*
if it will be deallocated before the end of evaluating the current constant item.
Copy link
Contributor

@traviscross traviscross Aug 27, 2024

Choose a reason for hiding this comment

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

Given that not all const contexts are syntactically items, though they are desugared that way, would it be better here to say "end of evaluating the current constant context"?

Copy link
Member Author

Choose a reason for hiding this comment

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

If "evaluating a const context" is meaningful, then yeah that would work. It sounds a bit odd to me, how can you evaluate a "context"? The context is what the evaluation occurs in.

No strong preference either way.

Copy link
Contributor

@traviscross traviscross Aug 27, 2024

Choose a reason for hiding this comment

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

Maybe "evaluating the contents of the current const context"? Open to other ideas.

The main thrust is that const context is something we define and seems to be closer to what we mean here.

Copy link
Member Author

Choose a reason for hiding this comment

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

"evaluating the item" is how we call it in the compiler so I got used to that one. ;)

@ehuss ehuss added the S-waiting-on-stabilization Waiting for a stabilization PR to be merged in the main Rust repository label Aug 27, 2024
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks!

@ehuss ehuss added this pull request to the merge queue Sep 15, 2024
Merged via the queue into rust-lang:master with commit 8da7b2a Sep 15, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-stabilization Waiting for a stabilization PR to be merged in the main Rust repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking Issue for const_refs_to_cell Tracking issue for &mut T in const contexts (const_mut_refs)
3 participants