Open StealthyKamereon opened 2 months ago
rust-analyzer version: rust-analyzer 1.80.0-nightly (d84b903 2024-05-19)
rustc version: rustc 1.80.0-nightly (d84b90375 2024-05-19)
editor or extension: NeoVim configured with lspconfig
relevant settings:
rust_analyzer = { cargo = { features = "all", }, rustc = { source = "discover" }, },
repository link (if public, optional): rustc_plugin example
steps to reproduce: Clone the example from https://github.com/cognitive-engineering-lab/rustc_plugin/ and change the crate:
git clone https://github.com/cognitive-engineering-lab/rustc_plugin/ cd example/print-all-items sed -i 's;rustc_plugin = { path = "../.." };rustc_plugin = "=0.10.0-nightly-2024-05-20"' Cargo.toml
Create a shell.nix with the following content:
{ nixpkgs ? import <nixpkgs> { }}: let rustOverlay = builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"; pinnedPkgs = nixpkgs.fetchFromGitHub { owner = "NixOS"; repo = "nixpkgs"; rev = "b3fcfcfabd01b947a1e4f36622bbffa3985bdac6"; sha256 = "0va68ddkrqb6j349rsbkjhdq7m243kg9njcqhnx9p2sbrcl2g5l8"; }; pkgs = import pinnedPkgs { overlays = [ (import rustOverlay) ]; }; rust_pkg = pkgs.rust-bin.nightly."2024-05-20".default.override { extensions = ["rust-src" "rustc" "rustc-dev" "llvm-tools" "rust-analyzer" "cargo"]; }; in pkgs.mkShell { buildInputs = with pkgs; [ ( rust_pkg ) openssl pkg-config eza fd ]; RUST_BACKTRACE = 1; RUST_SRC_PATH = "${rust_pkg}/lib/rustlib/src/rust/library"; }
Enter the shell:
nix-shell
Launch RA:
rust-analyzer diagnostics .
You will have the following errors:
processing crate: print_all_items_driver, module: /print-all-items/src/bin/print-all-items-driver.rs processing crate: cargo_print_all_items, module: /print-all-items/src/bin/cargo-print-all-items.rs processing crate: print_all_items, module: /print-all-items/src/lib.rs Diagnostic { code: RustcHardError("unresolved-extern-crate"), message: "unresolved extern crate", range: FileRange { file_id: FileId(11), range: 98..124 }, severity: Error, unused: false, experimental: false, fixes: None, main_node: Some(InFileWrapper { file_id: FileId(11), value: SyntaxNodePtr { kind: EXTERN_CRATE, range: 98..124 } }) } Diagnostic { code: RustcHardError("unresolved-extern-crate"), message: "unresolved extern crate", range: FileRange { file_id: FileId(11), range: 125..154 }, severity: Error, unused: false, experimental: false, fixes: None, main_node: Some(InFileWrapper { file_id: FileId(11), value: SyntaxNodePtr { kind: EXTERN_CRATE, range: 125..154 } }) } Diagnostic { code: RustcHardError("unresolved-extern-crate"), message: "unresolved extern crate", range: FileRange { file_id: FileId(11), range: 155..181 }, severity: Error, unused: false, experimental: false, fixes: None, main_node: Some(InFileWrapper { file_id: FileId(11), value: SyntaxNodePtr { kind: EXTERN_CRATE, range: 155..181 } }) } Diagnostic { code: RustcHardError("unresolved-extern-crate"), message: "unresolved extern crate", range: FileRange { file_id: FileId(11), range: 182..209 }, severity: Error, unused: false, experimental: false, fixes: None, main_node: Some(InFileWrapper { file_id: FileId(11), value: SyntaxNodePtr { kind: EXTERN_CRATE, range: 182..209 } }) } diagnostic scan complete Error: diagnostic error detected Stack backtrace: 0: <anyhow::Error>::msg::<&str> 1: std::sys_common::backtrace::__rust_begin_short_backtrace::<<stdx::thread::Builder>::spawn<<rust_analyzer::cli::flags::Diagnostics>::run::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#0}, core::result::Result<(), anyhow::Error>> 2: <<std::thread::Builder>::spawn_unchecked_<<stdx::thread::Builder>::spawn<<rust_analyzer::cli::flags::Diagnostics>::run::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#0}, core::result::Result<(), anyhow::Error>>::{closure#2} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 3: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once at /rustc/d84b9037541f45dc2c52a41d723265af211c0497/library/alloc/src/boxed.rs:2022:9 4: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once at /rustc/d84b9037541f45dc2c52a41d723265af211c0497/library/alloc/src/boxed.rs:2022:9 5: std::sys::pal::unix::thread::Thread::new::thread_start at /rustc/d84b9037541f45dc2c52a41d723265af211c0497/library/std/src/sys/pal/unix/thread.rs:108:17 6: start_thread 7: __GI___clone3
See https://github.com/cognitive-engineering-lab/rustc_plugin/issues/26 for additional information.
Anybody willing to help me on this ?
rust-analyzer version: rust-analyzer 1.80.0-nightly (d84b903 2024-05-19)
rustc version: rustc 1.80.0-nightly (d84b90375 2024-05-19)
editor or extension: NeoVim configured with lspconfig
relevant settings:
repository link (if public, optional): rustc_plugin example
steps to reproduce: Clone the example from https://github.com/cognitive-engineering-lab/rustc_plugin/ and change the crate:
Create a shell.nix with the following content:
Enter the shell:
Launch RA:
You will have the following errors:
See https://github.com/cognitive-engineering-lab/rustc_plugin/issues/26 for additional information.