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

Use more accurate span for addr_of! suggestion #127929

Merged
merged 1 commit into from
Jul 19, 2024
Merged

Commits on Jul 18, 2024

  1. Use more accurate span for addr_of! suggestion

    Use a multipart suggestion instead of a single whole-span replacement:
    
    ```
    error[E0796]: creating a shared reference to a mutable static
      --> $DIR/reference-to-mut-static-unsafe-fn.rs:10:18
       |
    LL |         let _y = &X;
       |                  ^^ shared reference to mutable static
       |
       = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
    help: use `addr_of!` instead to create a raw pointer
       |
    LL |         let _y = addr_of!(X);
       |                  ~~~~~~~~~ +
    ```
    estebank committed Jul 18, 2024
    Configuration menu
    Copy the full SHA
    abf92c0 View commit details
    Browse the repository at this point in the history