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

Building hover information for fn pointers from generic with impl args panics. #17811

Closed
nicolas-guichard opened this issue Aug 6, 2024 · 1 comment · Fixed by #17832
Closed
Assignees
Labels
C-bug Category: bug

Comments

@nicolas-guichard
Copy link
Contributor

nicolas-guichard commented Aug 6, 2024

While trying out #17809 on mozilla-central, I noticed a failure in the time crate when building the hover information for the format_number function pointer here.

I managed to write a failing test, see b93994b.

The issue is we end up in hir_ty::display::generic_args_sans_defaults with more binders than parameters. I'm not 100% sure how to fix this, I'm also surprised we don't hit this in more cases since generic_args_sans_defaults is called multiple times with different numbers of parameters at least here and here.

rust-analyzer version: current HEAD

rustc version: rustc 1.80.0 (051478957 2024-07-21)

editor or extension: Kate / SCIP generator

relevant settings:

repository link (if public, optional): initially found with in time, minimal test at b93994b

code snippet to reproduce:

fn bar<const WIDTH: u8>(_: impl Copy) {}
fn test() {
    let f = bar::<3>;
    f(4);
}

hovering over f panics.

@nicolas-guichard nicolas-guichard added the C-bug Category: bug label Aug 6, 2024
@ShoyuVanilla
Copy link
Member

@rustbot claim

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

Successfully merging a pull request may close this issue.

2 participants