You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compiler hangs during recursive monomorphisation #39684
So this seems to be related to resolving the Iterator::chain method, though I'm not sure exactly what is going on. It will eventually hit the recursion limit (probably) though.
After waiting for a little bit, this is the log I get. So I think part of the problem here is that we slowly recurse; that is, each step appears to take quite a while, so our recursion depth isn't really growing fast.
@Mark-Simulacrum could the slow part being caused by exponential blowup? We can only reproduce with infinite recursion currently, so we can't easily confirm what's going on here. However, it's possible something like breadth-first search was used and causing the blowup here.
Anyway, here's a log dump (from debug-assertions build) for examination:
#0 0x00007ffff4850381 in rustc::ty::context::TyCtxt::_intern_substs () from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#1 0x00007ffff4657d96 in rustc::ty::subst::<impl rustc::ty::fold::TypeFoldable<'tcx> for &'tcx rustc::ty::Slice<rustc::ty::subst::Kind<'tcx>>>::super_fold_with () from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#2 0x00007ffff460d165 in rustc::ty::fold::TypeFoldable::fold_with () from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#3 0x00007ffff45f1c85 in rustc::traits::select::SelectionContext::impl_or_trait_obligations::{{closure}} ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#4 0x00007ffff4426dbb in <core::iter::FlatMap<I, U, F> as core::iter::iterator::Iterator>::next ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#5 0x00007ffff42b8f27 in <alloc::vec::Vec<T>>::extend_desugared () from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#6 0x00007ffff441eea9 in <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#7 0x00007ffff45f1a83 in rustc::traits::select::SelectionContext::impl_or_trait_obligations ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#8 0x00007ffff45f0fd2 in rustc::traits::select::SelectionContext::confirm_impl_candidate::{{closure}} ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#9 0x00007ffff453559c in rustc::infer::InferCtxt::in_snapshot () from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#10 0x00007ffff45e9e4f in rustc::traits::select::SelectionContext::confirm_candidate ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#11 0x00007ffff45dee2d in rustc::traits::select::SelectionContext::select () from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#12 0x00007ffff45d68df in rustc::traits::project::confirm_candidate () from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#13 0x00007ffff45d5413 in rustc::traits::project::opt_normalize_projection_type ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#14 0x00007ffff45d2c34 in rustc::traits::project::normalize_projection_type ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#15 0x00007ffff45d259e in <rustc::traits::project::AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty () from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#16 0x00007ffff46812ab in rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable<'tcx> for rustc::ty::Predicate<'tcx>>::super_fold_with () from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#17 0x00007ffff45f1d87 in rustc::traits::select::SelectionContext::impl_or_trait_obligations::{{closure}} ()
---Type <return> to continue, or q <return> to quit---
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#18 0x00007ffff4426dbb in <core::iter::FlatMap<I, U, F> as core::iter::iterator::Iterator>::next ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#19 0x00007ffff441ec4c in <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#20 0x00007ffff45f1a83 in rustc::traits::select::SelectionContext::impl_or_trait_obligations ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#21 0x00007ffff45f0fd2 in rustc::traits::select::SelectionContext::confirm_impl_candidate::{{closure}} ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#22 0x00007ffff453559c in rustc::infer::InferCtxt::in_snapshot () from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#23 0x00007ffff45e9e4f in rustc::traits::select::SelectionContext::confirm_candidate ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#24 0x00007ffff45dee2d in rustc::traits::select::SelectionContext::select () from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#25 0x00007ffff45d639c in rustc::traits::project::assemble_candidates_from_impls::{{closure}} ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#26 0x00007ffff45d6219 in rustc::traits::project::assemble_candidates_from_impls ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#27 0x00007ffff45d4470 in rustc::traits::project::opt_normalize_projection_type ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
#28 0x00007ffff45d2c34 in rustc::traits::project::normalize_projection_type ()
from /usr/bin/../lib/../lib/librustc-5407144f5a31b71b.so
Activity
[-]Compiler hangs when computing infinite type[/-][+]Compiler hangs during recursive monomorphisation[/+]Aatch commentedon Feb 9, 2017
This is actually a monomorphisation issue, though I'm surprised it hangs since we do try to detect recursive monomorphisations too.
Aatch commentedon Feb 10, 2017
So this seems to be related to resolving the
Iterator::chainmethod, though I'm not sure exactly what is going on. It will eventually hit the recursion limit (probably) though.Mark-Simulacrum commentedon May 22, 2017
After waiting for a little bit, this is the log I get. So I think part of the problem here is that we slowly recurse; that is, each step appears to take quite a while, so our recursion depth isn't really growing fast.
gbip commentedon Oct 26, 2017
Hello,
I just wanted to say that I add the same problem with the following code :
Here is playground link.
This was on the latest stable (1.21).
ishitatsuyuki commentedon Feb 14, 2018
@Mark-Simulacrum could the slow part being caused by exponential blowup? We can only reproduce with infinite recursion currently, so we can't easily confirm what's going on here. However, it's possible something like breadth-first search was used and causing the blowup here.
Anyway, here's a log dump (from debug-assertions build) for examination:
silly.log.gz
ishitatsuyuki commentedon Feb 15, 2018
This is exponential. Have fun.
ishitatsuyuki commentedon Feb 15, 2018
This tracks down to the same cause as #38528 (comment).
Random suspension stack trace:
ishitatsuyuki commentedon Feb 17, 2018
With PoC in #48296 this resolves in finite time. The error is too silly though.
`-Z time-passes` with silly error message
Rollup merge of rust-lang#48296 - ishitatsuyuki:exp-unblow, r=nikomat…