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

Internal compiler error "node_id_to_type: no type for node" with save-analysis #37323

Closed
evestera opened this issue Oct 21, 2016 · 2 comments
Closed
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@evestera
Copy link

Compiling the code below with rustc point2.rs -Zsave-analysis resulted in an internal compiler error.

I've tried to minimize the code. Removing either the derive, the other two structs or fixing the lifetime error in NestedA makes the panic disappear.

Code

#[derive(Debug)]
struct Point {
}

struct NestedA<'a, 'b> {
    x: &'a NestedB<'b>
}

struct NestedB<'a> {
    x: &'a i32,
}

fn main() {
}

Output with backtrace

error[E0491]: in type `&'a mut NestedB<'b>`, reference has a longer lifetime than the data it references
 --> point2.rs:6:5
  |
6 |     x: &'a mut NestedB<'b>
  |     ^^^^^^^^^^^^^^^^^^^^^^
  |
note: the pointer is valid for the lifetime 'a as defined on the struct at 5:0
 --> point2.rs:5:1
  |
5 | struct NestedA<'a, 'b> {
  | ^
note: but the referenced data is only valid for the lifetime 'b as defined on the struct at 5:0
 --> point2.rs:5:1
  |
5 | struct NestedA<'a, 'b> {
  | ^

error: internal compiler error: ../src/librustc/ty/mod.rs:2097: node_id_to_type: no type for node `pat Point {  } (id=46)`

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: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', ../src/librustc_errors/lib.rs:656
stack backtrace:
   1:        0x106869608 - std::sys::backtrace::tracing::imp::write::h22f199c1dbb72ba2
   2:        0x106876f2f - std::panicking::default_hook::{{closure}}::h9a389c462b6a22dd
   3:        0x106874355 - std::panicking::default_hook::h852b4223c1c00c59
   4:        0x106874a76 - std::panicking::rust_panic_with_hook::hcd9d05f53fa0dafc
   5:        0x1067425da - std::panicking::begin_panic::h2f463d37998ebeba
   6:        0x10675294a - rustc_errors::Handler::bug::haca77c19c882b432
   7:        0x1036f72cc - rustc::session::opt_span_bug_fmt::{{closure}}::hfeb850fbe828b399
   8:        0x1036298c9 - rustc::session::opt_span_bug_fmt::h46e45438a860a75e
   9:        0x10362967a - rustc::session::bug_fmt::hde22f071bf5a80ea
  10:        0x1036ac0e5 - rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::node_id_to_type::h73d18361623a52d0
  11:        0x1032b8264 - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, D>>::process_pat::h3b459ce9f62d7503
  12:        0x103292ace - syntax::visit::walk_expr::h740e88e7b04dea4f
  13:        0x1032ae27e - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, D>>::process_method::h4f6b66158471b107
  14:        0x1032bcc29 - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, D>>::process_impl_item::h48d1756270c266fa
  15:        0x1032d49b5 - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, D> as syntax::visit::Visitor>::visit_item::hfd68472f19fd8d39
  16:        0x1032ee1ca - rustc_save_analysis::process_crate::h2b636e6f9af828ac
  17:        0x10272769b - <rustc_driver::RustcDefaultCalls as rustc_driver::CompilerCalls<'a>>::build_controller::{{closure}}::{{closure}}::hcab3ae4dff1970b7
  18:        0x10272c4a1 - <rustc_driver::RustcDefaultCalls as rustc_driver::CompilerCalls<'a>>::build_controller::{{closure}}::h146db60594d89824
  19:        0x102728b0f - rustc_driver::driver::compile_input::{{closure}}::h9162a2fa292aeb3f
  20:        0x10271c513 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h1928c4704cfe9c61
  21:        0x1026f0284 - rustc_driver::driver::phase_3_run_analysis_passes::he578df6b8805151c
  22:        0x1026d952a - rustc_driver::driver::compile_input::h5b63ccd49eeeb98b
  23:        0x102702789 - rustc_driver::run_compiler::h98c7274e7cb1d11d
  24:        0x102643558 - std::panicking::try::do_call::h99ed0da044e497c3
  25:        0x1068774ea - __rust_maybe_catch_panic
  26:        0x102661dcf - <F as alloc::boxed::FnBox<A>>::call_box::hbdd5a14cd8e33b97
  27:        0x106873624 - std::sys::thread::Thread::new::thread_start::h50b05608a499d2b2
  28:     0x7fff8e037059 - _pthread_body
  29:     0x7fff8e036fd6 - _pthread_start

Meta

rustc 1.14.0-nightly (16eeeac78 2016-10-18)
binary: rustc
commit-hash: 16eeeac783d2ede28e09f2a433c612dea309fe33
commit-date: 2016-10-18
host: x86_64-apple-darwin
release: 1.14.0-nightly
LLVM version: 3.9

Also occurs with stable (but exact output above is from nightly):

rustc 1.12.1 (d4f39402a 2016-10-19)
binary: rustc
commit-hash: d4f39402a0c2c2b94ec0375cd7f7f6d7918113cd
commit-date: 2016-10-19
host: x86_64-apple-darwin
release: 1.12.1
@sanxiyn sanxiyn added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Oct 29, 2016
@Mark-Simulacrum
Copy link
Member

This no longer ICEs, marking E-needstest.

@Mark-Simulacrum Mark-Simulacrum added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label May 15, 2017
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jun 22, 2017
Add tests for a few issues.

Fixes rust-lang#41998
Fixes rust-lang#38381
Fixes rust-lang#37515
Fixes rust-lang#37510
Fixes rust-lang#37508
Fixes rust-lang#37366
Fixes rust-lang#37323
Fixes rust-lang#37051
Fixes rust-lang#36839
Fixes rust-lang#35570
Fixes rust-lang#34373
Fixes rust-lang#34222

Certainly not all of the E-needstest issues right now, but I started to get bored.
bors added a commit that referenced this issue Jun 24, 2017
Add tests for a few issues.

Fixes #41998
Fixes #38381
Fixes #37515
Fixes #37510
Fixes #37366
Fixes #37323
Fixes #37051
Fixes #36839
Fixes #35570
Fixes #34373
Fixes #34222

Certainly not all of the E-needstest issues right now, but I started to get bored.
@neallester
Copy link

This error occurred for me when compiling the code in an intermediate state where I expected errors. It is still a small project so I checked in the offending code here:

neallester/danake-rs@aeb9b12

error: internal compiler error: src/librustc/ty/context.rs:438: node_id_to_type: no type for node unknown node (id=658)

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.21.0 (3b72af9 2017-10-09) running on x86_64-apple-darwin

note: run with RUST_BACKTRACE=1 for a backtrace

thread 'rustc' panicked at 'Box', src/librustc_errors/lib.rs:490:8
stack backtrace:
0: 0x107bb0843 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::h77f333888e74def2
1: 0x107bbd98a - std::panicking::default_hook::{{closure}}::he7cfcf7125dff55f
2: 0x107bbd488 - std::panicking::default_hook::h99f8c39c0e377395
3: 0x107bbfc52 - std::panicking::rust_panic_with_hook::he7ea255c9426c7e7
4: 0x1072a739b - std::panicking::begin_panic::haf3df08c6be89ef5
5: 0x1072c5478 - rustc_errors::Handler::bug::h88664a2426569a8d
6: 0x1066aefb6 - rustc::session::opt_span_bug_fmt::{{closure}}::h70bc5ff4d466eb30
7: 0x1066aeec8 - rustc::session::opt_span_bug_fmt::h9b3d2b1e40c2d9d1
8: 0x1066aeaba - rustc::session::bug_fmt::he6d493cd65933d84
9: 0x106733f40 - rustc::ty::context::TypeckTables::node_id_to_type::h1fabb423e4e9daa8
10: 0x10660d81f - rustc::infer::error_reporting::util::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::find_arg_with_anonymous_region::hb31e32d965fa9c09
11: 0x10660cf8d - rustc::infer::error_reporting::named_anon_conflict::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::try_report_named_anon_conflict::h11057e2672825f77
12: 0x106613d74 - rustc::infer::error_reporting::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::report_region_errors::h1288ce75e5542662
13: 0x106638181 - rustc::infer::InferCtxt::resolve_regions_and_report_errors::h0df175b45f4b7035
14: 0x102dfe5e2 - rustc_typeck::check::regionck::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::regionck_item::ha7f9b07f91b085c5
15: 0x102e2d95b - rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor::check_item_well_formed::hc26b58418628bbc6
16: 0x102e3bb9b - <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor<'a, 'tcx> as rustc::hir::intravisit::Visitor<'v>>::visit_item::h86a56b73b6bee1f4
17: 0x102eb060b - rustc_typeck::check_crate::{{closure}}::hc2369fc51e33f5b6
18: 0x102eac847 - rustc_typeck::check_crate::h842736f55396db88
19: 0x1027572a9 - rustc::ty::context::TyCtxt::create_and_enter::hdbcec4cf21790aac
20: 0x1027bd068 - rustc_driver::driver::compile_input::h276761261303a824
21: 0x1027d6001 - rustc_driver::run_compiler::h03969cb2784daa43
22: 0x10270a513 - std::sys_common::backtrace::__rust_begin_short_backtrace::h0727c2035f3a0c3d
23: 0x107bf23fc - __rust_maybe_catch_panic
24: 0x1027404ef - <F as alloc::boxed::FnBox>::call_box::h8e640fc7d974be98
25: 0x107bbc8eb - std::sys::imp::thread::Thread::new::thread_start::h48c72bb09587cbc3
26: 0x7fff52de46c0 - _pthread_body
27: 0x7fff52de456c - _pthread_start

error: Could not compile danake-rs.

To learn more, run the command again with --verbose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants