Skip to content

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

Closed
@HeCorr

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?

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