-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
C-bugCategory: bugCategory: bug
Description
rust-analyzer version: rust-analyzer-2025-08-04
rustc version: rustc 1.88.0 (6b00bc388 2025-06-23)
editor or extension: Zed Editor - default rust-analyzer lsp support
relevant settings: /
repository link (if public, optional): /
Note: Can not be reproduced in smaller playgrounds, only bigger projects...
The issue is that the r-a cannot "understand" the constant value when calculating the sizes. This in turns is quite a big issue when improving the sizes of structures in larger projects where memory is a tight resource. Since the inability to calculate the size propagates to parent structures as well.
code snippet to reproduce:
// in another module
pub const MATTER_MESSAGE_EXTENSION_BYTES: usize = 10;
#[derive(Debug, Eq, PartialEq, Clone)]
struct Header {
message_extensions: Option<[u8; MATTER_MESSAGE_EXTENSION_BYTES]>,
}
Output with the constant being used:

Output without the constant being used:

Metadata
Metadata
Assignees
Labels
C-bugCategory: bugCategory: bug