Repository: rust
Issue: Panic when running UI tests with `parallel-compiler = true` and without -Z unstable-options
Labels: I-ICE,T-compiler,C-bug,WG-compiler-parallel

Steps to replicate: Check out https://github.com/jyn514/rust/commit/0e0bb7b4db3bd7e3cc846cea96c6bf69f201d05e and run `x.py test src/test/ui`.

```
---- [ui] ui/recursion/issue-26548-recursion-via-normalize.rs stdout ----

error: Error: expected failure status (Some(1)) but received status None.
status: signal: 6
command: "/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/home/joshua/rustc3/src/test/ui/recursion/issue-26548-recursion-via-normalize.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "-C" "prefer-dynamic" "--out-dir" "/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/test/ui/recursion/issue-26548-recursion-via-normalize" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Lnative=/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/home/joshua/rustc3/build/x86_64-unknown-linux-gnu/test/ui/recursion/issue-26548-recursion-via-normalize/auxiliary"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
thread '<unnamed>' panicked at 'WorkerLocal can only be used on the thread pool it was created on', /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.0/src/worker_local.rs:47:17
```

<details><summary>Backtrace</summary>

```
stack backtrace:
   0: std::panicking::begin_panic
             at ./library/std/src/panicking.rs:519:12
   1: rustc_rayon_core::worker_local::WorkerLocal<T>::current
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.0/src/worker_local.rs:47:17
   2: <rustc_rayon_core::worker_local::WorkerLocal<T> as core::ops::deref::Deref>::deref
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.0/src/worker_local.rs:72:9
   3: rustc_metadata::rmeta::decoder::cstore_impl::provide_extern::item_children
             at ./compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:225:9
   4: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
             at ./compiler/rustc_query_system/src/dep_graph/graph.rs:365:14
   5: rustc_query_system::query::plumbing::force_query_with_job::{{closure}}::{{closure}}
   6: stacker::maybe_grow
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/stacker-0.1.12/src/lib.rs:55:9
   7: rustc_data_structures::stack::ensure_sufficient_stack
             at ./compiler/rustc_data_structures/src/stack.rs:16:5
   8: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}::{{closure}}
             at ./compiler/rustc_query_impl/src/plumbing.rs:169:17
   9: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1723:50
  10: rustc_rayon_core::tlv::with
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.0/src/tlv.rs:19:5
  11: rustc_middle::ty::context::tls::set_tlv
             at ./compiler/rustc_middle/src/ty/context.rs:1681:9
  12: rustc_middle::ty::context::tls::enter_context
             at ./compiler/rustc_middle/src/ty/context.rs:1723:9
  13: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}
             at ./compiler/rustc_query_impl/src/plumbing.rs:168:13
  14: rustc_middle::ty::context::tls::with_related_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1767:13
  15: rustc_middle::ty::context::tls::with_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1751:40
  16: rustc_middle::ty::context::tls::with_context_opt
             at ./compiler/rustc_middle/src/ty/context.rs:1740:22
  17: rustc_middle::ty::context::tls::with_context
             at ./compiler/rustc_middle/src/ty/context.rs:1751:9
  18: rustc_middle::ty::context::tls::with_related_context
             at ./compiler/rustc_middle/src/ty/context.rs:1764:9
  19: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query
             at ./compiler/rustc_query_impl/src/plumbing.rs:157:9
  20: rustc_query_system::query::plumbing::force_query_with_job::{{closure}}
             at ./compiler/rustc_query_system/src/query/plumbing.rs:617:9
  21: rustc_query_system::query::plumbing::with_diagnostics
             at ./compiler/rustc_query_system/src/query/plumbing.rs:328:18
  22: rustc_query_system::query::plumbing::force_query_with_job
             at ./compiler/rustc_query_system/src/query/plumbing.rs:616:51
  23: rustc_query_system::query::plumbing::try_execute_query
             at ./compiler/rustc_query_system/src/query/plumbing.rs:444:16
  24: rustc_query_system::query::plumbing::get_query_impl
             at ./compiler/rustc_query_system/src/query/plumbing.rs:664:5
  25: rustc_query_system::query::plumbing::get_query
             at ./compiler/rustc_query_system/src/query/plumbing.rs:775:9
  26: rustc_middle::ty::query::TyCtxtAt::item_children
             at ./compiler/rustc_middle/src/ty/query/mod.rs:205:17
  27: rustc_middle::ty::query::<impl rustc_middle::ty::context::TyCtxt>::item_children
             at ./compiler/rustc_middle/src/ty/query/mod.rs:186:17
  28: rustc_metadata::rmeta::decoder::cstore_impl::provide::{{closure}}
             at ./compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:371:34
  29: core::ops::function::FnOnce::call_once
             at ./library/core/src/ops/function.rs:227:5
  30: rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::visible_parent_map>::compute
             at ./compiler/rustc_query_impl/src/plumbing.rs:400:17
  31: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
             at ./compiler/rustc_query_system/src/dep_graph/graph.rs:365:14
  32: rustc_query_system::query::plumbing::force_query_with_job::{{closure}}::{{closure}}
  33: stacker::maybe_grow
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/stacker-0.1.12/src/lib.rs:55:9
  34: rustc_data_structures::stack::ensure_sufficient_stack
             at ./compiler/rustc_data_structures/src/stack.rs:16:5
  35: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}::{{closure}}
             at ./compiler/rustc_query_impl/src/plumbing.rs:169:17
  36: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1723:50
  37: rustc_rayon_core::tlv::with
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.0/src/tlv.rs:19:5
  38: rustc_middle::ty::context::tls::set_tlv
             at ./compiler/rustc_middle/src/ty/context.rs:1681:9
  39: rustc_middle::ty::context::tls::enter_context
             at ./compiler/rustc_middle/src/ty/context.rs:1723:9
  40: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::{{closure}}
             at ./compiler/rustc_query_impl/src/plumbing.rs:168:13
  41: rustc_middle::ty::context::tls::with_related_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1767:13
  42: rustc_middle::ty::context::tls::with_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1751:40
  43: rustc_middle::ty::context::tls::with_context_opt
             at ./compiler/rustc_middle/src/ty/context.rs:1740:22
  44: rustc_middle::ty::context::tls::with_context
             at ./compiler/rustc_middle/src/ty/context.rs:1751:9
  45: rustc_middle::ty::context::tls::with_related_context
             at ./compiler/rustc_middle/src/ty/context.rs:1764:9
  46: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query
             at ./compiler/rustc_query_impl/src/plumbing.rs:157:9
  47: rustc_query_system::query::plumbing::force_query_with_job::{{closure}}
             at ./compiler/rustc_query_system/src/query/plumbing.rs:617:9
  48: rustc_query_system::query::plumbing::with_diagnostics
             at ./compiler/rustc_query_system/src/query/plumbing.rs:328:18
  49: rustc_query_system::query::plumbing::force_query_with_job
             at ./compiler/rustc_query_system/src/query/plumbing.rs:616:51
  50: rustc_query_system::query::plumbing::try_execute_query
             at ./compiler/rustc_query_system/src/query/plumbing.rs:444:16
  51: rustc_query_system::query::plumbing::get_query_impl
             at ./compiler/rustc_query_system/src/query/plumbing.rs:664:5
  52: rustc_query_system::query::plumbing::get_query
             at ./compiler/rustc_query_system/src/query/plumbing.rs:775:9
  53: rustc_middle::ty::query::TyCtxtAt::visible_parent_map
             at ./compiler/rustc_middle/src/ty/query/mod.rs:205:17
  54: rustc_middle::ty::query::<impl rustc_middle::ty::context::TyCtxt>::visible_parent_map
             at ./compiler/rustc_middle/src/ty/query/mod.rs:186:17
  55: rustc_middle::ty::print::pretty::PrettyPrinter::try_print_visible_def_path_recur
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:362:34
  56: rustc_middle::ty::print::pretty::PrettyPrinter::try_print_visible_def_path
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:270:9
  57: <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::Printer>::print_def_path
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:1357:19
  58: rustc_middle::ty::print::Printer::default_print_def_path::{{closure}}
             at ./compiler/rustc_middle/src/ty/print/mod.rs:146:42
  59: <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::Printer>::path_generic_args
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:1512:16
  60: rustc_middle::ty::print::Printer::default_print_def_path
             at ./compiler/rustc_middle/src/ty/print/mod.rs:145:40
  61: <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::Printer>::print_def_path
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:1394:9
  62: rustc_middle::ty::print::pretty::PrettyPrinter::pretty_print_type
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:581:17
  63: <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::Printer>::print_type
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:1404:13
  64: <&rustc_middle::ty::TyS as rustc_middle::ty::print::Print<P>>::print
             at ./compiler/rustc_middle/src/ty/print/mod.rs:342:9
  65: rustc_middle::ty::print::pretty::<impl core::fmt::Display for &rustc_middle::ty::TyS>::fmt::{{closure}}
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:1890:21
  66: rustc_middle::ty::context::tls::with::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1778:32
  67: rustc_middle::ty::context::tls::with_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1751:40
  68: rustc_middle::ty::context::tls::with_context_opt
             at ./compiler/rustc_middle/src/ty/context.rs:1740:22
  69: rustc_middle::ty::context::tls::with_context
             at ./compiler/rustc_middle/src/ty/context.rs:1751:9
  70: rustc_middle::ty::context::tls::with
             at ./compiler/rustc_middle/src/ty/context.rs:1778:9
  71: rustc_middle::ty::print::pretty::<impl core::fmt::Display for &rustc_middle::ty::TyS>::fmt
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:1889:17
  72: core::fmt::write
             at ./library/core/src/fmt/mod.rs:1092:17
  73: core::fmt::Write::write_fmt
             at ./library/core/src/fmt/mod.rs:182:9
  74: alloc::fmt::format
             at ./library/alloc/src/fmt.rs:578:5
  75: rustc_query_impl::plumbing::<impl rustc_query_system::query::config::QueryDescription<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::layout_raw>::describe::{{closure}}
             at ./compiler/rustc_middle/src/query/mod.rs:12:1
  76: rustc_middle::ty::print::pretty::with_no_trimmed_paths::{{closure}}
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:107:22
  77: std::thread::local::LocalKey<T>::try_with
             at ./library/std/src/thread/local.rs:272:16
  78: std::thread::local::LocalKey<T>::with
             at ./library/std/src/thread/local.rs:248:9
  79: rustc_middle::ty::print::pretty::with_no_trimmed_paths
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:105:5
  80: rustc_query_impl::plumbing::<impl rustc_query_system::query::config::QueryDescription<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::layout_raw>::describe
             at ./compiler/rustc_middle/src/query/mod.rs:12:1
  81: rustc_query_impl::make_query::layout_raw::{{closure}}
             at ./compiler/rustc_query_impl/src/plumbing.rs:328:24
  82: rustc_middle::ty::print::pretty::with_forced_impl_filename_line::{{closure}}
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:85:22
  83: std::thread::local::LocalKey<T>::try_with
             at ./library/std/src/thread/local.rs:272:16
  84: std::thread::local::LocalKey<T>::with
             at ./library/std/src/thread/local.rs:248:9
  85: rustc_middle::ty::print::pretty::with_forced_impl_filename_line
             at ./compiler/rustc_middle/src/ty/print/pretty.rs:83:5
  86: rustc_query_impl::make_query::layout_raw
             at ./compiler/rustc_query_impl/src/plumbing.rs:326:35
  87: rustc_query_system::query::plumbing::QueryState<D,K>::try_collect_active_jobs::{{closure}}::{{closure}}
             at ./compiler/rustc_query_system/src/query/plumbing.rs:138:67
  88: core::iter::adapters::filter_map::filter_map_fold::{{closure}}
             at ./library/core/src/iter/adapters/filter_map.rs:36:28
  89: core::iter::traits::iterator::Iterator::fold
             at ./library/core/src/iter/traits/iterator.rs:2122:21
  90: <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::fold
             at ./library/core/src/iter/adapters/filter_map.rs:85:9
  91: <core::iter::adapters::flatten::FlattenCompat<I,U> as core::iter::traits::iterator::Iterator>::fold::flatten::{{closure}}
             at ./library/core/src/iter/adapters/flatten.rs:336:27
  92: core::iter::adapters::map::map_fold::{{closure}}
             at ./library/core/src/iter/adapters/map.rs:81:21
  93: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold::enumerate::{{closure}}
             at ./library/core/src/iter/adapters/enumerate.rs:104:27
  94: core::iter::traits::iterator::Iterator::fold
             at ./library/core/src/iter/traits/iterator.rs:2122:21
  95: <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold
             at ./library/core/src/iter/adapters/enumerate.rs:110:9
  96: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
             at ./library/core/src/iter/adapters/map.rs:121:9
  97: <core::iter::adapters::fuse::Fuse<I> as core::iter::adapters::fuse::FuseImpl<I>>::fold
             at ./library/core/src/iter/adapters/fuse.rs:458:9
  98: <core::iter::adapters::fuse::Fuse<I> as core::iter::traits::iterator::Iterator>::fold
             at ./library/core/src/iter/adapters/fuse.rs:105:9
  99: <core::iter::adapters::flatten::FlattenCompat<I,U> as core::iter::traits::iterator::Iterator>::fold
             at ./library/core/src/iter/adapters/flatten.rs:343:16
 100: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::fold
             at ./library/core/src/iter/adapters/flatten.rs:74:9
 101: core::iter::traits::iterator::Iterator::for_each
             at ./library/core/src/iter/traits/iterator.rs:774:9
 102: <hashbrown::map::HashMap<K,V,S> as core::iter::traits::collect::Extend<(K,V)>>::extend
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/hashbrown-0.9.0/src/map.rs:3041:9
 103: <std::collections::hash::map::HashMap<K,V,S> as core::iter::traits::collect::Extend<(K,V)>>::extend
             at ./library/std/src/collections/hash/map.rs:2714:9
 104: rustc_query_system::query::plumbing::QueryState<D,K>::try_collect_active_jobs
             at ./compiler/rustc_query_system/src/query/plumbing.rs:134:9
 105: rustc_query_impl::Queries::try_collect_active_jobs
             at ./compiler/rustc_query_impl/src/plumbing.rs:539:21
 106: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::try_collect_active_jobs
             at ./compiler/rustc_query_impl/src/plumbing.rs:54:9
 107: rustc_query_system::query::job::deadlock
             at ./compiler/rustc_query_system/src/query/job.rs:559:21
 108: rustc_interface::util::handle_deadlock::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at ./compiler/rustc_interface/src/util.rs:179:58
 109: rustc_middle::ty::context::tls::with::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1778:32
 110: rustc_middle::ty::context::tls::with_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1751:40
 111: rustc_middle::ty::context::tls::with_context_opt
             at ./compiler/rustc_middle/src/ty/context.rs:1740:22
 112: rustc_middle::ty::context::tls::with_context
             at ./compiler/rustc_middle/src/ty/context.rs:1751:9
 113: rustc_middle::ty::context::tls::with
             at ./compiler/rustc_middle/src/ty/context.rs:1778:9
 114: rustc_interface::util::handle_deadlock::{{closure}}::{{closure}}::{{closure}}
             at ./compiler/rustc_interface/src/util.rs:179:42
 115: scoped_tls::ScopedKey<T>::set
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
 116: rustc_interface::util::handle_deadlock::{{closure}}::{{closure}}
             at ./compiler/rustc_interface/src/util.rs:178:13
 117: rustc_middle::ty::context::tls::enter_context::{{closure}}
             at ./compiler/rustc_middle/src/ty/context.rs:1723:50
 118: rustc_rayon_core::tlv::with
             at /home/joshua/.local/lib/cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.3.0/src/tlv.rs:19:5
 119: rustc_middle::ty::context::tls::set_tlv
             at ./compiler/rustc_middle/src/ty/context.rs:1681:9
 120: rustc_middle::ty::context::tls::enter_context
             at ./compiler/rustc_middle/src/ty/context.rs:1723:9
 121: rustc_interface::util::handle_deadlock::{{closure}}
             at ./compiler/rustc_interface/src/util.rs:177:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```

</details>

```
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.52.0-dev running on x86_64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z emit-future-incompat-report -C prefer-dynamic -C rpath -C debuginfo=0

query stack during panic:
end of query stack
deadlock handler panicked, aborting process

------------------------------------------
```