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 with the newest nightly in lower_ty_direct #60518

Closed
dovahcrow opened this issue May 3, 2019 · 8 comments · Fixed by #60527
Closed

ICE with the newest nightly in lower_ty_direct #60518

dovahcrow opened this issue May 3, 2019 · 8 comments · Fixed by #60527
Assignees
Labels
A-async-await Area: Async & Await A-frontend Area: frontend (errors, parsing and HIR) A-hir Area: The high-level intermediate representation (HIR) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dovahcrow
Copy link
Contributor

dovahcrow commented May 3, 2019

I was using nightly rust extensively for its async/await and specialization feature. After a recent update (nightly-2019-05-02), a new ICE introduced with following logs:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:347:21
stack backtrace:
   0:        0x110e581b3 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::h6365da97c1471e71
   1:        0x110e50892 - std::sys_common::backtrace::_print::h16aa04d49feca3fd
   2:        0x110e54756 - std::panicking::default_hook::{{closure}}::h9fc4c0be5c9ca44c
   3:        0x110e544ff - std::panicking::default_hook::h9f3e4e5508e6484c
   4:        0x10fd84862 - rustc::util::common::panic_hook::h4551d4322cc0be4e
   5:        0x110e54fb0 - std::panicking::rust_panic_with_hook::h297147e5cbed8f24
   6:        0x110e549fc - std::panicking::continue_panic_fmt::h3ae1ed03b6fbf85b
   7:        0x110e548e8 - rust_begin_unwind
   8:        0x110e7bda1 - core::panicking::panic_fmt::h92ee99ae8e2af121
   9:        0x110e7bce6 - core::panicking::panic::hb56cbf1700d827ce
  10:        0x10fb86454 - rustc::hir::lowering::LoweringContext::lower_ty_direct::h9ebc55904e648f31
  11:        0x10fb701f8 - <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::h653da98ee2e15104
  12:        0x10fa9a102 - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter::h736c20ebb9808f68
  13:        0x10fb8c4f5 - rustc::hir::lowering::LoweringContext::lower_fn_decl::h65e61c23b5e1db51
  14:        0x10fb97896 - rustc::hir::lowering::LoweringContext::lower_method_sig::hcc9e0b8d06e43390
  15:        0x10fb83948 - <rustc::hir::lowering::LoweringContext::lower_crate::ItemLowerer as syntax::visit::Visitor>::visit_impl_item::hf58ebdc514d497b2
  16:        0x10fc6b431 - syntax::visit::walk_item::h07763bacbb55de9b
  17:        0x10fb81e06 - <rustc::hir::lowering::LoweringContext::lower_crate::ItemLowerer as syntax::visit::Visitor>::visit_item::h0d167e58e23044e6
  18:        0x10fb81aab - <rustc::hir::lowering::LoweringContext::lower_crate::ItemLowerer as syntax::visit::Visitor>::visit_mod::hd9777ed3e1d08615
  19:        0x10fb80aa3 - rustc::hir::lowering::lower_crate::h0c5e238015c897e0
  20:        0x10cc0a276 - rustc::util::common::time::h348b235e44461401
  21:        0x10cb636e9 - rustc_interface::passes::BoxedResolver::access::{{closure}}::h5e3406b2f5a3ba63
  22:        0x10cbaf2a4 - rustc_interface::passes::configure_and_expand::{{closure}}::hab3456cc016f1063
  23:        0x10cb87880 - rustc_data_structures::box_region::PinnedGenerator<I,A,R>::access::h947d707adafbf1b3
  24:        0x10cbf43d2 - rustc_interface::queries::Query<T>::compute::h0c12b0325a8fa361
  25:        0x10cbf4f7e - rustc_interface::queries::Query<T>::compute::h419fdaafe2fe1061
  26:        0x10cbdffbb - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::prepare_outputs::h0b2ca183a9af9723
  27:        0x10c9b1141 - rustc_interface::interface::run_compiler_in_existing_thread_pool::h6a703186bc682b69
  28:        0x10ca29396 - std::thread::local::LocalKey<T>::with::h31807013e3f0179f
  29:        0x10c9f7ad5 - scoped_tls::ScopedKey<T>::set::h4a42df1285ef48d6
  30:        0x10ca24f42 - syntax::with_globals::h968f8ffc9c58c643
  31:        0x10c995988 - std::sys_common::backtrace::__rust_begin_short_backtrace::h209394f9599ce87a
  32:        0x110e645ee - __rust_maybe_catch_panic
  33:        0x10c9adea6 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h56573a7f40ae7fa3
  34:        0x110e3688d - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hc80e6bd391717f52
  35:        0x110e633ad - std::sys::unix::thread::Thread::new::thread_start::hfe8c382e207f42b7
  36:     0x7fff6444f304 - _pthread_body
  37:     0x7fff6445226e - _pthread_start

After a quick search it seems like this is the only unwrap in direct cause lower_ty_direct (stack frame 10).

I cannot share the code or produce a minimal case because the code base is rather big.

Minimal reproducing case

@Centril Centril added A-frontend Area: frontend (errors, parsing and HIR) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-nominated labels May 3, 2019
@jonas-schievink jonas-schievink added the A-hir Area: The high-level intermediate representation (HIR) label May 3, 2019
@dovahcrow
Copy link
Contributor Author

@Centril @jonas-schievink I've added the minimal case for reproducing. Hope that would help!

@jonas-schievink
Copy link
Contributor

Thanks! Looks like even this line is enough to trigger the ICE:

async fn foo(ws: impl Iterator<Item = ()>) {}

@dovahcrow
Copy link
Contributor Author

Another bug may be related: rustc complains you should have variable mut although it is already mut.

@jonas-schievink jonas-schievink added the A-async-await Area: Async & Await label May 3, 2019
@jonas-schievink
Copy link
Contributor

That's #60498 and should be fixed in the next nightly

@cramertj
Copy link
Member

cramertj commented May 3, 2019

cc @davidtwco it looks like the desugaring may have broken impl Trait in argument-position?

@davidtwco
Copy link
Member

Oops, sorry. I'll take a look.

@jonas-schievink
Copy link
Contributor

Denominating since @davidtwco already has a fix

@dovahcrow
Copy link
Contributor Author

@davidtwco @jonas-schievink Thanks guys! This is a super fast fix!

Centril added a commit to Centril/rust that referenced this issue May 4, 2019
Fix async fn lowering ICE with APIT.

Fixes rust-lang#60518.

This PR fixes an ICE where simple bindings (which aren't replaced with replacement arguments during async fn lowering) were not being visited in the def collector and thus caused an ICE during HIR lowering for types that use their `DefId` at that point - such as `impl Trait`.

r? @cramertj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await A-frontend Area: frontend (errors, parsing and HIR) A-hir Area: The high-level intermediate representation (HIR) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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