-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Rustc overflow its stack when using impl Trait and the struct containing the function itself #69096
Comments
Infinite loop I think: (gdb) bt
#0 0x00007ffff6966e15 in hashbrown::map::RawEntryBuilder<K,V,S>::from_key_hashed_nocheck () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-154376714aaee7fe.so
#1 0x00007ffff6d36f5e in rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-154376714aaee7fe.so
#2 0x00007ffff6a6a0c3 in rustc::ty::structural_impls::fold_list () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-154376714aaee7fe.so
#3 0x00007ffff6d00036 in rustc::ty::normalize_erasing_regions::<impl rustc::ty::context::TyCtxt>::normalize_erasing_late_bound_regions () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-154376714aaee7fe.so
#4 0x00007ffff6fd048a in rustc::ty::print::obsolete::DefPathBasedNames::push_type_name () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-154376714aaee7fe.so
#5 0x00007ffff6fd2d39 in rustc::ty::print::obsolete::DefPathBasedNames::push_generic_params () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-154376714aaee7fe.so
#6 0x00007ffff6fd1739 in rustc::ty::print::obsolete::DefPathBasedNames::push_type_name () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-154376714aaee7fe.so
#7 0x00007ffff6fd2d39 in rustc::ty::print::obsolete::DefPathBasedNames::push_generic_params () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-154376714aaee7fe.so
#8 0x00007ffff6fd1739 in rustc::ty::print::obsolete::DefPathBasedNames::push_type_name () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-154376714aaee7fe.so
#9 0x00007ffff6fd2d39 in rustc::ty::print::obsolete::DefPathBasedNames::push_generic_params () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-154376714aaee7fe.so
...
#182017 0x00007ffff6eddcce in rustc::ty::print::obsolete::DefPathBasedNames::push_type_name () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182018 0x00007ffff6eded19 in rustc::ty::print::obsolete::DefPathBasedNames::push_generic_params () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182019 0x00007ffff50016fc in <rustc_target::abi::TyLayout<&rustc::ty::TyS> as rustc_codegen_llvm::type_of::LayoutLlvmExt>::llvm_type () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182020 0x00007ffff4eb5188 in rustc_codegen_ssa::mir::operand::OperandRef<V>::new_zst () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182021 0x00007ffff4fbd16d in rustc_codegen_ssa::mir::codegen_mir::{{closure}} () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182022 0x00007ffff4fe5216 in <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182023 0x00007ffff4fb23f2 in <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182024 0x00007ffff4fbc205 in rustc_codegen_ssa::mir::codegen_mir () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182025 0x00007ffff4ef2bfc in <rustc::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182026 0x00007ffff4e6859a in rustc_codegen_llvm::base::compile_codegen_unit::module_codegen () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182027 0x00007ffff4f1c8b0 in rustc::dep_graph::graph::DepGraph::with_task () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182028 0x00007ffff4e68164 in rustc_codegen_llvm::base::compile_codegen_unit () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182029 0x00007ffff4fec61f in rustc_codegen_ssa::base::codegen_crate () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182030 0x00007ffff4f297b5 in <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182031 0x00007ffff4deeccc in rustc_interface::passes::QueryContext::enter () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182032 0x00007ffff4d120bb in rustc_interface::queries::Queries::ongoing_codegen () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182033 0x00007ffff4bae7d3 in rustc_interface::interface::run_compiler_in_existing_thread_pool () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182034 0x00007ffff4b664bd in scoped_tls::ScopedKey<T>::set () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182035 0x00007ffff4bd3414 in syntax::attr::with_globals () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182036 0x00007ffff4b9df10 in std::sys_common::backtrace::__rust_begin_short_backtrace () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182037 0x00007ffff44ece67 in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:86
#182038 0x00007ffff4bb0c36 in core::ops::function::FnOnce::call_once{{vtable-shim}} () from /home/lzutao/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-d8719fb60c037747.so
#182039 0x00007ffff44b846f in <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once () at /rustc/a1912f2e89b77cfe2a0e64b96f444848fe4e2d49/src/liballoc/boxed.rs:1017
#182040 0x00007ffff44eb770 in <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once () at /rustc/a1912f2e89b77cfe2a0e64b96f444848fe4e2d49/src/liballoc/boxed.rs:1017
#182041 std::sys_common::thread::start_thread () at src/libstd/sys_common/thread.rs:13
#182042 std::sys::unix::thread::Thread::new::thread_start () at src/libstd/sys/unix/thread.rs:80
#182043 0x00007ffff4433fa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
#182044 0x00007ffff43534cf in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) |
This comment has been minimized.
This comment has been minimized.
@rustbot ping icebreakers-cleanup-crew There is already a minimal example here, but it'd be great to figure out the PR (or at least nightly) that caused it regress. |
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good cc @AminArria @chrissimpkins @DutchGhost @ethanboxx @h-michael @HallerPatrick @hdhoang @hellow554 @matheus-consoli @mental32 @Noah-Kennedy @pard68 @pierreN @robjtede @senden9 @shekohex @sinato @spastorino @turboladen @woshilapin @yerke |
Tagging as P-high since this is a regression, though it might be considered P-medium otherwise (not an active soundness hole, for example). |
Looks like this is in More specifically, it looks like it's overflowing the stack while trying to generate a name for a LLVM type. cc @rust-lang/wg-codegen Should we make LLVM type names respect |
Yes, the whole point of this option is to produce as lean LLVM-IR as possible -- to reduce the peak memory use first and foremost. This means no variable names, no label names and I don't see how type names are in any way unique here that would warrant keeping them. |
Edit: this appears to be an incorrect identification of a regression due to #69096 (comment). See @HallerPatrick comment in #69096 (comment)
cargo-bisect-rustc
I am seeing an |
That suggests that you're using a Cargo too new or somehow back-compat logic was removed (or never present?) in Cargo (not sure what our policy is). You need an older Cargo to go back past the addition of But also it would be nice if Cargo didn't need to be involved in the bisection process, because it IMO unnecessarily complicates it. |
|
So I tried to reproduce the overflow manually by going back to see where it firstly regressed, due to the rust-lang/cargo-bisect-rustc#49. But couldn't find a working build yet... The latest (youngest) build I tested now was 1.14.0-nightly, which is from 2016 and I was still able to reproduce the error. Had to add I don't think there is a build (nightly) that will compile this code correctly. ❯ rustc main.rs
Meta
|
@Centril Any chance you forgot to add |
@eddyb I copy pasted the code into godbolt so I didn't add |
Just checked, this is what that looks like: https://godbolt.org/z/vc3D35 PSA: seeing Making And it's the same on 1.26.0 (first stable w/ This fits with #69096 (comment), and I wish godbolt had nightly versions matching stable ones, or at least a way to pass env vars (because there's no real protection against abusing stable compilers). |
nominating for discussion as part of attempt to burn down set of unassigned P-high issues at an otherwise light triage meeting. |
discussed at T-compiler meeting. Reprioritizing as P-medium, since its not a true regression and not an active soundness hole. |
Triage: this now compiles and runs successfully. |
I tried this code:
Then I got
thread 'rustc' has overflowed its stack
.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: