crate with a minimized reproduction: crash_repr.tar.gz
Crash Report
I found a crash in what appears to be the analysis phase after a compilation error. I expected a normal error output, but instead rustc crashed.
Here is the output from rustc:
$ cargo build
Compiling crash_repr v0.1.0 (/home/john/crash_repr)
error[E0560]: struct `Wrapper` has no field named `a`
--> src/lib.rs:12:9
|
12 | a: (),
| ^ `Wrapper` does not have this field
error: internal compiler error: src/librustc/ty/context.rs:554: node_type: no type for node `expr Default::default (hir_id=HirId { owner: DefIndex(14), local_id: 6 })`
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:812:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
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.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0560`.
error: could not compile `crash_repr`.
To learn more, run the command again with --verbose.
Reproduction
I minimized the code to the following snippet. Comments do not appear to affect the outcome. However, the .. and the async syntax are both required to reproduce the crash.
// The definition of the struct does not appear to matter. I tried a
// tuple-struct, and a struct with many more fields. What appears to
// be important is that it does not have the field mentioned in the
// function below. The name of the struct does not appear to matter.
pub struct Wrapper;
// Without the async, rustc does not crash.
async fn go() {
Wrapper {
// Neither the field name nor the value matter as long as the
// field name does not actually appear in the struct.
a: (),
// Without the .., rustc does not crash.
..Default::default()
};
}
Rust Version Information
$ rustc --version --verbose
rustc 1.39.0 (4560ea788 2019-11-04)
binary: rustc
commit-hash: 4560ea788cb760f0a34127156c78e2552949f734
commit-date: 2019-11-04
host: x86_64-unknown-linux-gnu
release: 1.39.0
LLVM version: 9.0
Meta
Full output with RUST_BACKTRACE=1
$ RUST_BACKTRACE=1 cargo build
Compiling crash_repr v0.1.0 (/home/john/crash_repr)
error[E0560]: struct `Wrapper` has no field named `a`
--> src/lib.rs:12:9
|
12 | a: (),
| ^ `Wrapper` does not have this field
error: internal compiler error: src/librustc/ty/context.rs:554: node_type: no type for node `expr Default::default (hir_id=HirId { owner: DefIndex(14), local_id: 6 })`
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:812:9
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:76
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:60
4: core::fmt::write
at src/libcore/fmt/mod.rs:1030
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1412
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:64
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:196
9: std::panicking::default_hook
at src/libstd/panicking.rs:210
10: rustc_driver::report_ice
11: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:477
12: std::panicking::begin_panic
13: rustc_errors::HandlerInner::bug
14: rustc_errors::Handler::bug
15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
16: rustc::ty::context::tls::with_opt::{{closure}}
17: rustc::ty::context::tls::with_context_opt
18: rustc::ty::context::tls::with_opt
19: rustc::util::bug::opt_span_bug_fmt
20: rustc::util::bug::bug_fmt
21: rustc::ty::context::TypeckTables::node_type::{{closure}}
22: rustc::ty::context::TypeckTables::expr_ty
23: <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr
24: rustc::hir::intravisit::walk_expr
25: <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr
26: <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr
27: rustc::hir::intravisit::walk_expr
28: <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr
29: <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr
30: <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr
31: rustc_typeck::check::generator_interior::resolve_interior
32: rustc_typeck::check::FnCtxt::resolve_generator_interiors
33: rustc::ty::context::GlobalCtxt::enter_local
34: rustc_typeck::check::typeck_tables_of
35: rustc::ty::query::__query_compute::typeck_tables_of
36: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
37: rustc::dep_graph::graph::DepGraph::with_task_impl
38: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
39: rustc::ty::query::__query_compute::typeck_tables_of
40: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
41: rustc::dep_graph::graph::DepGraph::with_task_impl
42: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
43: rustc_typeck::collect::checked_type_of
44: rustc_typeck::collect::type_of
45: rustc::ty::query::__query_compute::type_of
46: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
47: rustc::dep_graph::graph::DepGraph::with_task_impl
48: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
49: rustc::hir::intravisit::walk_expr
50: rustc::hir::intravisit::Visitor::visit_fn
51: rustc::hir::intravisit::walk_item
52: <rustc_typeck::collect::CollectItemTypesVisitor as rustc::hir::intravisit::Visitor>::visit_item
53: rustc::hir::map::Map::visit_item_likes_in_module
54: rustc_typeck::collect::collect_mod_item_types
55: rustc::ty::query::__query_compute::collect_mod_item_types
56: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_mod_item_types>::compute
57: rustc::dep_graph::graph::DepGraph::with_task_impl
58: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
59: rustc_typeck::check_crate::{{closure}}::{{closure}}
60: rustc::util::common::time
61: rustc_typeck::check_crate
62: rustc_interface::passes::analysis
63: rustc::ty::query::__query_compute::analysis
64: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
65: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
66: rustc_interface::passes::create_global_ctxt::{{closure}}
67: rustc_interface::interface::run_compiler_in_existing_thread_pool
68: std::thread::local::LocalKey<T>::with
69: scoped_tls::ScopedKey<T>::set
70: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
thread 'rustc' panicked at 'already borrowed: BorrowMutError', src/libcore/result.rs:1165:5
stack backtrace:
0: 0x7f60a65b0af4 - backtrace::backtrace::libunwind::trace::hda41dbcdfba36aa0
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
1: 0x7f60a65b0af4 - backtrace::backtrace::trace_unsynchronized::h1a8d6e1f8cb3f5d4
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
2: 0x7f60a65b0af4 - std::sys_common::backtrace::_print_fmt::h610c4127487e10da
at src/libstd/sys_common/backtrace.rs:76
3: 0x7f60a65b0af4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0722dc552e01bd1d
at src/libstd/sys_common/backtrace.rs:60
4: 0x7f60a65e912c - core::fmt::write::h01edf6dd68a42c9c
at src/libcore/fmt/mod.rs:1030
5: 0x7f60a65a4d17 - std::io::Write::write_fmt::hf15985f193f03c04
at src/libstd/io/mod.rs:1412
6: 0x7f60a65b5325 - std::sys_common::backtrace::_print::hd8d5d08a1795e743
at src/libstd/sys_common/backtrace.rs:64
7: 0x7f60a65b5325 - std::sys_common::backtrace::print::hf89a79e3921a2366
at src/libstd/sys_common/backtrace.rs:49
8: 0x7f60a65b5325 - std::panicking::default_hook::{{closure}}::h3a8f42beb3bb8ae3
at src/libstd/panicking.rs:196
9: 0x7f60a65b5016 - std::panicking::default_hook::h8f803b0bc31a5c37
at src/libstd/panicking.rs:210
10: 0x7f60a6aec483 - rustc_driver::report_ice::he98718c53edc6d3d
11: 0x7f60a65b5b0c - std::panicking::rust_panic_with_hook::h825f041245da8739
at src/libstd/panicking.rs:477
12: 0x7f60a65b55c2 - std::panicking::continue_panic_fmt::hbe0378e33481e81b
at src/libstd/panicking.rs:380
13: 0x7f60a65b54b6 - rust_begin_unwind
at src/libstd/panicking.rs:307
14: 0x7f60a65e2aca - core::panicking::panic_fmt::h527855ce0bc891f6
at src/libcore/panicking.rs:85
15: 0x7f60a65e2d07 - core::result::unwrap_failed::ha8b77e6004f0ba38
at src/libcore/result.rs:1165
16: 0x7f60a88c7fe5 - rustc_errors::Handler::force_print_diagnostic::h807dd1aae3e0d79e
17: 0x7f60a819ad91 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::try_print_query_stack::h8734d6360e0a8b59
18: 0x7f60a6aed095 - rustc_driver::report_ice::he98718c53edc6d3d
19: 0x7f60a65b5b0c - std::panicking::rust_panic_with_hook::h825f041245da8739
at src/libstd/panicking.rs:477
20: 0x7f60a88af37d - std::panicking::begin_panic::h577649efa65d7301
21: 0x7f60a88c8743 - rustc_errors::HandlerInner::bug::hfd27cc932b37506a
22: 0x7f60a88c762a - rustc_errors::Handler::bug::h32e2ca63254dbbec
23: 0x7f60a81578c3 - rustc::util::bug::opt_span_bug_fmt::{{closure}}::hf2652d3cbc7068ac
24: 0x7f60a8152933 - rustc::ty::context::tls::with_opt::{{closure}}::h0fe4f06c0a285fde
25: 0x7f60a81528a3 - rustc::ty::context::tls::with_context_opt::h01f88b941c2d3d77
26: 0x7f60a81528e7 - rustc::ty::context::tls::with_opt::hac6f601ca34cd941
27: 0x7f60a81577d8 - rustc::util::bug::opt_span_bug_fmt::h234c815c9e7b30ef
28: 0x7f60a8157742 - rustc::util::bug::bug_fmt::hca65a18e8bb5d55b
29: 0x7f60a834f19d - rustc::ty::context::TypeckTables::node_type::{{closure}}::hbd677482db99a561
30: 0x7f60a834f78e - rustc::ty::context::TypeckTables::expr_ty::hc093e7b1125d2348
31: 0x7f60a7214a25 - <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr::hbd631eae25763dcd
32: 0x7f60a7237095 - rustc::hir::intravisit::walk_expr::h5c9f1d3c8413c8a0
33: 0x7f60a7214967 - <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr::hbd631eae25763dcd
34: 0x7f60a7214967 - <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr::hbd631eae25763dcd
35: 0x7f60a723727f - rustc::hir::intravisit::walk_expr::h5c9f1d3c8413c8a0
36: 0x7f60a7214967 - <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr::hbd631eae25763dcd
37: 0x7f60a7214967 - <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr::hbd631eae25763dcd
38: 0x7f60a7214967 - <rustc_typeck::check::generator_interior::InteriorVisitor as rustc::hir::intravisit::Visitor>::visit_expr::hbd631eae25763dcd
39: 0x7f60a7214029 - rustc_typeck::check::generator_interior::resolve_interior::ha530cf97fcf25c6e
40: 0x7f60a70776dc - rustc_typeck::check::FnCtxt::resolve_generator_interiors::hb97defff881a87da
41: 0x7f60a71e38ae - rustc::ty::context::GlobalCtxt::enter_local::hee87012a37ec7481
42: 0x7f60a7069ea2 - rustc_typeck::check::typeck_tables_of::h7e98a74ad7491971
43: 0x7f60a70bb4ca - rustc::ty::query::__query_compute::typeck_tables_of::h8235d6e55b8e3584
44: 0x7f60a715515b - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute::hef02a238f3e43402
45: 0x7f60a70f9cc2 - rustc::dep_graph::graph::DepGraph::with_task_impl::hd911b0f10264fdeb
46: 0x7f60a71d4551 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hfde020d3574d1a10
47: 0x7f60a70bb4ca - rustc::ty::query::__query_compute::typeck_tables_of::h8235d6e55b8e3584
48: 0x7f60a715515b - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute::hef02a238f3e43402
49: 0x7f60a70f9cc2 - rustc::dep_graph::graph::DepGraph::with_task_impl::hd911b0f10264fdeb
50: 0x7f60a71d4551 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hfde020d3574d1a10
51: 0x7f60a721a0ae - rustc_typeck::collect::checked_type_of::hd3908c8eaed72ecd
52: 0x7f60a72197dc - rustc_typeck::collect::type_of::h799e995bf65f21ec
53: 0x7f60a70bd0b7 - rustc::ty::query::__query_compute::type_of::hb01507aa4b57e392
54: 0x7f60a7154e5b - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute::hd6cd78f07fee48ed
55: 0x7f60a70f7052 - rustc::dep_graph::graph::DepGraph::with_task_impl::hbdb7bb8db373711b
56: 0x7f60a7164a04 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h0ad13fb369585832
57: 0x7f60a7238bf0 - rustc::hir::intravisit::walk_expr::hf4b6465856d88960
58: 0x7f60a71f8f2c - rustc::hir::intravisit::Visitor::visit_fn::hd86c16bc3957ea4d
59: 0x7f60a723b2f9 - rustc::hir::intravisit::walk_item::h2499ad75ffa206ec
60: 0x7f60a721575d - <rustc_typeck::collect::CollectItemTypesVisitor as rustc::hir::intravisit::Visitor>::visit_item::h6ecf11c5154ce45d
61: 0x7f60a70c0103 - rustc::hir::map::Map::visit_item_likes_in_module::h6cf58cf1c61058c9
62: 0x7f60a7215424 - rustc_typeck::collect::collect_mod_item_types::ha8af4c2694cae051
63: 0x7f60a70bc44a - rustc::ty::query::__query_compute::collect_mod_item_types::h0959d140ce4a445c
64: 0x7f60a715534b - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::collect_mod_item_types>::compute::hcc8bedd87b11d3e0
65: 0x7f60a70e8f57 - rustc::dep_graph::graph::DepGraph::with_task_impl::h1149bcd7b6e6f8f9
66: 0x7f60a71771f8 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::h1ad8f3fe22fc6341
67: 0x7f60a70e023d - rustc_typeck::check_crate::{{closure}}::{{closure}}::hef852192e4b21571
68: 0x7f60a70c0766 - rustc::util::common::time::h6c804872fd5ef88f
69: 0x7f60a72903fc - rustc_typeck::check_crate::h2e77f97476aecad8
70: 0x7f60a6b9b00a - rustc_interface::passes::analysis::h7d37d49a7360493d
71: 0x7f60a6aaec01 - rustc::ty::query::__query_compute::analysis::h1c5cc76ea5bb496b
72: 0x7f60a6a97322 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query::hcf7bc9d073dcb36b
73: 0x7f60a6ab642a - rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}::h7fc0f9f179325408
74: 0x7f60a6c171da - rustc_interface::passes::create_global_ctxt::{{closure}}::h10595b15ffb5db35
75: 0x7f60a6ab864e - rustc_interface::interface::run_compiler_in_existing_thread_pool::ha009ae4607895a11
76: 0x7f60a6aee362 - std::thread::local::LocalKey<T>::with::h30eaff0b6e71bc49
77: 0x7f60a6af33ce - scoped_tls::ScopedKey<T>::set::h6ab0051cc42102a7
78: 0x7f60a6b141a2 - syntax::with_globals::h9994c1c3242d3263
79: 0x7f60a6a80e10 - std::sys_common::backtrace::__rust_begin_short_backtrace::h229c554686840b66
80: 0x7f60a65c625a - __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:80
81: 0x7f60a6aaa879 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hf2e117c529f2753f
82: 0x7f60a65971ff - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h483711add4ba2330
at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/boxed.rs:922
83: 0x7f60a65c4f00 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h7605b45eb29ed0be
at /rustc/4560ea788cb760f0a34127156c78e2552949f734/src/liballoc/boxed.rs:922
84: 0x7f60a65c4f00 - std::sys_common::thread::start_thread::h557b0c2dc4449562
at src/libstd/sys_common/thread.rs:13
85: 0x7f60a65c4f00 - std::sys::unix::thread::Thread::new::thread_start::h7c2a7f9b68fe4bba
at src/libstd/sys/unix/thread.rs:79
86: 0x7f60a6518669 - start_thread
87: 0x7f60a642d323 - clone
88: 0x0 - <unknown>
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.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
thread panicked while processing panic. aborting.
error: could not compile `crash_repr`.
Caused by:
process didn't exit successfully: `rustc --edition=2018 --crate-name crash_repr src/lib.rs --color always --crate-type lib --emit=dep-info,metadata,link -C debuginfo=2 -C metadata=60fd5d8552c78790 -C extra-filename=-60fd5d8552c78790 --out-dir /home/john/crash_repr/target/debug/deps -C incremental=/home/john/crash_repr/target/debug/incremental -L dependency=/home/john/crash_repr/target/debug/deps` (signal: 4, SIGILL: illegal instruction)
crate with a minimized reproduction: crash_repr.tar.gz
Crash Report
I found a crash in what appears to be the analysis phase after a compilation error. I expected a normal error output, but instead rustc crashed.
Here is the output from rustc:
Reproduction
I minimized the code to the following snippet. Comments do not appear to affect the outcome. However, the
..and theasyncsyntax are both required to reproduce the crash.Rust Version Information
Meta
Full output with
RUST_BACKTRACE=1