Repository navigation
Infinite recursion error instead of trait bound error #40827
Description
Observed behavior:
Receiving the following error when attempting to compile the sample program.
Expected behavior:
Indicate that there is a trait bound error.
rustc 1.16.0 (30cf806ef 2017-03-10)
error[E0275]: overflow evaluating the requirement `TransmitterInternal: std::marker::Send`
--> <anon>:22:16
|
22 | fn g(x: Memo) {f(x)}
| ^
|
= note: consider adding a `#![recursion_limit="128"]` attribute to your crate
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::sync::Arc<TransmitterInternal>`
= note: required because it appears within the type `SlabRef`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<SlabRef>`
= note: required because it appears within the type `alloc::raw_vec::RawVec<SlabRef>`
= note: required because it appears within the type `std::vec::Vec<SlabRef>`
= note: required because it appears within the type `TransmitterInternal`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<TransmitterInternal>`
= note: required because it appears within the type `SlabRef`
= note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<SlabRef>`
= note: required because it appears within the type `alloc::raw_vec::RawVec<SlabRef>`
= note: required because it appears within the type `std::vec::Vec<SlabRef>`
= note: required because it appears within the type `TransmitterInternal`
= note: required because of the requirements on the impl of `std::marker::Sync` for `std::sync::Arc<TransmitterInternal>`
= note: required because it appears within the type `SlabRef`
...
Minimal reproduction case:
https://is.gd/KgD5Tk
Many thanks to the tireless efforts of @stephaneyfx in creating the repro above!
Bonus round
I haven't yet figured out a minimal repro for this second part, but if I'm interpreting correctly, it's possible that a variant of this endless recursion error does not require a trait bound error to be triggered. (noob warning: it's possible that the omission of +Send+Sync in 4ab0fdf is actually a trait bounds error, but I don't presently understand why)
Non-minimal repro:
https://travis-ci.org/dnorman/unbase/jobs/209643435#L240
Minimal change that fixed it:
dnorman/unbase@47c68bf
https://travis-ci.org/dnorman/unbase/jobs/209649602#L228
Activity
stephaneyfx commentedon Mar 25, 2017
This is a simplified example reproducing the issue (playground).
stephaneyfx commentedon Mar 26, 2017
Note that if
Rcis removed (or replaced byArc, for example), the compiler does not enter this infinite recursion and deducesFooisSend(playground).dnorman commentedon Aug 18, 2017
This is the case I was referring to @aturon :)
aturon commentedon Aug 18, 2017
@dnorman Thanks! Fascinating bug...
orium commentedon Jul 23, 2018
I think I have hit the same bug with
I did some digging around in the trait resolver and I believe what causes it is pointed by @nikomatsakis in #30533 (comment):
If this is truly the cause of the bug I will give it a go and try to fix it, but I would really appreciate some mentoring instructions. @nikomatsakis can you give me a few pointers?
Auto merge of #53255 - orium:fix-bug-overflow-send, r=arielb1
Rollup merge of rust-lang#136536 - DuskyElf:master, r=jieyouxu
Rollup merge of rust-lang#136536 - DuskyElf:master, r=jieyouxu
Rollup merge of rust-lang#136536 - DuskyElf:master, r=jieyouxu
Unrolled build for rust-lang#136536