-
Notifications
You must be signed in to change notification settings - Fork 476
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
expression can borrow static items
#1610
base: master
Are you sure you want to change the base?
const
expression can borrow static items
#1610
Conversation
const
expression can borrow static items
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also update https://github.com/rust-lang/reference/blob/master/src/items/static-items.md which mentions this isn't possible?
I'm wondering if this might be confusion (and perhaps my understanding is missing) with regards to what counts as a borrow. IIUC, statics have an implied &
, is that correct? For example, if you see const C: i32 = SOME_STATIC;
, there's no obvious borrow there.
05763ec
to
3d0233b
Compare
3d0233b
to
75faa87
Compare
@ehuss I updated the wording to include simply "use of statics". I have updated |
We probably want to update the
Since it'd now make sense for that to also address the fact that constants may refer to statics with some limitations. |
Also in
...that seems to need to change also. |
More generally, it seems what we need to do here is to loosen the various places in the Reference that have these restrictions, and in loosening them, add the necessary caveats, e.g. with respect to |
Tracked by rust-lang/rust#119618
Blocked on rust-lang/rust#129759
Stabilization report: rust-lang/rust#128183
This PR updates the documentation to mention that now
static
items can be used for borrowing, explicitly or implicitly, which permits general use of them inconst
context.