Skip to content

Error when trying to suggest members of object #15403

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
ViktorVoloshko opened this issue Aug 5, 2023 · 4 comments · Fixed by #15415
Closed

Error when trying to suggest members of object #15403

ViktorVoloshko opened this issue Aug 5, 2023 · 4 comments · Fixed by #15415
Assignees
Labels
A-macro macro expansion C-bug Category: bug I-panic

Comments

@ViktorVoloshko
Copy link

ViktorVoloshko commented Aug 5, 2023

rust-analyzer version: rust-analyzer version: 0.3.1607-standalone (429a381 2023-07-30)

rustc version: rustc 1.71.1 (eb26296b5 2023-08-03)

relevant settings: default Windows rustup installation, VSCode 1.81.0

While playing around with toml crate (Rust newbie, just trying things) got few errors when my cursor after the dot in following code:

use std::{io::Read, fs::File};
use toml::Table;

fn main() {
    let mut buf = String::new();
    File::open("test.toml").unwrap().read_to_string(&mut buf).unwrap();
    let country = buf.parse::<Table>().unwrap();
    for line in country {
        println!("{}", line.1**.**);
    }
}

Cargo.toml

[package]
name = "toml_test"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
toml = "0.7.6"

rust-analyzer log (last strings because of limit):

Panic context:
> 
version: 0.3.1607-standalone (429a3816a 2023-07-30)
request: textDocument/codeAction CodeActionParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/c%3A/Users/ViktorVoloshko/projects/toml_test/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 0,
            character: 0,
        },
        end: Position {
            line: 0,
            character: 0,
        },
    },
    context: CodeActionContext {
        diagnostics: [],
        only: None,
        trigger_kind: Some(
            Automatic,
        ),
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

thread 'Worker' panicked at 'Fail to convert given literal Literal {
    text: "",
    span: 7,
}', crates\mbe\src\to_parser_input.rs:45:48
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:593
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:67
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::runtime::Runtime::execute_query_implementation
   6: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: hir_expand::eager::expand_eager_macro_input
  11: hir_def::macro_call_as_call_id_
  12: <hir_expand::InFile<&syntax::ast::generated::nodes::MacroCall> as hir_def::AsMacroCall>::as_call_id_with_errors
  13: hir_def::expander::Expander::enter_expand
  14: hir_def::body::lower::ExprCollector::maybe_collect_expr
  15: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  16: <alloc::boxed::Box<[I]> as core::iter::traits::collect::FromIterator<I>>::from_iter
  17: hir_def::body::lower::ExprCollector::maybe_collect_expr
  18: hir_def::body::lower::ExprCollector::collect_stmt
  19: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  20: hir_def::body::lower::ExprCollector::collect_stmt
  21: hir_def::body::lower::ExprCollector::maybe_collect_expr
  22: hir_def::body::lower::ExprCollector::maybe_collect_expr
  23: hir_def::body::lower::ExprCollector::collect_stmt
  24: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  25: hir_def::body::lower::ExprCollector::collect_stmt
  26: hir_def::body::lower::ExprCollector::maybe_collect_expr
  27: hir_def::body::lower::ExprCollector::collect_pat
  28: hir_def::body::lower::ExprCollector::maybe_collect_expr
  29: hir_def::body::lower::ExprCollector::collect_stmt
  30: hir_def::body::lower::ExprCollector::maybe_collect_expr
  31: hir_def::body::lower::lower
  32: hir_def::body::Body::body_with_source_map_query
  33: salsa::runtime::Runtime::execute_query_implementation
  34: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_def::db::UnionDataWithDiagnosticsQuery>>
  35: salsa::derived::slot::Slot<Q,MP>::read
  36: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  37: <DB as hir_def::db::DefDatabase>::body_with_source_map
  38: hir::DefWithBody::diagnostics
  39: hir::ModuleDef::diagnostics
  40: hir::Module::diagnostics
  41: ide_diagnostics::diagnostics
  42: std::panicking::try
  43: rust_analyzer::handlers::request::handle_code_action
  44: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
> 
version: 0.3.1607-standalone (429a3816a 2023-07-30)
request: textDocument/inlayHint InlayHintParams {
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/c%3A/Users/ViktorVoloshko/projects/toml_test/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 0,
            character: 0,
        },
        end: Position {
            line: 10,
            character: 1,
        },
    },
}

