Skip to content

Request hover support for constants defined with const fn #18685

@xpe

Description

@xpe

I would like to ask for textDocument/hover support for constants defined with const fn. In my example below, you can see that an add function works, but not usize.ilog2().

Works as expected

pub const fn add(a: u32, b: u32) -> u32 { a + b }
pub const ADD_EXAMPLE: u32 = add(2, 3);

Hovering over ADD_EXAMPLE shows 5 as expected...

Image

Feature request

pub const fn ilog2(n: u32) -> u32 { n.ilog2() }
pub const ILOG2_EXAMPLE: u32 = ilog2(16);

But hovering over ILOG2_EXAMPLE currently shows: ilog2(16) instead of 4...

Image

Background

I have an application where I define constants based on usize.ilog2() and I like to sanity check the results in my editor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions