Skip to content

Request textDocument/hover failed. #19607

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

Closed
keplerHaloxx opened this issue Apr 16, 2025 · 1 comment · Fixed by #19613
Closed

Request textDocument/hover failed. #19607

keplerHaloxx opened this issue Apr 16, 2025 · 1 comment · Fixed by #19613
Assignees
Labels
C-bug Category: bug

Comments

@keplerHaloxx
Copy link

rust-analyzer version: ust-analyzer version: 0.3.2379-standalone (8365cf8 2025-04-13)

rustc version: rustc 1.86.0 (05f9846f8 2025-03-31)

editor or extension: VSCode (rust-analyzer version 0.3.2379)


problem: When hovering over default_value_t, I receive an error message saying Request textDocument/hover failed. Here is the output of the error. errmsg.txt

dependencies:

[dependencies]
clap = {version="4.5.36", features = ["derive"]}
tokio = { version = "1", features = ["full"] }

code snippet to reproduce:

use clap::{Parser, ValueEnum};

/// Supported audio formats for yt-dlp
#[derive(Copy, Clone, Debug, ValueEnum)]
pub enum AudioFormat {
    Mp3,
    Wav,
    M4a,
    Flac,
    Aac,
    Ogg,
    Opus,
}

#[derive(Parser, Debug)]
#[command(
    name = "Playlist Downloader",
    about = "Easily download playlists from YouTube or Musi"
)]
pub struct Cli {
    /// Set the audio format (e.g., mp3, m4a, flac, wav)
    #[arg(long = "audio-format", value_enum, default_value_t = AudioFormat::Mp3, help = "Convert audio to the given format")]
    pub audio_format: AudioFormat,
}
@keplerHaloxx keplerHaloxx added the C-bug Category: bug label Apr 16, 2025
@ChayimFriedman2
Copy link
Contributor

Minimized:

struct AudioFormat;

trait ValueEnum {
    fn to_possible_value(&self);
}

impl ValueEnum for AudioFormat {
    fn to_possible_value<'a>(&'a self) {}
}

fn main() {
    ValueEnum::to_possible_value(&AudioFormat);
}

The explicit lifetime on the method confuses GenericSubstitution, it puts it instead of the Self parameter.

A simple fix will be to only put type and const arguments in GenericSubstitution, at least until we implement lifetimes properly.

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
2 participants