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

hovering over constant containing function pointers shows internal constants #17200

Open
antonilol opened this issue May 8, 2024 · 1 comment
Labels
C-bug Category: bug

Comments

@antonilol
Copy link

rust-analyzer version: rust-analyzer version: 0.4.1943-standalone

rustc version: rustc 1.77.0 (aedd173a2 2024-03-17)

editor or extension: code oss, arch linux

relevant settings: None

code snippet to reproduce:

pub const FN: &[fn(usize, usize) -> usize] = &[or, xor];

pub fn or(a: usize, b: usize) -> usize {
    a | b
}

pub fn xor(a: usize, b: usize) -> usize {
    a ^ b
}

hovering over the FN constant shows

pub const FN: &[fn(usize, usize) -> usize] = &[0x3E8 as fn(usize, usize) -> usize, 0x3E9 as fn(usize, usize) -> usize]

which is not very useful (the internal constants and repeating the type)

@antonilol antonilol added the C-bug Category: bug label May 8, 2024
@roife
Copy link
Contributor

roife commented May 8, 2024

Might be related to

TyKind::Function(_) | TyKind::Raw(_, _) => {
let it = u128::from_le_bytes(pad16(b, false));
write!(f, "{:#X} as ", it)?;
ty.hir_fmt(f)
}

It seems like an address or something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants