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

save-analysis: ICE when name resolution fails #37126

Closed
nrc opened this issue Oct 12, 2016 · 2 comments
Closed

save-analysis: ICE when name resolution fails #37126

nrc opened this issue Oct 12, 2016 · 2 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@nrc
Copy link
Member

nrc commented Oct 12, 2016

STR: run with -Zsave-analysis on a program with a name resolution error. Result:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:323
stack backtrace:
   1:        0x10608efe8 - std::sys::backtrace::tracing::imp::write::he09d58d1497100a9
   2:        0x106096faf - std::panicking::default_hook::{{closure}}::hf3f7aa526824ae88
   3:        0x1060952e5 - std::panicking::default_hook::h691f7ee16f920a74
   4:        0x106095a06 - std::panicking::rust_panic_with_hook::haa794968064098e8
   5:        0x1060958a4 - std::panicking::begin_panic::h78b83f343fc429be
   6:        0x1060957c2 - std::panicking::begin_panic_fmt::h8b3207332f403a68
   7:        0x106095727 - rust_begin_unwind
   8:        0x1060c3af0 - core::panicking::panic_fmt::h5cca666ac160c125
   9:        0x1060c39f4 - core::panicking::panic::h30a00c8dd89101b4
  10:        0x10471f109 - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, D> as syntax::visit::Visitor>::visit_expr::h163cde99c278fc43
  11:        0x1046f10ce - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, D>>::process_method::h04468bf911ce2542
  12:        0x104701439 - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, D>>::process_impl_item::h4e762d98295a5e48
  13:        0x104705074 - <rustc_save_analysis::dump_visitor::DumpVisitor<'l, 'tcx, 'll, D> as syntax::visit::Visitor>::visit_item::h02ded85bb6033cf8
  14:        0x1047327aa - rustc_save_analysis::process_crate::he5e07bdf3c6cb726
  15:        0x103bed73b - <rustc_driver::RustcDefaultCalls as rustc_driver::CompilerCalls<'a>>::build_controller::{{closure}}::{{closure}}::hbf39625416cfff33
  16:        0x103bf2071 - <rustc_driver::RustcDefaultCalls as rustc_driver::CompilerCalls<'a>>::build_controller::{{closure}}::h858ba59f1e3b27b9
  17:        0x103bee6df - rustc_driver::driver::compile_input::{{closure}}::h273cad8b7f8d1024
  18:        0x103be7813 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h7ce10fd09281598f
  19:        0x103bb5036 - rustc_driver::driver::phase_3_run_analysis_passes::he8ee46117275842d
  20:        0x103ba2f9a - rustc_driver::driver::compile_input::h0271fc4a3333b327
  21:        0x103bc98e9 - rustc_driver::run_compiler::h1315ba568dec0ab8
  22:        0x1036be10d - rls::build::BuildQueue::rustc::{{closure}}::{{closure}}::h66962e2240eaa638
  23:        0x1036bd8ca - rustc_driver::run::{{closure}}::h6946deb7d8e0395b
  24:        0x1036be2c3 - rustc_driver::monitor::{{closure}}::hd1ab9dd35d21c63f
  25:        0x10365457b - <std::panic::AssertUnwindSafe<F> as core::ops::FnOnce<()>>::call_once::ha448607329ef3916
  26:        0x1034bce26 - std::panicking::try::do_call::h4d4051ea56bb4a02
  27:        0x10609756a - __rust_maybe_catch_panic
  28:        0x1034bac10 - std::panicking::try::h8f6846036d1a2b63
  29:        0x1034ae735 - std::panic::catch_unwind::ha11e26ecdbf248e3
  30:        0x1036c32a1 - std::thread::Builder::spawn::{{closure}}::h6b4547929665b7b8
  31:        0x1035208a0 - <F as alloc::boxed::FnBox<A>>::call_box::h7d5e87dbc610ebb6
  32:        0x106094a54 - std::sys::thread::Thread::new::thread_start::h2d239c26e84b740e
  33:     0x7fff9a8bdaba - _pthread_body
  34:     0x7fff9a8bda06 - _pthread_start

cc rust-lang/rls#41 (bug manifests in the RLS)

@nrc nrc added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. A-tools E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Oct 12, 2016
@eulerdisk
Copy link
Contributor

I can take this. I already dug into librustc_save_analysis some time ago, I encountered the same bug when I was trying to write a refactoring tool.
To fix the issue, I have to remove all the span_bug around there, right ?

@nrc
Copy link
Member Author

nrc commented Oct 12, 2016

@eulerdisk great, thanks for digging in.

There's likely to be some span_bugs that don't need to be there, but it won't be quite as simple as just ripping them out. There will be some error condition that needs to be dealt with.

Manishearth added a commit to Manishearth/rust that referenced this issue Oct 26, 2016
save_analysis: Dump data only if get_path_data doesn't fail to resolve a path.

Solves rust-lang#37126

Dump data only if `get_path_data` doesn't fail to resolve a path.
`get_path_data` returns `None` when it have to deals with `Def::Err`, which is used as placeholder for a failed resolution.

Tell me if this is good enough, maybe I have to add some tests ?

r? @nrc
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Oct 26, 2016
save_analysis: Dump data only if get_path_data doesn't fail to resolve a path.

Solves rust-lang#37126

Dump data only if `get_path_data` doesn't fail to resolve a path.
`get_path_data` returns `None` when it have to deals with `Def::Err`, which is used as placeholder for a failed resolution.

Tell me if this is good enough, maybe I have to add some tests ?

r? @nrc
@bors bors closed this as completed in 88b031e Oct 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

No branches or pull requests

3 participants