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

ICE "no ImplicitCtxt stored in tls" in Servo on Windows and macOS #62717

Closed
SimonSapin opened this issue Jul 16, 2019 · 5 comments · Fixed by #62727
Closed

ICE "no ImplicitCtxt stored in tls" in Servo on Windows and macOS #62717

SimonSapin opened this issue Jul 16, 2019 · 5 comments · Fixed by #62727
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@SimonSapin
Copy link
Contributor

Compiling Servo with rustc 1.38.0-nightly (4b65a86 2019-07-15) works fine on Linux. On a Windows or macOS host the compiler panics on the script crate:

thread 'rustc' panicked at 'no ImplicitCtxt stored in tls', src\libcore\option.rs:1065:5
stack backtrace:
   0: std::sys_common::alloc::realloc_fallback
   1: std::panicking::take_hook
   2: std::panicking::take_hook
   3: <rustc::ty::layout::LayoutCx<rustc::ty::query::TyCtxtAt> as rustc_target::abi::LayoutOf>::layout_of
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::option::expect_failed
   9: core::option::Option<rustc::ty::context::tls::ImplicitCtxt*>::expect<rustc::ty::context::tls::ImplicitCtxt*>
             at /rustc/4b65a86ebace8600c8e269e8bfe3365cdc460e68\src\libcore\option.rs:341
  10: rustc::ty::context::tls::with_context::{{closure}}<closure,rustc::ty::query::plumbing::TryGetJob<rustc::ty::query::queries::crate_name>>
             at /rustc/4b65a86ebace8600c8e269e8bfe3365cdc460e68\src\librustc\ty\context.rs:1955
  11: rustc::ty::context::tls::with_context_opt<closure,rustc::ty::query::plumbing::TryGetJob<rustc::ty::query::queries::crate_name>>
             at /rustc/4b65a86ebace8600c8e269e8bfe3365cdc460e68\src\librustc\ty\context.rs:1938
  12: rustc::ty::context::tls::with_context<closure,rustc::ty::query::plumbing::TryGetJob<rustc::ty::query::queries::crate_name>>
             at /rustc/4b65a86ebace8600c8e269e8bfe3365cdc460e68\src\librustc\ty\context.rs:1955
  13: rustc::ty::context::tls::with_related_context<closure,rustc::ty::query::plumbing::TryGetJob<rustc::ty::query::queries::crate_name>>
             at /rustc/4b65a86ebace8600c8e269e8bfe3365cdc460e68\src\librustc\ty\context.rs:1968
  14: rustc::ty::context::TyCtxt::get_query<rustc::ty::query::queries::crate_name>
             at /rustc/4b65a86ebace8600c8e269e8bfe3365cdc460e68\src\librustc\ty\query\plumbing.rs:363
  15: script_plugins::utils::match_def_path
             at .\components\script_plugins\utils.rs:14
  16: script_plugins::unrooted_must_root::is_unrooted_ty::{{closure}}
             at .\components\script_plugins\unrooted_must_root.rs:62
  17: rustc::ty::TyS::maybe_walk<closure>
             at /rustc/4b65a86ebace8600c8e269e8bfe3365cdc460e68\src\librustc\ty\mod.rs:2662
  18: script_plugins::unrooted_must_root::is_unrooted_ty
             at .\components\script_plugins\unrooted_must_root.rs:54
  19: script_plugins::unrooted_must_root::{{impl}}::check_fn
             at .\components\script_plugins\unrooted_must_root.rs:222
  20: <rustc::lint::context::LateLintPassObjects as rustc::lint::LateLintPass>::check_fn
  21: rustc_interface::passes::BoxedGlobalCtxt::complete
  22: <rustc_interface::util::ReplaceBodyWithLoop as syntax::mut_visit::MutVisitor>::visit_mac
  23: rustc_interface::passes::BoxedGlobalCtxt::complete
  24: <rustc_interface::util::ReplaceBodyWithLoop as syntax::mut_visit::MutVisitor>::visit_mac
  25: rustc_interface::passes::BoxedGlobalCtxt::complete
  26: <rustc_interface::util::ReplaceBodyWithLoop as syntax::mut_visit::MutVisitor>::visit_mac
  27: rustc_interface::passes::BoxedGlobalCtxt::complete
  28: <rustc_interface::util::ReplaceBodyWithLoop as syntax::mut_visit::MutVisitor>::visit_mac
  29: rustc_interface::passes::BoxedGlobalCtxt::complete
  30: rustc_interface::passes::BoxedGlobalCtxt::complete
  31: <humantime::date::Rfc3339Timestamp as core::fmt::Debug>::fmt
  32: <humantime::date::Rfc3339Timestamp as core::fmt::Debug>::fmt
  33: _rust_maybe_catch_panic
  34: <rustc_interface::profile::trace::Query as core::fmt::Debug>::fmt
  35: _rust_maybe_catch_panic
  36: <humantime::date::Rfc3339Timestamp as core::fmt::Debug>::fmt
  37: rustc_interface::passes::BoxedResolver::to_expansion_result
  38: <rustc_metadata::foreign_modules::Collector as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_impl_item
  39: <rustc_driver::pretty::UserIdentifiedItem as core::fmt::Debug>::fmt
  40: <rustc_metadata::foreign_modules::Collector as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_impl_item
  41: <rustc_metadata::foreign_modules::Collector as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_impl_item
  42: <humantime::date::Rfc3339Timestamp as core::fmt::Debug>::fmt
  43: <rustc_metadata::foreign_modules::Collector as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_impl_item
  44: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
  45: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
  46: <serde_json::value::WriterFormatter as std::io::Write>::flush
  47: <rustc_metadata::foreign_modules::Collector as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_impl_item
  48: _rust_maybe_catch_panic
  49: <rustc_metadata::foreign_modules::Collector as rustc::hir::itemlikevisit::ItemLikeVisitor>::visit_impl_item
  50: ZN244_$LT$std..error..$LT$impl$u20$core..convert..From$LT$alloc..string..String$GT$$u20$for$u20$alloc..boxed..Box$LT$dyn$u20$std..error..Error$u2b$core..marker..Send$u2b$core..marker..Sync$GT$$GT$..from..StringError$u20$as$u20$core..fmt..Display$GT$3fmt17
  51: std::sys::windows::thread::Thread::new
  52: BaseThreadInitThunk
  53: RtlUserThreadStart
query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack

error: internal compiler error: unexpected panic

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.38.0-nightly (4b65a86eb 2019-07-15) running on x86_64-pc-windows-msvc

note: compiler flags: -C debuginfo=2 -C linker=lld-link.exe --crate-type lib

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

error: Could not compile `script`.
@SimonSapin SimonSapin added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jul 16, 2019
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 16, 2019
@SimonSapin
Copy link
Contributor Author

Regression range: dfd52ba...6e310f2. Merges:

6e310f2 Auto merge of #62435 - scottmcm:constrained-array-impls, r=centril
9210359 Auto merge of #62467 - Centril:rollup-083tn7t, r=Centril
a2500db Rollup merge of #62286 - petrhosek:rustc-no-duplicate-archives, r=cramertj
fe807fc Rollup merge of #62213 - QuietMisdreavus:cfg-doctest, r=GuillaumeGomez
3250b8e Rollup merge of #62042 - petrochenkov:macstab, r=matthewjasper
9cd75fb Rollup merge of #61883 - zackmdavis:non_ascii_idents_lint, r=Manishearth
dd2e804 Auto merge of #59800 - Zoxc:less-dylibs, r=alexcrichton
dbeed58 Auto merge of #62434 - Manishearth:clippyup, r=Manishearth
927a3e8 Auto merge of #62458 - Centril:rollup-j6o2sqj, r=Centril
fb01170 Rollup merge of #62455 - zackmdavis:name_trait_for_ambiguous_assoc_item, r=petrochenkov
037f568 Rollup merge of #62438 - petrochenkov:buildwarn, r=Mark-Simulacrum
c512829 Rollup merge of #62379 - GuillaumeGomez:option-doc-links, r=QuietMisdreavus
719eeb2 Rollup merge of #61990 - llogiq:questionmark-test, r=QuietMisdreavus
4393768 Auto merge of #62281 - Disasm:riscv-pic, r=nagisa
b0bd5f2 Auto merge of #62452 - Centril:rollup-5jww3h7, r=Centril
7ef02dc Rollup merge of #62436 - fakenine:normalize_use_of_backticks_compiler_messages_1, r=Centril
30e4a87 Rollup merge of #62422 - lzutao:remove-some-mem-uinit, r=alexcrichton
154726c Rollup merge of #62243 - petrochenkov:macrodoc, r=eddyb
296e825 Rollup merge of #61862 - vorner:weak-into-raw-methods, r=sfackler
327c54e Rollup merge of #60081 - pawroman:cleanup_unicode_script, r=varkor

@SimonSapin
Copy link
Contributor Author

#62281 updates LLVM: rust-lang/llvm-project@1bbe0b3...8538d56

@eddyb
Copy link
Member

eddyb commented Jul 16, 2019

It's probably #59800 - try adding extern crate rustc_interface; and/or extern crate rustc_driver; to your plugin crate.

@nagisa
Copy link
Member

nagisa commented Jul 18, 2019

Removing nomination since it appears there is nothing really to discuss anymore.

@nikomatsakis
Copy link
Contributor

Update from compiler-team meeting:

Rating as P-high and assigning to @SimonSapin as they have a pending PR (#62727).

@jonas-schievink jonas-schievink added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Aug 15, 2019
bors added a commit that referenced this issue Aug 20, 2019
Deprecate using rustc_plugin without the rustc_driver dylib.

CC #59800, 7198687

Fix #62717
@bors bors closed this as completed in d0bbc60 Aug 20, 2019
denisandroid added a commit to clucompany/cluCStr that referenced this issue Aug 22, 2019
…`rustc_driver::plugin` instead to make TLS work correctly. See rust-lang/rust#62717"

2. Updated to `rust nightly e44fdf979 2019-08-21`
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 11, 2020
…tic-morse

Add -Z codegen-backend dylib to deps

When the codegen-backend dylib changes, the program should be rebuilt.

---

Unfortunately I was unable to test this works locally due to running into a TLS issue when running the custom backend, `thread 'rustc' panicked at 'no ImplicitCtxt stored in tls', compiler/rustc_middle/src/ty/context.rs:1750:54`, which seems similar to rust-lang#62717 but has a completely different cause and backtrace.

`@eddyb` said to ping `@Mark-Simulacrum` about what they think about this, so, ping!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants