rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.25k stars 1.61k forks source link

Failed to hover textDocument. #14002

Closed Jerrody closed 1 year ago

Jerrody commented 1 year ago

Failed to parse when I hover on the struct name (Mixture) or names of fields (doesn't matter what place of code, definition or usage of these fields) :

#[derive(Debug, Default)]
pub struct Mixture {
    oxygen: Vec<f32>,
    carbon_dioxide: Vec<f32>,
    nitrogen: Vec<f32>,
    toxins: Vec<f32>,
    sleeping_agent: Vec<f32>,
    agent_b: Vec<f32>,
    volume: Vec<f32>,
    temperature: Vec<f32>, //in Kelvin
    last_share: Vec<f32>,
    oxygen_archived: Vec<f32>,
    carbon_dioxide_archived: Vec<f32>,
    nitrogen_archived: Vec<f32>,
    toxins_archived: Vec<f32>,
    sleeping_agent_archived: Vec<f32>,
    agent_b_archived: Vec<f32>,
    temperature_archived: Vec<f32>,
    fuel_burnt: Vec<f32>,
    is_initialized: Vec<bool>,
}

Error output

Panic context:
> 
version: 0.3.1369-standalone (ff4d55e48 2023-01-15)
request: textDocument/hover HoverParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/d%3A/Paradise/paradise_atmos_rs/src/gas_mixture.rs",
            query: None,
            fragment: None,
        },
    },
    position: Position(
        Position {
            line: 25,
            character: 16,
        },
    ),
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
}

thread 'Worker' panicked at 'nonscalar layout for layout_scalar_valid_range type: Layout {
    size: Size(8 bytes),
    align: AbiAndPrefAlign {
        abi: Align(8 bytes),
        pref: Align(8 bytes),
    },
    abi: Aggregate {
        sized: true,
    },
    fields: Arbitrary {
        offsets: [
            Size(0 bytes),
        ],
        memory_index: [
            0,
        ],
    },
    largest_niche: None,
    variants: Single {
        index: RustcEnumVariantIdx(
            Idx::<EnumVariantData>(0),
        ),
    },
}', C:\Users\runneradmin\.cargo\registry\src\github.com-1ecc6299db9ec823\hkalbasi-rustc-ap-rustc_abi-0.0.20221221\src\layout.rs:422:22
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library\std\src\panicking.rs:575
   1: core::panicking::panic_fmt
             at /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library\core\src\panicking.rs:65
   2: hir_ty::layout::adt::layout_of_adt_query
   3: salsa::runtime::Runtime::execute_query_implementation
   4: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_ty::db::ProgramClausesForChalkEnvQuery>>
   5: salsa::derived::slot::Slot<Q,MP>::read
   6: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   7: salsa::QueryTable<Q>::get
   8: <DB as hir_ty::db::HirDatabase>::layout_of_adt
   9: hir_ty::layout::layout_of_ty
  10: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
  11: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  12: core::iter::adapters::try_process
  13: hir_ty::layout::adt::layout_of_adt_query
  14: salsa::runtime::Runtime::execute_query_implementation
  15: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_ty::db::ProgramClausesForChalkEnvQuery>>
  16: salsa::derived::slot::Slot<Q,MP>::read
  17: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  18: salsa::QueryTable<Q>::get
  19: <DB as hir_ty::db::HirDatabase>::layout_of_adt
  20: hir_ty::layout::layout_of_ty
  21: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
  22: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  23: core::iter::adapters::try_process
  24: hir_ty::layout::adt::layout_of_adt_query
  25: salsa::runtime::Runtime::execute_query_implementation
  26: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_ty::db::ProgramClausesForChalkEnvQuery>>
  27: salsa::derived::slot::Slot<Q,MP>::read
  28: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  29: salsa::QueryTable<Q>::get
  30: <DB as hir_ty::db::HirDatabase>::layout_of_adt
  31: hir_ty::layout::layout_of_ty
  32: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
  33: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  34: core::iter::adapters::try_process
  35: hir_ty::layout::adt::layout_of_adt_query
  36: salsa::runtime::Runtime::execute_query_implementation
  37: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_ty::db::ProgramClausesForChalkEnvQuery>>
  38: salsa::derived::slot::Slot<Q,MP>::read
  39: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  40: salsa::QueryTable<Q>::get
  41: <DB as hir_ty::db::HirDatabase>::layout_of_adt
  42: hir_ty::layout::layout_of_ty
  43: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
  44: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  45: core::iter::adapters::try_process
  46: hir_ty::layout::adt::layout_of_adt_query
  47: salsa::runtime::Runtime::execute_query_implementation
  48: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_ty::db::ProgramClausesForChalkEnvQuery>>
  49: salsa::derived::slot::Slot<Q,MP>::read
  50: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  51: salsa::QueryTable<Q>::get
  52: <DB as hir_ty::db::HirDatabase>::layout_of_adt
  53: ide::hover::render::path
  54: ide::hover::hover_for_definition
  55: ide::hover::hover
  56: std::panicking::try
  57: rust_analyzer::handlers::handle_hover
  58: std::panicking::try
  59: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 14:00:29] Request textDocument/hover failed.
  Message: request handler panicked: nonscalar layout for layout_scalar_valid_range type: Layout {
    size: Size(8 bytes),
    align: AbiAndPrefAlign {
        abi: Align(8 bytes),
        pref: Align(8 bytes),
    },
    abi: Aggregate {
        sized: true,
    },
    fields: Arbitrary {
        offsets: [
            Size(0 bytes),
        ],
        memory_index: [
            0,
        ],
    },
    largest_niche: None,
    variants: Single {
        index: RustcEnumVariantIdx(
            Idx::<EnumVariantData>(0),
        ),
    },
}
  Code: -32603 

Metadata

rustc version:

rustc 1.68.0-nightly (5ce39f42b 2023-01-20)
binary: rustc
commit-hash: 5ce39f42bd2c8bca9c570f0560ebe1fce4eddb14
commit-date: 2023-01-20
host: x86_64-pc-windows-msvc
release: 1.68.0-nightly
LLVM version: 15.0.6

RA VSCode version: 0.3.1369

jonas-schievink commented 1 year ago

Your r-a version is a bit out of date, this should have been fixed by https://github.com/rust-lang/rust-analyzer/pull/13966. Can you retry with a newer version?

Jerrody commented 1 year ago

Your r-a version is a bit out of date, this should have been fixed by #13966. Can you retry with a newer version?

Hm, interesting. Alright! I will check it later.

Veykril commented 1 year ago

Is this still happening for you?

Jerrody commented 1 year ago

Is this still happening for you?

No, it can be closed.