Skip to content

The reference is wrong about constants referencing statics since v1.83.0 #1690

Description

@HeCorr

Hello! I've noticed that the Rust 1.83.0 announcement mentions that it is now possible to reference static items in const contexts:

static S: i32 = 25;
const C: &i32 = &S;

But the Rust Reference still says it is not:

All access to a static is safe, but there are a number of restrictions on statics:

  • The type must have the Sync trait bound to allow thread-safe access.
  • Constants cannot refer to statics.

I am willing to write a PR for this but I am not sure what the best course of action is. Simply removing that bullet-point would mean having to rephrase the text above it, but I don't know what would sound best (also, a single bullet-point may look weird).

What should I do?

Activity

  1. chorman0773 commented on Dec 1, 2024

    @chorman0773
    Contributor

    #1610 already addresses it, but there are problems that are being fixed on it.

  2. HeCorr commented on Dec 1, 2024

    @HeCorr
    Author

    Oops, my bad. instead of searching for existing issues/PRs I merely checked the date of the most recent ones since the update announcement was published and found none. I should have looked further. I apologize.

    You may close this if you want.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions