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

Clippy ICE on Windows 10, Rust 1.34 (also cargo check) #60230

Closed
hrydgard opened this issue Apr 24, 2019 · 19 comments
Closed

Clippy ICE on Windows 10, Rust 1.34 (also cargo check) #60230

hrydgard opened this issue Apr 24, 2019 · 19 comments
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html 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

@hrydgard
Copy link

Getting ICE on the most basic runs of cargo clippy after upgrading to 1.34. In rand??

This is on Windows 10.

error: internal compiler error: src\librustc_mir\monomorphize\collector.rs:745: Cannot create local mono-item for DefId(12/0:117 ~ rand_core[8332]::{{impl}}[0]::try_fill_bytes[0])


thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:620:9
stack backtrace:
   0: std::sys_common::alloc::realloc_fallback
   1: std::panicking::take_hook
   2: std::panicking::take_hook
   3: <rustc::ty::sty::Binder<rustc::ty::ProjectionPredicate<'tcx>> as rustc::ty::ToPredicate<'tcx>>::to_predicate
   4: std::panicking::rust_panic_with_hook
   5: <rustc_errors::emitter::ColorConfig as core::fmt::Debug>::fmt
   6: rustc_errors::Handler::bug
   7: rustc::util::bug::bug_fmt
   8: rustc::ty::wf::object_region_bounds
   9: rustc::ty::wf::object_region_bounds
  10: rustc::ty::wf::object_region_bounds
  11: rustc::util::bug::bug_fmt
  12: rustc::util::bug::bug_fmt
  13: <rustc_mir::monomorphize::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_static
  14: <rustc_mir::monomorphize::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_static
  15: <rustc_mir::monomorphize::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_terminator_kind
  16: rustc_mir::monomorphize::collector::collect_crate_mono_items
  17: rustc_mir::monomorphize::collector::collect_crate_mono_items
  18: <rustc_mir::transform::generator::StateTransform as rustc_mir::transform::MirPass>::run_pass
  19: <rustc_mir::interpret::eval_context::StackPopCleanup as core::fmt::Debug>::fmt
  20: rustc_mir::monomorphize::collector::collect_crate_mono_items
  21: <rustc_mir::interpret::eval_context::StackPopCleanup as core::fmt::Debug>::fmt
  22: rustc_mir::monomorphize::partitioning::compute_codegen_unit_name
  23: <rustc_codegen_ssa::common::TypeKind as core::fmt::Debug>::fmt
  24: <rustc_codegen_ssa::MemFlags as core::fmt::UpperHex>::fmt
  25: <rustc_codegen_ssa::MemFlags as core::fmt::UpperHex>::fmt
  26: <rustc_codegen_ssa::MemFlags as core::fmt::UpperHex>::fmt
  27: rustc_codegen_ssa::back::archive::find_library
  28: <rustc_codegen_llvm::back::lto::ThinLTOImports as core::fmt::Debug>::fmt
  29: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::join_codegen_and_link
  30: <rustc_codegen_llvm::llvm_::ffi::PassKind as core::fmt::Debug>::fmt
  31: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::join_codegen_and_link
  32: <rustc_codegen_llvm::back::link::exec_linker::Escape<'a> as core::fmt::Display>::fmt
  33: rustc_codegen_llvm::consts::<impl rustc_codegen_ssa::traits::statics::StaticMethods for rustc_codegen_llvm::context::CodegenCx<'ll, 'tcx>>::codegen_static
  34: rustc_codegen_llvm::llvm_::diagnostic::Diagnostic::unpack
  35: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  36: rand::os::OsRng::new
  37: rustc_driver::driver::phase_4_codegen
  38: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
  39: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
  40: <env_logger::fmt::WriteStyle as core::default::Default>::default
  41: rustc_driver::driver::compile_input
  42: rustc_driver::run_compiler
  43: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
  44: rustc_driver::run_compiler
  45: <unknown>
  46: <unknown>
  47: _rust_maybe_catch_panic
  48: <unknown>
  49: std::sys::windows::thread::Thread::new
  50: BaseThreadInitThunk
  51: RtlUserThreadStart
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [backend_optimization_level] optimization level used by backend
end of query stack
error: aborting due to previous error


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.0 (91856ed52 2019-04-10) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C linker=lld-link.exe -C link-args=-fuse-ld=lld -C opt-level=z -C inline-threshold=275 -C lto=no --crate-type lib

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

error: Could not compile `rand`.
@hellow554
Copy link
Contributor

hellow554 commented Apr 24, 2019

Do you have some code to share which reproduces the problem?

@rustbot modify labels: I-ICE T-compiler A-mir

@rustbot rustbot added 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. A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html labels Apr 24, 2019
@hrydgard
Copy link
Author

hrydgard commented Apr 24, 2019

Anything. As you can see, the clippy error happens in system libraries, not my code. I have tried to uninstall and reinstall the toolchain and clippy using rustup, same thing happens.

@hellow554
Copy link
Contributor

So, when you create a new project via cargo new foo, then cd into it and run cargo clippy it will give you the error above?

@hrydgard
Copy link
Author

hrydgard commented Apr 24, 2019

If I do cargo new foo, and then add rand = "0.6" under dependencies in foo/Cargo.toml, then do cargo clippy, the above happens.

cargo check also triggers it. But not cargo run, which works as expected.

@hrydgard hrydgard changed the title Clippy ICE on Windows 10, Rust 1.34 Clippy ICE on Windows 10, Rust 1.34 (also cargo check) Apr 24, 2019
@hellow554
Copy link
Contributor

Possible dup of #59898 and #58323

@hellow554
Copy link
Contributor

I have to say, that I cannot reproduce it with a clean project (even after adding rand = "0.6" in Cargo.toml).
I think there's more here, but the error message looks like #59898

@hrydgard
Copy link
Author

Yeah, looks like the same crash. It bizarrely reproduces 100% on one machine but not on others. Again, reinstalling toolchain etc has no effect.

Either way, I think the fix urgently needs to go into stable.

@jonas-schievink
Copy link
Contributor

Yes, this is likely a duplicate, so closing in favor of #59898. It will be fixed in 1.34.1

@hrydgard
Copy link
Author

hrydgard commented Apr 26, 2019

This in fact still happens on Rust 1.34.1. Please re-open.

error: internal compiler error: src\librustc_mir\monomorphize\collector.rs:745: Cannot create local mono-item for DefId(11/0:14 ~ lazy_static[6522]::lazy[0]::{{impl}}[0]::get[0])

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:620:9
    Checking matrixmultiply v0.2.2
warning: not embedding natvis: lld-link may not support the flag

stack backtrace:
   0: std::sys_common::alloc::realloc_fallback
   1: std::panicking::take_hook
   2: std::panicking::take_hook
   3: <rustc::ty::sty::Binder<rustc::ty::ProjectionPredicate<'tcx>> as rustc::ty::ToPredicate<'tcx>>::to_predicate
   4: std::panicking::rust_panic_with_hook
   5: <rustc_errors::emitter::ColorConfig as core::fmt::Debug>::fmt
   6: rustc_errors::Handler::bug
   7: rustc::util::bug::bug_fmt
   8: rustc::ty::wf::object_region_bounds
   9: rustc::ty::wf::object_region_bounds
  10: rustc::ty::wf::object_region_bounds
  11: rustc::util::bug::bug_fmt
  12: rustc::util::bug::bug_fmt
  13: <rustc_mir::monomorphize::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_static
  14: <rustc_mir::monomorphize::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_static
  15: <rustc_mir::monomorphize::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_terminator_kind
  16: rustc_mir::monomorphize::collector::collect_crate_mono_items
  17: rustc_mir::monomorphize::collector::collect_crate_mono_items
  18: rustc_mir::monomorphize::collector::collect_crate_mono_items
  19: rustc_mir::monomorphize::collector::collect_crate_mono_items
  20: rustc_mir::monomorphize::collector::collect_crate_mono_items
  21: rustc_mir::monomorphize::collector::collect_crate_mono_items
  22: rustc_mir::monomorphize::collector::collect_crate_mono_items
  23: rustc_mir::monomorphize::collector::collect_crate_mono_items
  24: rustc_mir::monomorphize::collector::collect_crate_mono_items
  25: <rustc_mir::transform::generator::StateTransform as rustc_mir::transform::MirPass>::run_pass
  26: <rustc_mir::interpret::eval_context::StackPopCleanup as core::fmt::Debug>::fmt
  27: rustc_mir::monomorphize::collector::collect_crate_mono_items
  28: <rustc_mir::interpret::eval_context::StackPopCleanup as core::fmt::Debug>::fmt
  29: rustc_mir::monomorphize::partitioning::compute_codegen_unit_name
  30: <rustc_codegen_ssa::common::TypeKind as core::fmt::Debug>::fmt
  31: <rustc_codegen_ssa::MemFlags as core::fmt::UpperHex>::fmt
  32: <rustc_codegen_ssa::MemFlags as core::fmt::UpperHex>::fmt
  33: <rustc_codegen_ssa::MemFlags as core::fmt::UpperHex>::fmt
  34: rustc_codegen_ssa::back::archive::find_library
  35: <rustc_codegen_llvm::back::lto::ThinLTOImports as core::fmt::Debug>::fmt
  36: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::join_codegen_and_link
  37: <rustc_codegen_llvm::llvm_::ffi::PassKind as core::fmt::Debug>::fmt
  38: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::join_codegen_and_link
  39: <rustc_codegen_llvm::back::link::exec_linker::Escape<'a> as core::fmt::Display>::fmt
  40: rustc_codegen_llvm::consts::<impl rustc_codegen_ssa::traits::statics::StaticMethods for rustc_codegen_llvm::context::CodegenCx<'ll, 'tcx>>::codegen_static
  41: rustc_codegen_llvm::llvm_::diagnostic::Diagnostic::unpack
  42: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  43: rand::os::OsRng::new
  44: rustc_driver::driver::phase_4_codegen
  45: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
  46: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
  47: <env_logger::fmt::WriteStyle as core::default::Default>::default
  48: rustc_driver::driver::compile_input
  49: rustc_driver::run_compiler
  50: <rustc_driver::CompilationFailure as core::fmt::Debug>::fmt
  51: rustc_driver::run_compiler
  52: <unknown>
  53: <unknown>
  54: _rust_maybe_catch_panic
  55: <unknown>
  56: std::sys::windows::thread::Thread::new
  57: BaseThreadInitThunk
  58: RtlUserThreadStart
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
#1 [backend_optimization_level] optimization level used by backend
end of query stack
error: aborting due to previous error


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-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C linker=lld-link.exe -C link-args=-fuse-ld=lld -C opt-level=z -C inline-threshold=275 -C lto=no --crate-type lib

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

error: Could not compile `thread_local`.

@jonas-schievink
Copy link
Contributor

@hrydgard The compiler team decided not to backport the fix for this issue. It is already fixed on beta and nightly and will be fixed in 1.35.0. I closed the issue because it is a duplicate of #59898, however, which is still open.

@hellow554
Copy link
Contributor

hellow554 commented Apr 26, 2019

@hrydgard can you please confirm that it has been fixed on beta by using rustup default beta; rustup update?

@jonas-schievink
Copy link
Contributor

Yes, that's a good idea. The weird thing is that #59898 only really happens on crates that target non-tier1 platforms, so this might still be something else.

@hrydgard
Copy link
Author

It appears to be fixed in beta for me.

Still, indeed mysterious that it doesn't seem to happen for others on Windows. If there's anything you'd want me to check about my installation, I'm happy to do so.

@hrydgard
Copy link
Author

hrydgard commented May 16, 2019

While fixed in beta, still seeing this on Rust stable 1.34.2, just for the record. I don't understand why it only happens on this one machine on Windows... What could possibly be different?

@hellow554
Copy link
Contributor

As Jonas said, it has not been back ported to stable. Beta branch will be 1.35, not the next 1.34.X, that are only hotfixes (in this case an unsound trait method)

@hrydgard
Copy link
Author

Yeah, I'm not saying it's unexpected that it's not fixed 1.34.2, I'm saying it's very unexpected that no-one else seems to be hitting it.

@hrydgard
Copy link
Author

hrydgard commented May 17, 2019

I figured out why it's only happening to me on Windows.

I used the following ~/.cargo to speed up builds by linking using LLD:

[target.x86_64-pc-windows-msvc]
linker = "lld-link.exe"
rustflags = ["-C", "link-args=-fuse-ld=lld", "-C", "opt-level=z", "-C", "inline-threshold=275", "-C", "lto=no"]

The killer is opt-level="z", which triggers this problem. "s" does too, but not "2" for example.

@jonas-schievink
Copy link
Contributor

Ah then that's the link between your setup and the embedded use cases that were hitting this.

@hellow554
Copy link
Contributor

hellow554 commented May 17, 2019

Then this is certainly a dup of #59898

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html 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

4 participants