Skip to content

Use EvaluatedToOkModuloRegions when we get a coinductive match #83913

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

Closed

Conversation

Aaron1011
Copy link
Member

This forces every participant in the cycle to have a result
EvaluatedToOkModuloRegions (or an error) as well, since their result
will be influenced by the coinductive result.

While I'm confident that this is sound (AFAIK, it's always sound to
replace EvaluatedToOk with EvaluatedToOkModuloRegions), I don't
really understand the coinductive cycle logic. This appears to fix the
syn incremental crash, but there could be a different way of fixing it
as well.

This forces every participant in the cycle to have a result
`EvaluatedToOkModuloRegions` (or an error) as well, since their result
will be influenced by the coinductive result.

While I'm confident that this is sound (AFAIK, it's always sound to
replace `EvaluatedToOk` with `EvaluatedToOkModuloRegions`), I don't
really understand the coinductive cycle logic. This appears to fix the
`syn` incremental crash, but there could be a different way of fixing it
as well.
@rust-highfive
Copy link
Contributor

r? @lcnr

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 6, 2021
@Aaron1011
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 6, 2021
@bors
Copy link
Collaborator

bors commented Apr 6, 2021

⌛ Trying commit 3672602 with merge 5dbb81f33c342e785a59a73d7516283763759016...

@Aaron1011
Copy link
Member Author

r? @nikomatsakis

@rust-highfive rust-highfive assigned nikomatsakis and unassigned lcnr Apr 6, 2021
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-10 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

84 LL | | }
85    | |_^
86 
+ error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}`
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    |
+    |
+ note: ...which requires borrow-checking `cycle1`...
Some tests failed in compiletest suite=ui mode=ui host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires processing `cycle1`...
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires processing MIR for `cycle1`...
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires unsafety-checking `cycle1`...
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires building MIR for `cycle1`...
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires type-checking `cycle1`...
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+    = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
+ note: ...which requires computing type of `cycle2::{opaque#0}`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    |                ^^^^^^^^^^
+ note: ...which requires borrow-checking `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires processing `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires processing MIR for `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires unsafety-checking `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires building MIR for `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires type-checking `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+    = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle
+ note: cycle used when checking item types in top-level module
+    |
+    |
+ LL | / use std::cell::Cell;
+ LL | | use std::rc::Rc;
+ LL | |
+ LL | | fn send<T: Send>(_: T) {}
+ ...  |
+ LL | |     Rc::new(String::from("foo"))
+ LL | | }
+ 
+ 
+ error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}`
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    |
+    |
+ note: ...which requires borrow-checking `cycle1`...
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires processing `cycle1`...
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires processing MIR for `cycle1`...
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires unsafety-checking `cycle1`...
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires building MIR for `cycle1`...
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires type-checking `cycle1`...
+    |
+    |
+ LL | fn cycle1() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+    = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
+ note: ...which requires computing type of `cycle2::{opaque#0}`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    |                ^^^^^^^^^^
+ note: ...which requires borrow-checking `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires processing `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires processing MIR for `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires unsafety-checking `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires building MIR for `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ note: ...which requires type-checking `cycle2`...
+    |
+    |
+ LL | fn cycle2() -> impl Clone {
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^
+    = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle
+ note: cycle used when checking item types in top-level module
+    |
+    |
+ LL | / use std::cell::Cell;
+ LL | | use std::rc::Rc;
+ LL | |
+ LL | | fn send<T: Send>(_: T) {}
+ ...  |
+ LL | |     Rc::new(String::from("foo"))
+ LL | | }
+ 
+ 
87 error[E0277]: `Rc<String>` cannot be sent between threads safely
89    |


99    = help: within `impl Clone`, the trait `Send` is not implemented for `Rc<String>`
100    = note: required because it appears within the type `impl Clone`
- error: aborting due to 2 previous errors
+ error: aborting due to 4 previous errors
103 
104 Some errors have detailed explanations: E0277, E0391.
104 Some errors have detailed explanations: E0277, E0391.
105 For more information about an error, try `rustc --explain E0277`.


The actual stderr differed from the expected stderr.
Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/auto-trait-leak/auto-trait-leak.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args impl-trait/auto-trait-leak.rs`
error: 1 errors occurred comparing output.
status: exit status: 1
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/impl-trait/auto-trait-leak.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zemit-future-incompat-report" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/auto-trait-leak" "-A" "unused" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/auto-trait-leak/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}`
   |
   |
LL | fn cycle1() -> impl Clone {
   |
   |
note: ...which requires borrow-checking `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing MIR for `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires unsafety-checking `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building MIR for `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
note: ...which requires computing type of `cycle2::{opaque#0}`...
   |
   |
LL | fn cycle2() -> impl Clone {
   |                ^^^^^^^^^^
note: ...which requires borrow-checking `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing MIR for `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires unsafety-checking `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building MIR for `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
   = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle
note: cycle used when checking item types in top-level module
   |
LL | / use std::cell::Cell;
LL | / use std::cell::Cell;
LL | | use std::rc::Rc;
LL | |
LL | | fn send<T: Send>(_: T) {}
...  |
LL | |     Rc::new(String::from("foo"))
LL | | }


error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}`
   |
   |
LL | fn cycle1() -> impl Clone {
   |
   |
note: ...which requires borrow-checking `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing MIR for `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires unsafety-checking `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building MIR for `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
note: ...which requires computing type of `cycle2::{opaque#0}`...
   |
   |
LL | fn cycle2() -> impl Clone {
   |                ^^^^^^^^^^
note: ...which requires borrow-checking `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing MIR for `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires unsafety-checking `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building MIR for `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle
note: cycle used when checking item types in top-level module
   |
LL | / use std::cell::Cell;
LL | / use std::cell::Cell;
LL | | use std::rc::Rc;
LL | |
LL | | fn send<T: Send>(_: T) {}
...  |
LL | |     Rc::new(String::from("foo"))
LL | | }


error[E0391]: cycle detected when computing type of `cycle1::{opaque#0}`
   |
   |
LL | fn cycle1() -> impl Clone {
   |
   |
note: ...which requires borrow-checking `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing MIR for `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires unsafety-checking `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building MIR for `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `cycle1`...
   |
   |
LL | fn cycle1() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
note: ...which requires computing type of `cycle2::{opaque#0}`...
   |
   |
LL | fn cycle2() -> impl Clone {
   |                ^^^^^^^^^^
note: ...which requires borrow-checking `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires processing MIR for `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires unsafety-checking `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires building MIR for `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires type-checking `cycle2`...
   |
   |
LL | fn cycle2() -> impl Clone {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: ...which again requires computing type of `cycle1::{opaque#0}`, completing the cycle
note: cycle used when checking item types in top-level module
   |
LL | / use std::cell::Cell;
LL | / use std::cell::Cell;
LL | | use std::rc::Rc;
LL | |
LL | | fn send<T: Send>(_: T) {}
...  |
LL | |     Rc::new(String::from("foo"))
LL | | }


error[E0277]: `Rc<String>` cannot be sent between threads safely
   |
   |
LL | fn send<T: Send>(_: T) {}
   |            ---- required by this bound in `send`
...
LL |     send(cycle2().clone());
   |     ^^^^ `Rc<String>` cannot be sent between threads safely
...
LL | fn cycle2() -> impl Clone {
   |                ---------- within this `impl Clone`
   |
   = help: within `impl Clone`, the trait `Send` is not implemented for `Rc<String>`
   = note: required because it appears within the type `impl Clone`
error: aborting due to 4 previous errors

Some errors have detailed explanations: E0277, E0391.
For more information about an error, try `rustc --explain E0277`.
---
test result: FAILED. 11636 passed; 1 failed; 96 ignored; 0 measured; 0 filtered out; finished in 138.49s



command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--suite" "ui" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-10/bin/FileCheck" "--nodejs" "/usr/bin/node" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python3" "--lldb-python" "/usr/bin/python3" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "10.0.0" "--llvm-components" "aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets amdgpu amdgpuasmparser amdgpucodegen amdgpudesc amdgpudisassembler amdgpuinfo amdgpuutils analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter bpf bpfasmparser bpfcodegen bpfdesc bpfdisassembler bpfinfo cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine frontendopenmp fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink lanai lanaiasmparser lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcerror orcjit passes perfjitevents powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xcore xcorecodegen xcoredesc xcoredisassembler xcoreinfo xray" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap --stage 2 test --exclude src/tools/tidy
Build completed unsuccessfully in 0:13:09

@bors
Copy link
Collaborator

bors commented Apr 6, 2021

☀️ Try build successful - checks-actions
Build commit: 5dbb81f33c342e785a59a73d7516283763759016 (5dbb81f33c342e785a59a73d7516283763759016)

@rust-timer
Copy link
Collaborator

Queued 5dbb81f33c342e785a59a73d7516283763759016 with parent d322385, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (5dbb81f33c342e785a59a73d7516283763759016): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 6, 2021
@Aaron1011
Copy link
Member Author

cc @nikomatsakis: The perf impact seems worse than the previous caching fix

@Aaron1011
Copy link
Member Author

The perf results look quite similar to #83719 - it looks like all of the regressions from that PR may have come from just this change (as opposed to returning EvaluatedToOkModuloRegions in other places), which seems very suprising.

@Aaron1011
Copy link
Member Author

I haven't been able to come up with a minimal regression test for this. Howver, the perf results show that it fixed the syn incremental crash.

@nikomatsakis
Copy link
Contributor

I agree that this is sound, but it really doesn't very necessary. I guess @Aaron1011 I should invest some time into digging into this syn incremental crash. Can you give a bit more details about the coinductive cycle that seems to be leading to a problem, if you know? (Or other analysis you have done)

@Aaron1011
Copy link
Member Author

I've been working with the https://github.com/Aaron1011/syn-crash repository from #83538 (comment)

On the first run through (with an empty incremental cache), I get the following cycle:

│ │ ├┘rustc_trait_selection::traits::select::evaluate_predicate_recursively obligation=Obligation(predicate=Binder(TraitPredicate(<std::marker::PhantomData<(ty::PathSegment, std::option::Option<synom::tokens::Colon2>)> as std::marker::Unpin>), []), depth=1), previous_stack=Some(TraitObligationStack(Obligation(predicate=Binder(TraitPredicate(<std::vec::IntoIter<(ty::PathSegment, std::option::Option<synom::tokens::Colon2>)> as std::marker::Unpin>), []), depth=0)))
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select CACHE MISS, result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::marker::PhantomData<(ty::PathSegment, std::option::Option<synom::tokens::Colon2>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, depth=2, reached_depth=2
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<alloc::raw_vec::RawVec<attr::Attribute> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 437, result: EvaluatedToOk }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<alloc::raw_vec::RawVec<attr::Attribute> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<synom::delimited::Delimited<ty::Ty, synom::tokens::Comma> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 64, result: EvaluatedToOkModuloRegions }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<synom::delimited::Delimited<ty::Ty, synom::tokens::Comma> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::ptr::Unique<attr::Attribute> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 438, result: EvaluatedToOk }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::ptr::Unique<attr::Attribute> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::PathParameters as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 24, result: EvaluatedToOkModuloRegions }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::PathParameters as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<alloc::raw_vec::RawVec<(ty::PathSegment, std::option::Option<synom::tokens::Colon2>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 334, result: EvaluatedToOk }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<alloc::raw_vec::RawVec<(ty::PathSegment, std::option::Option<synom::tokens::Colon2>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<proc_macro2::TokenStream as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 376, result: EvaluatedToOk }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<proc_macro2::TokenStream as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<mac::Mac as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 359, result: EvaluatedToOk }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<mac::Mac as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<(generics::TyParamBound, std::option::Option<synom::tokens::Add>) as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 504, result: EvaluatedToOk }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<(generics::TyParamBound, std::option::Option<synom::tokens::Add>) as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<synom::delimited::Delimited<generics::TyParamBound, synom::tokens::Add> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 498, result: EvaluatedToOk }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<synom::delimited::Delimited<generics::TyParamBound, synom::tokens::Add> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::Ty as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 71, result: EvaluatedToOkModuloRegions }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::Ty as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::TypeBinding as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 618, result: EvaluatedToOkModuloRegions }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::TypeBinding as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::vec::Vec<(ty::TypeBinding, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 612, result: EvaluatedToOkModuloRegions }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::vec::Vec<(ty::TypeBinding, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::PathSegment as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 6, result: EvaluatedToOkModuloRegions }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::PathSegment as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<proc_macro2::imp::TokenStream as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 377, result: EvaluatedToOk }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<proc_macro2::imp::TokenStream as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::FunctionRetTy as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 640, result: EvaluatedToOkModuloRegions }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::FunctionRetTy as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::option::Option<generics::BoundLifetimes> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 507, result: EvaluatedToOk }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::option::Option<generics::BoundLifetimes> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::vec::Vec<(generics::TyParamBound, std::option::Option<synom::tokens::Add>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 499, result: EvaluatedToOk }
│ │ ├─199ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::vec::Vec<(generics::TyParamBound, std::option::Option<synom::tokens::Add>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<generics::BoundLifetimes as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 508, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<generics::BoundLifetimes as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<(ty::Ty, std::option::Option<synom::tokens::Comma>) as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 70, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<(ty::Ty, std::option::Option<synom::tokens::Comma>) as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::vec::Vec<(expr::Expr, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 103, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::vec::Vec<(expr::Expr, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<synom::delimited::Delimited<ty::PathSegment, synom::tokens::Colon2> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 332, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<synom::delimited::Delimited<ty::PathSegment, synom::tokens::Colon2> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<proc_macro2::TokenNode as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 373, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<proc_macro2::TokenNode as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<synom::delimited::Delimited<ty::TypeBinding, synom::tokens::Comma> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 611, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<synom::delimited::Delimited<ty::TypeBinding, synom::tokens::Comma> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::ptr::Unique<(ty::PathSegment, std::option::Option<synom::tokens::Colon2>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 335, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::ptr::Unique<(ty::PathSegment, std::option::Option<synom::tokens::Colon2>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::TyPath as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 493, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::TyPath as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::TyImplTrait as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 580, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::TyImplTrait as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<alloc::raw_vec::RawVec<proc_macro2::TokenTree> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 379, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<alloc::raw_vec::RawVec<proc_macro2::TokenTree> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<expr::ExprKind as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 87, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<expr::ExprKind as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<expr::Expr as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 86, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<expr::Expr as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::PolyTraitRef as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 506, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::PolyTraitRef as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<alloc::raw_vec::RawVec<(ty::TypeBinding, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 613, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<alloc::raw_vec::RawVec<(ty::TypeBinding, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<(ty::TypeBinding, std::option::Option<synom::tokens::Comma>) as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 617, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<(ty::TypeBinding, std::option::Option<synom::tokens::Comma>) as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<synom::delimited::Delimited<expr::Expr, synom::tokens::Comma> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 102, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<synom::delimited::Delimited<expr::Expr, synom::tokens::Comma> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::marker::PhantomData<(expr::Expr, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 107, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::marker::PhantomData<(expr::Expr, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::marker::PhantomData<proc_macro2::TokenTree> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 382, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::marker::PhantomData<proc_macro2::TokenTree> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<attr::Attribute as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 441, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<attr::Attribute as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::marker::PhantomData<(ty::TypeBinding, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 616, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::marker::PhantomData<(ty::TypeBinding, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<(ty::PathSegment, std::option::Option<synom::tokens::Colon2>) as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 5, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<(ty::PathSegment, std::option::Option<synom::tokens::Colon2>) as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<alloc::raw_vec::RawVec<(expr::Expr, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 104, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<alloc::raw_vec::RawVec<(expr::Expr, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::TyArray as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 80, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::TyArray as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<alloc::raw_vec::RawVec<(generics::LifetimeDef, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 515, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<alloc::raw_vec::RawVec<(generics::LifetimeDef, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::marker::PhantomData<(generics::LifetimeDef, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 518, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::marker::PhantomData<(generics::LifetimeDef, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<synom::delimited::Delimited<generics::LifetimeDef, synom::tokens::Comma> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 513, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<synom::delimited::Delimited<generics::LifetimeDef, synom::tokens::Comma> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<generics::TyParamBound as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 505, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<generics::TyParamBound as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<(expr::Expr, std::option::Option<synom::tokens::Comma>) as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 108, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<(expr::Expr, std::option::Option<synom::tokens::Comma>) as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::vec::Vec<(ty::Ty, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 65, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::vec::Vec<(ty::Ty, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<expr::ExprCall as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 98, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<expr::ExprCall as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::vec::Vec<proc_macro2::TokenTree> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 378, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::vec::Vec<proc_macro2::TokenTree> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<generics::LifetimeDef as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 520, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<generics::LifetimeDef as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::vec::Vec<(generics::LifetimeDef, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 514, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::vec::Vec<(generics::LifetimeDef, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::ptr::Unique<(ty::TypeBinding, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 614, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::ptr::Unique<(ty::TypeBinding, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<alloc::raw_vec::RawVec<(ty::Ty, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 66, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<alloc::raw_vec::RawVec<(ty::Ty, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::marker::PhantomData<(generics::TyParamBound, std::option::Option<synom::tokens::Add>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 503, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::marker::PhantomData<(generics::TyParamBound, std::option::Option<synom::tokens::Add>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::ptr::Unique<(expr::Expr, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 105, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::ptr::Unique<(expr::Expr, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::vec::Vec<attr::Attribute> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 436, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::vec::Vec<attr::Attribute> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<expr::ExprPath as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 318, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<expr::ExprPath as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::TyTup as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 488, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::TyTup as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::TyTraitObject as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 497, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::TyTraitObject as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<(generics::LifetimeDef, std::option::Option<synom::tokens::Comma>) as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 519, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<(generics::LifetimeDef, std::option::Option<synom::tokens::Comma>) as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::marker::PhantomData<(ty::Ty, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 69, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::marker::PhantomData<(ty::Ty, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::ptr::Unique<proc_macro2::TokenTree> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 380, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::ptr::Unique<proc_macro2::TokenTree> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::ptr::Unique<(ty::Ty, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 67, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::ptr::Unique<(ty::Ty, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::vec::Vec<(ty::PathSegment, std::option::Option<synom::tokens::Colon2>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 333, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::vec::Vec<(ty::PathSegment, std::option::Option<synom::tokens::Colon2>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::Path as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 330, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::Path as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::marker::PhantomData<attr::Attribute> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 440, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::marker::PhantomData<attr::Attribute> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::ptr::Unique<(generics::LifetimeDef, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 516, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::ptr::Unique<(generics::LifetimeDef, std::option::Option<synom::tokens::Comma>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::ptr::Unique<(generics::TyParamBound, std::option::Option<synom::tokens::Add>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 501, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::ptr::Unique<(generics::TyParamBound, std::option::Option<synom::tokens::Add>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<alloc::raw_vec::RawVec<(generics::TyParamBound, std::option::Option<synom::tokens::Add>)> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 500, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<alloc::raw_vec::RawVec<(generics::TyParamBound, std::option::Option<synom::tokens::Add>)> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::AngleBracketedParameterData as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 25, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::AngleBracketedParameterData as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<ty::ParenthesizedParameterData as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 637, result: EvaluatedToOkModuloRegions }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<ty::ParenthesizedParameterData as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions

The two important lines are:

│ │ ├─200ms DEBUG rustc_trait_selection::traits::select on_completion, fresh_trait_ref=Binder(<std::vec::Vec<proc_macro2::TokenTree> as std::marker::Unpin>, []), eval=ProvisionalEvaluation { from_dfn: 378, result: EvaluatedToOk }
│ │ ├─200ms DEBUG rustc_trait_selection::traits::select insert_evaluation_cache global, trait_ref=Binder(<std::vec::Vec<proc_macro2::TokenTree> as std::marker::Unpin>, []), result=EvaluatedToOkModuloRegions

The predicate std::vec::Vec<proc_macro2::TokenTree> as std::marker::Unpin had a provisional result of EvaluatedToOk, but that result got changed into EvaluatedToOkModuloRegions, since it participates in a cycle with a result of EvaluatedToOkModuloRegions.

In order to evaluate quote::Tokens: std::marker::Unpin (the predicate which actually causes the crash), we end up needing to recursively evaluate std::vec::Vec<proc_macro2::TokenTree> as std::marker::Unpin. As a result, our first compilation session produces a result of EvaluatedToOkModuloRegions for quote::Tokens: std::marker::Unpin

During the second compilation session, we do not appear to hit that coinductive cycle for some reason (I haven't yet figured out why). Instead, we hit this cycle:

┐rustc_trait_selection::traits::select::evaluate_predicate_recursively obligation=Obligation(predicate=Binder(TraitPredicate(<std::marker::PhantomData<proc_macro2::TokenTree> as std::marker::Unpin>), []), depth=5), previous_stack=Some(TraitObligationStack(Obligation(predicate=Binder(TraitPredicate(<std::marker::PhantomData<proc_macro2::TokenTree> as std::marker::Unpin>), []), depth=4)))
├─0ms DEBUG rustc_trait_selection::traits::select evaluate_trait_predicate_recursively, obligation=Obligation(predicate=Binder(TraitPredicate(<std::marker::PhantomData<proc_macro2::TokenTree> as std::marker::Unpin>), []), depth=5)
├─0ms DEBUG rustc_trait_selection::traits::select evaluate_trait_predicate_recursively - in global
├─0ms DEBUG rustc_trait_selection::traits::select fresh_trait_ref=Binder(<std::marker::PhantomData<proc_macro2::TokenTree> as std::marker::Unpin>, [])
├─0ms DEBUG rustc_trait_selection::traits::select get_provisional = None, fresh_trait_ref=Binder(<std::marker::PhantomData<proc_macro2::TokenTree> as std::marker::Unpin>, []), reached_depth=2
├─0ms DEBUG rustc_trait_selection::traits::select evaluate_stack --> recursive at depth 5
├─0ms DEBUG rustc_trait_selection::traits::select update_reached_depth, reached_depth=5
├─0ms DEBUG rustc_trait_selection::traits::select update_reached_depth: marking as cycle participant, p.fresh_trait_ref=Binder(<std::marker::PhantomData<proc_macro2::TokenTree> as std::marker::Unpin>, [])
├─0ms DEBUG rustc_trait_selection::traits::select coinductive_predicate, predicate=Binder(TraitPredicate(<std::marker::PhantomData<proc_macro2::TokenTree> as std::marker::Unpin>), []), result=true
├─0ms DEBUG rustc_trait_selection::traits::select evaluate_stack --> recursive, coinductive: EvaluatedToOk
├─0ms DEBUG rustc_trait_selection::traits::select result=Ok(EvaluatedToOk)
┘rustc_trait_selection::traits::select::evaluate_predicate_recursively obligation=Obligation(predicate=Binder(TraitPredicate(<std::marker::PhantomData<proc_macro2::TokenTree> as std::marker::Unpin>), []), depth=5), previous_stack=Some(TraitObligationStack(Obligation(predicate=Binder(TraitPredicate(<std::marker::PhantomData<proc_macro2::TokenTree> as std::marker::Unpin>), []), depth=4)))

We end up evaluating this predicate to EvaluatedToOk, so ``quote::Tokens: std::marker::Unpinalso ends up asEvaluatedToOk` - a different result from the previous compilation session.

@nikomatsakis
Copy link
Contributor

@Aaron1011 any chance we can chat during my trait office hours at some point? (9am-10am US ET most days)

@Aaron1011
Copy link
Member Author

@nikomatsakis: Would this Wednesday work for you?

@nikomatsakis
Copy link
Contributor

@Aaron1011 sure

@crlf0710
Copy link
Member

crlf0710 commented May 1, 2021

@Aaron1011 Ping from triage, any updates on this after the chat above?

@crlf0710 crlf0710 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 1, 2021
@nikomatsakis
Copy link
Contributor

nikomatsakis commented May 3, 2021

I've been digging into this PR a bit, it's just taking me a while to really understand what's going on. I'd like an assessment of the urgency here, though.

@Aaron1011
Copy link
Member Author

I've taken a look at the logs from the minimal reproduction in #83538 (comment). I think this is still the simplest fix to the problem.

@Mark-Simulacrum
Copy link
Member

@nikomatsakis in terms of urgency I think we need some fix to the syn crash by the end of this cycle, and ideally one that's backportable to beta (1.53). I think setting a goal of fixing enough of the incremental bugs that we can reasonably enable incremental on 1.54 at the latest should be a priority though.

@nikomatsakis
Copy link
Contributor

I'm going to close this PR in favor of #85186

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants