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

Compiler panics on latest RLS when compiling crates that depend on bitflags 1.0.5 #60484

Closed
Ten0 opened this issue May 2, 2019 · 3 comments
Closed
Labels
A-rls Area: Rust Language Server (RLS) A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Ten0
Copy link

Ten0 commented May 2, 2019

Follows rust-lang/rls#1449.
EDIT: New elements there.

I'm trying to develop a crate which ends up using nix as a dependency.
I'm getting the following error through RLS :
(stable-x86_64-unknown-linux-gnu unchanged - rustc 1.34.1 (fc50f32 2019-04-24), ArchLinux 5.0.10-arch1-1-ARCH)

Could not compile `nix`.
process didn't exit successfully: `/home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rls --crate-name nix /home/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.13.0/src/lib.rs --color never --crate-type lib --emit=dep-info,metadata -C debuginfo=2 -C metadata=e41c62fd44c3a368 -C extra-filename=-e41c62fd44c3a368 --out-dir /home/xxx/bug/target/rls/debug/deps -L dependency=/home/xxx/bug/target/rls/debug/deps --extern bitflags=/home/xxx/bug/target/rls/debug/deps/libbitflags-162b4a56bd08b901.rmeta --extern cfg_if=/home/xxx/bug/target/rls/debug/deps/libcfg_if-dab04317bb5fc6db.rmeta --extern libc=/home/xxx/bug/target/rls/debug/deps/liblibc-98ec97d48b6e5b85.rmeta --extern void=/home/xxx/bug/target/rls/debug/deps/libvoid-e59ad8b8a3ae09b4.rmeta --cap-lints allow --error-format=json --sysroot /home/xxx/.rustup/toolchains/stable-x86_64-unknown-linux-gnu` (exit code: 101)

Using "rust-client.logToFile": true, to get the log, I get this additional information:

{"message":"src/librustc/ty/context.rs:541: node_type: no type for node `expr <Self>::AT_SYMLINK_NOFOLLOW (id=43804)`","code":null,"level":"error: internal compiler error","spans":[],"children":[],"rendered":"error: internal compiler error: src/librustc/ty/context.rs:541: node_type: no type for node `expr <Self>::AT_SYMLINK_NOFOLLOW (id=43804)`\n\n"}
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:620:9
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error\n\n"}

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.34.1 (fc50f328b 2019-04-24) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

This error does not happen when compiling through cargo check, cargo build, cargo build --release, cargo doc, etc, only through RLS, but I suppose the compiler is not supposed to crash anyway.

The following minimal project triggers the bug when opening VSCode with the RLS extension installed :

Cargo.toml:

[package]
name = "bug"
version = "1.0.0"
authors = ["Le me"]
edition = "2018"
publish = false

[dependencies]
nix = "0.13.0"

src/main.rs:

fn main() {
	let hw = "HelloWorld";
	println!("{}", hw);
}
@jonas-schievink jonas-schievink added A-rls Area: Rust Language Server (RLS) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 2, 2019
@Ten0 Ten0 changed the title Compiler panics on latest RLS when compiling (for instance) nix crate Compiler panics on latest RLS when compiling crates that depend on bitflags 1.0.5 May 3, 2019
@jonas-schievink
Copy link
Contributor

To reproduce, run cargo +nightly rustc --lib -- -Zsave-analysis on a fresh checkout (nix-rust/nix@71b35a0) of nix:

error: the item `libc` is imported redundantly
  --> src/mount.rs:64:9
   |
2  | use libc;
   |     ---- the item `libc` is already imported here
...
64 |     use libc;
   |         ^^^^
   |
note: lint level defined here
  --> src/lib.rs:13:9
   |
13 | #![deny(unused)]
   |         ^^^^^^
   = note: #[deny(unused_imports)] implied by #[deny(unused)]

error: internal compiler error: src/librustc/ty/context.rs:562: node_type: no type for node `expr <Self>::AT_SYMLINK_NOFOLLOW (id=45856)`

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:643:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:197
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:211
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:478
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::bug
   8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::util::bug::opt_span_bug_fmt
  13: rustc::util::bug::bug_fmt
  14: rustc::ty::context::TypeckTables::node_type::{{closure}}
  15: rustc::ty::context::TypeckTables::expr_ty_adjusted
  16: rustc_save_analysis::SaveContext::get_expr_data
  17: <rustc_save_analysis::dump_visitor::DumpVisitor<O> as syntax::visit::Visitor>::visit_expr
  18: rustc_save_analysis::dump_visitor::DumpVisitor<O>::process_assoc_const
  19: <rustc_save_analysis::dump_visitor::DumpVisitor<O> as syntax::visit::Visitor>::visit_item
  20: rustc_save_analysis::dump_visitor::DumpVisitor<O>::process_method
  21: <rustc_save_analysis::dump_visitor::DumpVisitor<O> as syntax::visit::Visitor>::visit_item
  22: <rustc_save_analysis::dump_visitor::DumpVisitor<O> as syntax::visit::Visitor>::visit_item
  23: <rustc_save_analysis::dump_visitor::DumpVisitor<O> as syntax::visit::Visitor>::visit_mod
  24: <rustc_save_analysis::DumpHandler as rustc_save_analysis::SaveHandler>::save
  25: rustc::dep_graph::graph::DepGraph::with_ignore
  26: rustc_driver::run_compiler::{{closure}}::{{closure}}::{{closure}}
  27: rustc::util::common::time
  28: rustc::ty::context::tls::enter_global
  29: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  30: rustc_interface::passes::create_global_ctxt::{{closure}}
  31: rustc_interface::interface::run_compiler_in_existing_thread_pool
  32: std::thread::local::LocalKey<T>::with
  33: scoped_tls::ScopedKey<T>::set
  34: syntax::with_globals
query stack during panic:
end of query stack
error: aborting due to 2 previous errors

@jonas-schievink jonas-schievink added the A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. label May 3, 2019
@hcrohland
Copy link

I have the same error. rustc crashes when compiling diesel from rls.
Normal compile via 'cargo build' succeeds.

@jonas-schievink
Copy link
Contributor

Duplicate of #59134

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rls Area: Rust Language Server (RLS) A-save-analysis Area: saving results of analyses such as inference and borrowck results to a file. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants