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

compiler hangs trying to print an overflow error #83150

Closed
Neutron3529 opened this issue Mar 15, 2021 · 10 comments · Fixed by #83406
Closed

compiler hangs trying to print an overflow error #83150

Neutron3529 opened this issue Mar 15, 2021 · 10 comments · Fixed by #83406
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-traits Area: Trait system C-bug Category: This is a bug. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Neutron3529
Copy link
Contributor

I tried this code:

fn main(){
  let mut iter=0u8..1;
  println!("begin");
  func(&mut iter)
}
fn func<T:Iterator<Item=u8>>(iter:&mut T){
    if let Some(x)=iter.next(){
        println!("{}",x);
        func(&mut iter.map(|x|x+1))
    }
}

I expected to see this happen:

program either compiled successful or compiler generate an error

Instead, this happened:
rustc eats 100% CPU for several minutes, but nothing generated.
I compile this code using both
rustc testxx.rs -C opt-level=3 -C target-cpu=native -C codegen-units=1 -C lto -o testxx andrustc testxx.rs -C opt-level=0 -o testxx before I began to write this issue, but compiler do not compile even after this issue is submitted.

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (152f66092 2021-02-17)
binary: rustc
commit-hash: 152f6609246558be5e2582e67376194815e6ba0d
commit-date: 2021-02-17
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1
Backtrace

(cannot compile)

@Neutron3529 Neutron3529 added the C-bug Category: This is a bug. label Mar 15, 2021
@jonas-schievink jonas-schievink added I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 15, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 15, 2021

Slightly smaller:

fn main() {
    func(0..1)
}

fn func<T: Iterator<Item=u8>>(iter: T) {
    func(iter.map(|x| x+1))
}

@jyn514 jyn514 added the A-traits Area: Trait system label Mar 15, 2021
@Neutron3529
Copy link
Contributor Author

Slightly smaller:

fn main() {
    func(0..1)
}

fn func<T: Iterator<Item=u8>>(iter: T) {
    func(iter.map(|x| x+1))
}

Actually, I am very curious that, why rustc do not reach the recursion limit.

@jyn514
Copy link
Member

jyn514 commented Mar 15, 2021

Actually, I am very curious that, why rustc do not reach the recursion limit.

Oh sorry, you're right, it does hit the recursion limit if I let it run long enough (about 10 seconds).

@jyn514
Copy link
Member

jyn514 commented Mar 15, 2021

Here's a proper minimization:

fn main() {
    let mut iter = 0u8..1;
    func(&mut iter)
}

fn func<T: Iterator<Item = u8>>(iter: &mut T) {
    func(&mut iter.map(|x| x + 1))
}

@jyn514
Copy link
Member

jyn514 commented Mar 15, 2021

Partial backtrace of the hang:

Thread 2 (Thread 0x7fffedfff700 (LWP 55584)):
#0  0x00007ffff6db86e9 in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#1  0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#2  0x00007ffff6dc1eb9 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#3  0x00007ffff6db8719 in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#4  0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#5  0x00007ffff6dc1eb9 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#6  0x00007ffff6db8719 in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#7  0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#8  0x00007ffff6dc1eb9 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#9  0x00007ffff6db8719 in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#10 0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/----Type <RET> for more, q to quit, c to continue without paging--
.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#11 0x00007ffff6db8719 in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#12 0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#13 0x00007ffff6db874e in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#14 0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#15 0x00007ffff6dc1eb9 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#16 0x00007ffff6db8719 in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#17 0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#18 0x00007ffff6db8719 in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#19 0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#20 0x00007ffff6db874e in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#21 0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#22 0x00007ffff6dc1eb9 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
... snip ...
#192 0x00007ffff6db8719 in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#193 0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#194 0x00007ffff6dc1eb9 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#195 0x00007ffff6db8719 in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#196 0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#197 0x00007ffff6dc1eb9 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#198 0x00007ffff6db8719 in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#199 0x00007ffff6dc1e83 in rustc_middle::ty::structural_impls::<impl rustc_middle::ty::fold::TypeFoldable for &rustc_middle::ty::TyS>::super_visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#200 0x00007ffff6db8719 in <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#201 0x00007ffff57b5c0d in rustc_middle::ty::fold::TypeFoldable::visit_with () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#202 0x00007ffff5897c12 in <rustc_middle::ty::print::pretty::FmtPrinter<F> as rustc_middle::ty::print::pretty::PrettyPrinter>::in_binder () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#203 0x00007ffff57b8243 in rustc_middle::ty::print::pretty::<impl core::fmt::Display for rustc_middle::ty::sty::Binder<rustc_middle::ty::TraitPredicate>>::fmt () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#204 0x00007ffff3f2e4bf in core::fmt::write () at library/core/src/fmt/mod.rs:1092
#205 0x00007ffff3f20bbc in core::fmt::Write::write_fmt () at /rustc/3a5d45f68cadc8fff4fbb557780f92b403b19c19/library/core/src/fmt/mod.rs:182
#206 alloc::fmt::format () at library/alloc/src/fmt.rs:578
#207 0x00007ffff5666239 in <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtExt>::report_overflow_error () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#208 0x00007ffff62ee891 in rustc_trait_selection::traits::select::SelectionContext::evaluate_predicate_recursively () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#209 0x00007ffff62e0e2c in rustc_trait_selection::traits::select::SelectionContext::evaluate_predicates_recursively () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#210 0x00007ffff62af29b in rustc_infer::infer::InferCtxt::probe () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#211 0x00007ffff62ee96a in rustc_trait_selection::traits::select::SelectionContext::evaluate_candidate () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#212 0x00007ffff62e1dad in rustc_trait_selection::traits::select::SelectionContext::evaluate_stack () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#213 0x00007ffff62f1edb in rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#214 0x00007ffff62e1470 in rustc_trait_selection::traits::select::SelectionContext::evaluate_trait_predicate_recursively () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#215 0x00007ffff62ff08a in rustc_data_structures::stack::ensure_sufficient_stack () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#216 0x00007ffff62ee702 in rustc_trait_selection::traits::select::SelectionContext::evaluate_predicate_recursively () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#217 0x00007ffff62af592 in rustc_infer::infer::InferCtxt::probe () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#218 0x00007ffff62e0d50 in rustc_trait_selection::traits::select::SelectionContext::evaluate_root_obligation () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#219 0x00007ffff62b5259 in <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#220 0x00007ffff62bd4ba in rustc_trait_selection::traits::fulfill::FulfillProcessor::process_trait_obligation () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#221 0x00007ffff62bc271 in rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#222 0x00007ffff62d2a84 in rustc_data_structures::obligation_forest::ObligationForest<O>::process_obligations () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#223 0x00007ffff62bbd96 in <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#224 0x00007ffff62bbba0 in <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_all_or_error () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#225 0x00007ffff62db3cb in rustc_trait_selection::traits::codegen::drain_fulfillment_cx_or_panic () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#226 0x00007ffff62aa51f in rustc_infer::infer::InferCtxtBuilder::enter () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#227 0x00007ffff62db34e in rustc_trait_selection::traits::codegen::codegen_fulfill_obligation () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#228 0x00007ffff5dea756 in rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::codegen_fulfill_obligation>::compute () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#229 0x00007ffff5e17076 in rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#230 0x00007ffff5dec20a in rustc_data_structures::stack::ensure_sufficient_stack () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#231 0x00007ffff5dc614a in rustc_query_system::query::plumbing::force_query_with_job () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#232 0x00007ffff5dc3e11 in rustc_query_system::query::plumbing::get_query_impl () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#233 0x00007ffff5e1f580 in <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::codegen_fulfill_obligation () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#234 0x00007ffff5b1d415 in rustc_ty_utils::instance::inner_resolve_instance () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#235 0x00007ffff5b1c518 in rustc_ty_utils::instance::resolve_instance () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#236 0x00007ffff5deb021 in rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::resolve_instance>::compute () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#237 0x00007ffff5e08a3c in rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#238 0x00007ffff5def8a3 in rustc_data_structures::stack::ensure_sufficient_stack () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#239 0x00007ffff5dce715 in rustc_query_system::query::plumbing::force_query_with_job () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#240 0x00007ffff5dba9d7 in rustc_query_system::query::plumbing::get_query_impl () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#241 0x00007ffff5e2075d in <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::resolve_instance () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#242 0x00007ffff640b4a2 in rustc_middle::ty::instance::Instance::resolve_opt_const_arg () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#243 0x00007ffff640967d in rustc_middle::ty::instance::Instance::resolve () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#244 0x00007ffff5f85350 in <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_terminator () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#245 0x00007ffff5f8816c in rustc_mir::monomorphize::collector::collect_neighbours () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#246 0x00007ffff5f82638 in rustc_mir::monomorphize::collector::collect_items_rec () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
... snip ...
#310 0x00007ffff5f82795 in rustc_mir::monomorphize::collector::collect_items_rec () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#311 0x00007ffff5f82795 in rustc_mir::monomorphize::collector::collect_items_rec () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#312 0x00007ffff6a7e95f in rustc_session::utils::<impl rustc_session::session::Session>::time () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#313 0x00007ffff6a6e39f in rustc_mir::monomorphize::collector::collect_crate_mono_items () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#314 0x00007ffff6a9f041 in rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#315 0x00007ffff68ec006 in rustc_query_impl::<impl rustc_query_system::query::config::QueryAccessors<rustc_query_impl::plumbing::QueryCtxt> for rustc_query_impl::queries::collect_and_partition_mono_items>::compute () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#316 0x00007ffff6951626 in rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#317 0x00007ffff68fc6a3 in rustc_data_structures::stack::ensure_sufficient_stack () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#318 0x00007ffff68b89bd in rustc_query_system::query::plumbing::force_query_with_job () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#319 0x00007ffff6892079 in rustc_query_system::query::plumbing::get_query_impl () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#320 0x00007ffff69843d8 in <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#321 0x00007ffff653911b in <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#322 0x00007ffff64d1bd1 in rustc_interface::passes::QueryContext::enter () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#323 0x00007ffff64dac26 in rustc_interface::queries::Queries::ongoing_codegen () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#324 0x00007ffff64935a8 in rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#325 0x00007ffff6492157 in rustc_span::with_source_map () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#326 0x00007ffff649450a in rustc_interface::interface::create_compiler_and_run () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so
#327 0x00007ffff64927ef in rustc_span::with_session_globals () from /home/joshua/.local/lib/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-09db1e0bb03ea14e.so

@jyn514 jyn514 added the A-diagnostics Area: Messages for errors, warnings, and lints label Mar 15, 2021
@jyn514
Copy link
Member

jyn514 commented Mar 15, 2021

So it actually hangs while trying to print the overflow error 😆

@jyn514 jyn514 changed the title compiler hangs with generics compiler hangs trying to print an overflow error Mar 15, 2021
@JohnTitor JohnTitor added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 15, 2021
@hameerabbasi
Copy link
Contributor

Bisected:

********************************************************************************
Regression in nightly-2020-09-19
********************************************************************************

fetching https://static.rust-lang.org/dist/2020-09-18/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2020-09-18: 40 B / 40 B [===============] 100.00 % 696.29 KB/s converted 2020-09-18 to f3c923a13a458c35ee26b3513533fce8a15c9c05
fetching https://static.rust-lang.org/dist/2020-09-19/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2020-09-19: 40 B / 40 B [===============] 100.00 % 768.78 KB/s converted 2020-09-19 to bbc677480db8da85ea302e1e89d3df1f00e435bf
looking for regression commit between 2020-09-18 and 2020-09-19
opening existing repository at "rust.git"
refreshing repository
fetching (via local git) commits from f3c923a13a458c35ee26b3513533fce8a15c9c05 to bbc677480db8da85ea302e1e89d3df1f00e435bf
opening existing repository at "rust.git"
refreshing repository
looking up first commit
looking up second commit
checking that commits are by bors and thus have ci artifacts...
finding bors merge commits
found 8 bors merge commits in the specified range
  commit[0] 2020-09-17UTC: Auto merge of #76645 - fusion-engineering-forks:windows-lock, r=kennytm
  commit[1] 2020-09-18UTC: Auto merge of #76790 - ssomers:btree_slice_slasher_returns, r=Mark-Simulacrum
  commit[2] 2020-09-18UTC: Auto merge of #76854 - aDotInTheVoid:mir-opt-32-64-diff-name, r=oli-obk
  commit[3] 2020-09-18UTC: Auto merge of #76837 - wesleywiser:disable_consideredequal, r=oli-obk
  commit[4] 2020-09-18UTC: Auto merge of #72412 - VFLashM:issue-72408-nested-closures-exponential, r=tmandry
  commit[5] 2020-09-18UTC: Auto merge of #76575 - lcnr:abstract-const, r=oli-obk
  commit[6] 2020-09-18UTC: Auto merge of #76884 - Mark-Simulacrum:fix-macos-ci, r=pietroalbini
  commit[7] 2020-09-18UTC: Auto merge of #76782 - lzutao:rd-cap, r=jyn514
ERROR: no commits between f3c923a13a458c35ee26b3513533fce8a15c9c05 and bbc677480db8da85ea302e1e89d3df1f00e435bf within last 167 days

@jyn514
Copy link
Member

jyn514 commented Mar 15, 2021

#72412 looks suspicious.

@Neutron3529
Copy link
Contributor Author

Neutron3529 commented Mar 15, 2021

#72412 looks suspicious.

#![type_length_limit="393"]
fn main() {
    func(&mut(0u8..1))
}

fn func<T: Iterator<Item = u8>>(iter: &mut T) {
    func(&mut iter.map(|x| x + 1))
}

hang but

#![type_length_limit="392"]
fn main() {
    func(&mut(0u8..1))
}

fn func<T: Iterator<Item = u8>>(iter: &mut T) {
    func(&mut iter.map(|x| x + 1))
}

generate a failed massage:

$ rustc testr.rs -C opt-level=3 -C target-cpu=native -C codegen-units=1 -C lto -o testr  && ./testr
error: reached the type-length limit while instantiating `<&mut Map<&mut Map<&mut Map<&mut..., [closure@testr.rs:7:24: 7:33]>`
   --> /home/neutron/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:720:5
    |
720 | /     fn map<B, F>(self, f: F) -> Map<Self, F>
721 | |     where
722 | |         Self: Sized,
723 | |         F: FnMut(Self::Item) -> B,
    | |__________________________________^
    |
    = note: the full type name has been written to 'testr.long-type.txt'
    = help: consider adding a `#![type_length_limit="393"]` attribute to your crate

error: aborting due to previous error

@jyn514 jyn514 added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Mar 15, 2021
@JohnTitor
Copy link
Member

Assigning P-high as discussed as part of the Prioritization Working Group procedure and removing I-prioritize.

@JohnTitor JohnTitor added P-high High priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 16, 2021
@bors bors closed this as completed in d203fce Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-traits Area: Trait system C-bug Category: This is a bug. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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