thread 'Worker' panicked at 'Fail to convert given literal Literal {
    text: "",
    span: 7,
}', crates\mbe\src\to_parser_input.rs:45:48
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:593
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:67
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::runtime::Runtime::execute_query_implementation
   6: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: hir_expand::eager::expand_eager_macro_input
  11: hir_def::macro_call_as_call_id_
  12: <hir_expand::InFile<&syntax::ast::generated::nodes::MacroCall> as hir_def::AsMacroCall>::as_call_id_with_errors
  13: hir_def::expander::Expander::enter_expand
  14: hir_def::body::lower::ExprCollector::maybe_collect_expr
  15: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  16: <alloc::boxed::Box<[I]> as core::iter::traits::collect::FromIterator<I>>::from_iter
  17: hir_def::body::lower::ExprCollector::maybe_collect_expr
  18: hir_def::body::lower::ExprCollector::collect_stmt
  19: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  20: hir_def::body::lower::ExprCollector::collect_stmt
  21: hir_def::body::lower::ExprCollector::maybe_collect_expr
  22: hir_def::body::lower::ExprCollector::maybe_collect_expr
  23: hir_def::body::lower::ExprCollector::collect_stmt
  24: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  25: hir_def::body::lower::ExprCollector::collect_stmt
  26: hir_def::body::lower::ExprCollector::maybe_collect_expr
  27: hir_def::body::lower::ExprCollector::collect_pat
  28: hir_def::body::lower::ExprCollector::maybe_collect_expr
  29: hir_def::body::lower::ExprCollector::collect_stmt
  30: hir_def::body::lower::ExprCollector::maybe_collect_expr
  31: hir_def::body::lower::lower
  32: hir_def::body::Body::body_with_source_map_query
  33: salsa::runtime::Runtime::execute_query_implementation
  34: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_def::db::UnionDataWithDiagnosticsQuery>>
  35: salsa::derived::slot::Slot<Q,MP>::read
  36: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  37: <DB as hir_def::db::DefDatabase>::body_with_source_map
  38: hir::source_analyzer::SourceAnalyzer::new_for_body_no_infer
  39: hir::semantics::SemanticsImpl::analyze_impl
  40: hir::semantics::SemanticsImpl::descend_into_macros_impl
  41: hir::semantics::SemanticsImpl::descend_node_into_attributes
  42: ide::inlay_hints::chaining::hints
  43: ide::inlay_hints::hints
  44: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  45: ide::inlay_hints::inlay_hints
  46: std::panicking::try
  47: rust_analyzer::handlers::request::handle_inlay_hints
  48: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 11:28:00 PM] Request textDocument/inlayHint failed.
  Message: request handler panicked: Fail to convert given literal Literal {
    text: "",
    span: 7,
}
  Code: -32603 
Panic context:
> 
version: 0.3.1607-standalone (429a3816a 2023-07-30)
request: textDocument/codeAction CodeActionParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/c%3A/Users/ViktorVoloshko/projects/toml_test/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 10,
            character: 1,
        },
        end: Position {
            line: 10,
            character: 1,
        },
    },
    context: CodeActionContext {
        diagnostics: [],
        only: None,
        trigger_kind: Some(
            Automatic,
        ),
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

thread 'Worker' panicked at 'Fail to convert given literal Literal {
    text: "",
    span: 7,
}', crates\mbe\src\to_parser_input.rs:45:48
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:593
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:67
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::runtime::Runtime::execute_query_implementation
   6: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: hir_expand::eager::expand_eager_macro_input
  11: hir_def::macro_call_as_call_id_
  12: <hir_expand::InFile<&syntax::ast::generated::nodes::MacroCall> as hir_def::AsMacroCall>::as_call_id_with_errors
  13: hir_def::expander::Expander::enter_expand
  14: hir_def::body::lower::ExprCollector::maybe_collect_expr
  15: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  16: <alloc::boxed::Box<[I]> as core::iter::traits::collect::FromIterator<I>>::from_iter
  17: hir_def::body::lower::ExprCollector::maybe_collect_expr
  18: hir_def::body::lower::ExprCollector::collect_stmt
  19: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  20: hir_def::body::lower::ExprCollector::collect_stmt
  21: hir_def::body::lower::ExprCollector::maybe_collect_expr
  22: hir_def::body::lower::ExprCollector::maybe_collect_expr
  23: hir_def::body::lower::ExprCollector::collect_stmt
  24: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  25: hir_def::body::lower::ExprCollector::collect_stmt
  26: hir_def::body::lower::ExprCollector::maybe_collect_expr
  27: hir_def::body::lower::ExprCollector::collect_pat
  28: hir_def::body::lower::ExprCollector::maybe_collect_expr
  29: hir_def::body::lower::ExprCollector::collect_stmt
  30: hir_def::body::lower::ExprCollector::maybe_collect_expr
  31: hir_def::body::lower::lower
  32: hir_def::body::Body::body_with_source_map_query
  33: salsa::runtime::Runtime::execute_query_implementation
  34: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_def::db::UnionDataWithDiagnosticsQuery>>
  35: salsa::derived::slot::Slot<Q,MP>::read
  36: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  37: <DB as hir_def::db::DefDatabase>::body_with_source_map
  38: hir::DefWithBody::diagnostics
  39: hir::ModuleDef::diagnostics
  40: hir::Module::diagnostics
  41: ide_diagnostics::diagnostics
  42: std::panicking::try
  43: rust_analyzer::handlers::request::handle_code_action
  44: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
> 
version: 0.3.1607-standalone (429a3816a 2023-07-30)
request: textDocument/semanticTokens/full/delta SemanticTokensDeltaParams {
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/c%3A/Users/ViktorVoloshko/projects/toml_test/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    previous_result_id: "2",
}

thread 'Worker' panicked at 'Fail to convert given literal Literal {
    text: "",
    span: 7,
}', crates\mbe\src\to_parser_input.rs:45:48
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:593
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:67
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::runtime::Runtime::execute_query_implementation
   6: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: hir_expand::eager::expand_eager_macro_input
  11: hir_def::macro_call_as_call_id_
  12: <hir_expand::InFile<&syntax::ast::generated::nodes::MacroCall> as hir_def::AsMacroCall>::as_call_id_with_errors
  13: hir_def::expander::Expander::enter_expand
  14: hir_def::body::lower::ExprCollector::maybe_collect_expr
  15: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  16: <alloc::boxed::Box<[I]> as core::iter::traits::collect::FromIterator<I>>::from_iter
  17: hir_def::body::lower::ExprCollector::maybe_collect_expr
  18: hir_def::body::lower::ExprCollector::collect_stmt
  19: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  20: hir_def::body::lower::ExprCollector::collect_stmt
  21: hir_def::body::lower::ExprCollector::maybe_collect_expr
  22: hir_def::body::lower::ExprCollector::maybe_collect_expr
  23: hir_def::body::lower::ExprCollector::collect_stmt
  24: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  25: hir_def::body::lower::ExprCollector::collect_stmt
  26: hir_def::body::lower::ExprCollector::maybe_collect_expr
  27: hir_def::body::lower::ExprCollector::collect_pat
  28: hir_def::body::lower::ExprCollector::maybe_collect_expr
  29: hir_def::body::lower::ExprCollector::collect_stmt
  30: hir_def::body::lower::ExprCollector::maybe_collect_expr
  31: hir_def::body::lower::lower
  32: hir_def::body::Body::body_with_source_map_query
  33: salsa::runtime::Runtime::execute_query_implementation
  34: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_def::db::UnionDataWithDiagnosticsQuery>>
  35: salsa::derived::slot::Slot<Q,MP>::read
  36: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  37: <DB as hir_def::db::DefDatabase>::body_with_source_map
  38: hir::source_analyzer::SourceAnalyzer::new_for_body
  39: hir::semantics::SemanticsImpl::analyze_impl
  40: ide_db::defs::NameClass::classify
  41: ide::syntax_highlighting::highlight::name_like
  42: ide::syntax_highlighting::highlight
  43: ide::syntax_highlighting::highlight
  44: std::panicking::try
  45: rust_analyzer::handlers::request::handle_semantic_tokens_full_delta
  46: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 11:28:00 PM] Request textDocument/semanticTokens/full/delta failed.
  Message: request handler panicked: Fail to convert given literal Literal {
    text: "",
    span: 7,
}
  Code: -32603 
Panic context:
> 
version: 0.3.1607-standalone (429a3816a 2023-07-30)
request: textDocument/hover HoverParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/c%3A/Users/ViktorVoloshko/projects/toml_test/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    position: Position(
        Position {
            line: 8,
            character: 29,
        },
    ),
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
}

thread 'Worker' panicked at 'Fail to convert given literal Literal {
    text: "",
    span: 7,
}', crates\mbe\src\to_parser_input.rs:45:48
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:593
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:67
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::runtime::Runtime::execute_query_implementation
   6: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: hir_expand::eager::expand_eager_macro_input
  11: hir_def::macro_call_as_call_id_
  12: <hir_expand::InFile<&syntax::ast::generated::nodes::MacroCall> as hir_def::AsMacroCall>::as_call_id_with_errors
  13: hir_def::expander::Expander::enter_expand
  14: hir_def::body::lower::ExprCollector::maybe_collect_expr
  15: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  16: <alloc::boxed::Box<[I]> as core::iter::traits::collect::FromIterator<I>>::from_iter
  17: hir_def::body::lower::ExprCollector::maybe_collect_expr
  18: hir_def::body::lower::ExprCollector::collect_stmt
  19: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  20: hir_def::body::lower::ExprCollector::collect_stmt
  21: hir_def::body::lower::ExprCollector::maybe_collect_expr
  22: hir_def::body::lower::ExprCollector::maybe_collect_expr
  23: hir_def::body::lower::ExprCollector::collect_stmt
  24: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  25: hir_def::body::lower::ExprCollector::collect_stmt
  26: hir_def::body::lower::ExprCollector::maybe_collect_expr
  27: hir_def::body::lower::ExprCollector::collect_pat
  28: hir_def::body::lower::ExprCollector::maybe_collect_expr
  29: hir_def::body::lower::ExprCollector::collect_stmt
  30: hir_def::body::lower::ExprCollector::maybe_collect_expr
  31: hir_def::body::lower::lower
  32: hir_def::body::Body::body_with_source_map_query
  33: salsa::runtime::Runtime::execute_query_implementation
  34: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_def::db::UnionDataWithDiagnosticsQuery>>
  35: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
  36: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
  37: hir_def::db::DefDatabaseGroupStorage__::maybe_changed_since
  38: <ide_db::RootDatabase as salsa::plumbing::DatabaseOps>::maybe_changed_since
  39: salsa::derived::slot::MemoRevisions::validate_memoized_value
  40: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_def::db::UnionDataWithDiagnosticsQuery>>
  41: salsa::derived::slot::Slot<Q,MP>::read
  42: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  43: <DB as hir_def::db::DefDatabase>::body
  44: <hir_def::DefWithBodyId as hir_def::child_by_source::ChildBySource>::child_by_source_to
  45: hir::semantics::source_to_def::SourceToDefCtx::cache_for
  46: hir::semantics::source_to_def::SourceToDefCtx::item_to_macro_call
  47: hir::semantics::SemanticsImpl::is_attr_macro_call
  48: ide::hover::hover
  49: std::panicking::try
  50: rust_analyzer::handlers::request::handle_hover
  51: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 11:28:00 PM] Request textDocument/hover failed.
  Message: request handler panicked: Fail to convert given literal Literal {
    text: "",
    span: 7,
}
  Code: -32603 
Panic context:
> 
version: 0.3.1607-standalone (429a3816a 2023-07-30)
request: textDocument/codeAction CodeActionParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/c%3A/Users/ViktorVoloshko/projects/toml_test/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 8,
            character: 30,
        },
        end: Position {
            line: 8,
            character: 30,
        },
    },
    context: CodeActionContext {
        diagnostics: [],
        only: None,
        trigger_kind: Some(
            Automatic,
        ),
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

thread 'Worker' panicked at 'Fail to convert given literal Literal {
    text: "",
    span: 7,
}', crates\mbe\src\to_parser_input.rs:45:48
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:593
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:67
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::runtime::Runtime::execute_query_implementation
   6: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: hir_expand::eager::expand_eager_macro_input
  11: hir_def::macro_call_as_call_id_
  12: <hir_expand::InFile<&syntax::ast::generated::nodes::MacroCall> as hir_def::AsMacroCall>::as_call_id_with_errors
  13: hir_def::expander::Expander::enter_expand
  14: hir_def::body::lower::ExprCollector::maybe_collect_expr
  15: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  16: <alloc::boxed::Box<[I]> as core::iter::traits::collect::FromIterator<I>>::from_iter
  17: hir_def::body::lower::ExprCollector::maybe_collect_expr
  18: hir_def::body::lower::ExprCollector::collect_stmt
  19: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  20: hir_def::body::lower::ExprCollector::collect_stmt
  21: hir_def::body::lower::ExprCollector::maybe_collect_expr
  22: hir_def::body::lower::ExprCollector::maybe_collect_expr
  23: hir_def::body::lower::ExprCollector::collect_stmt
  24: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  25: hir_def::body::lower::ExprCollector::collect_stmt
  26: hir_def::body::lower::ExprCollector::maybe_collect_expr
  27: hir_def::body::lower::ExprCollector::collect_pat
  28: hir_def::body::lower::ExprCollector::maybe_collect_expr
  29: hir_def::body::lower::ExprCollector::collect_stmt
  30: hir_def::body::lower::ExprCollector::maybe_collect_expr
  31: hir_def::body::lower::lower
  32: hir_def::body::Body::body_with_source_map_query
  33: salsa::runtime::Runtime::execute_query_implementation
  34: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_def::db::UnionDataWithDiagnosticsQuery>>
  35: salsa::derived::slot::Slot<Q,MP>::read
  36: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  37: <DB as hir_def::db::DefDatabase>::body_with_source_map
  38: hir::DefWithBody::diagnostics
  39: hir::ModuleDef::diagnostics
  40: hir::Module::diagnostics
  41: ide_diagnostics::diagnostics
  42: std::panicking::try
  43: rust_analyzer::handlers::request::handle_code_action
  44: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
> 
version: 0.3.1607-standalone (429a3816a 2023-07-30)
request: textDocument/inlayHint InlayHintParams {
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/c%3A/Users/ViktorVoloshko/projects/toml_test/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 0,
            character: 0,
        },
        end: Position {
            line: 10,
            character: 1,
        },
    },
}

thread 'Worker' panicked at 'Fail to convert given literal Literal {
    text: "",
    span: 7,
}', crates\mbe\src\to_parser_input.rs:45:48
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:593
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:67
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::runtime::Runtime::execute_query_implementation
   6: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: hir_expand::eager::expand_eager_macro_input
  11: hir_def::macro_call_as_call_id_
  12: <hir_expand::InFile<&syntax::ast::generated::nodes::MacroCall> as hir_def::AsMacroCall>::as_call_id_with_errors
  13: hir_def::expander::Expander::enter_expand
  14: hir_def::body::lower::ExprCollector::maybe_collect_expr
  15: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  16: <alloc::boxed::Box<[I]> as core::iter::traits::collect::FromIterator<I>>::from_iter
  17: hir_def::body::lower::ExprCollector::maybe_collect_expr
  18: hir_def::body::lower::ExprCollector::collect_stmt
  19: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  20: hir_def::body::lower::ExprCollector::collect_stmt
  21: hir_def::body::lower::ExprCollector::maybe_collect_expr
  22: hir_def::body::lower::ExprCollector::maybe_collect_expr
  23: hir_def::body::lower::ExprCollector::collect_stmt
  24: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  25: hir_def::body::lower::ExprCollector::collect_stmt
  26: hir_def::body::lower::ExprCollector::maybe_collect_expr
  27: hir_def::body::lower::ExprCollector::collect_pat
  28: hir_def::body::lower::ExprCollector::maybe_collect_expr
  29: hir_def::body::lower::ExprCollector::collect_stmt
  30: hir_def::body::lower::ExprCollector::maybe_collect_expr
  31: hir_def::body::lower::lower
  32: hir_def::body::Body::body_with_source_map_query
  33: salsa::runtime::Runtime::execute_query_implementation
  34: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_def::db::UnionDataWithDiagnosticsQuery>>
  35: salsa::derived::slot::Slot<Q,MP>::read
  36: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  37: <DB as hir_def::db::DefDatabase>::body_with_source_map
  38: hir::source_analyzer::SourceAnalyzer::new_for_body_no_infer
  39: hir::semantics::SemanticsImpl::analyze_impl
  40: hir::semantics::SemanticsImpl::descend_into_macros_impl
  41: hir::semantics::SemanticsImpl::descend_node_into_attributes
  42: ide::inlay_hints::chaining::hints
  43: ide::inlay_hints::hints
  44: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  45: ide::inlay_hints::inlay_hints
  46: std::panicking::try
  47: rust_analyzer::handlers::request::handle_inlay_hints
  48: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 11:28:02 PM] Request textDocument/inlayHint failed.
  Message: request handler panicked: Fail to convert given literal Literal {
    text: "",
    span: 7,
}
  Code: -32603 

Thanks for helping in advance!

@ViktorVoloshko ViktorVoloshko added the C-bug Category: bug label Aug 5, 2023
@Veykril Veykril self-assigned this Aug 5, 2023
@Veykril Veykril added A-macro macro expansion I-panic labels Aug 5, 2023
@lnicola
Copy link
Member

lnicola commented Aug 6, 2023

Minimized:

fn main() {
    let line = (10, 20);
    println!("{}", line.1.);
}

@ViktorVoloshko
Copy link
Author

Minimized:

fn main() {
    let line = (10, 20);
    println!("{}", line.1.);
}

So, this is bug with tuples in general? Got it.

@lnicola
Copy link
Member

lnicola commented Aug 6, 2023

More like with format! and friends, but yes.

@felipelalli
Copy link

I'm having the same issue!

rust-analyzer: v0.4.1853 (pre-release)
VS Code: 1.86.2

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

Successfully merging a pull request may close this issue.

4 participants