rust-lang / rust-lang/rust-analyzer

Hovering over constant using slice shows incorrect value

Open
#20,868 4 comments 0 reactions 1 assignee View on GitHub

@crypto-priest is already working on this.

Since Oct 23, 2025.

A-mir C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: 0.3.2593-standalone (6b2e677795 2025-08-25)

rustc version: rustc 1.88.0 (6b00bc388 2025-06-23)

editor or extension: VSCode 1.105.0, rust-analyzer 0.3.2593

code snippet to reproduce:

const DATA: &[&[u64]] = &[&[42]];

// 0x1000000000000060
const A: u64 = {
    123u64 < 234; // comment out this or the next line, A will be 0
    345u64 < 456;
    let x = DATA[0][0]; // inline x, A will be 456
    x
};

Hover over A (expect 42):

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.