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

Ensure stack when building MIR for matches #72941

Merged
merged 1 commit into from
Jun 11, 2020

Conversation

nagisa
Copy link
Member

@nagisa nagisa commented Jun 3, 2020

In particular matching on complex types such as strings will cause
deep recursion to happen.

Fixes #72933

r? @matthewjasper @oli-obk

@nagisa nagisa requested a review from matthewjasper June 3, 2020 11:33
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 3, 2020
@nagisa
Copy link
Member Author

nagisa commented Jun 3, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Jun 3, 2020

⌛ Trying commit 7f1585fb9360ca54ea0a3fe156a324516d248fa8 with merge cdab6c297e7845cb27538ad94520e316cb680fb7...

@nagisa
Copy link
Member Author

nagisa commented Jun 3, 2020

Running a timing as I just gone ahead and stuck a ensure_sufficient_stack at the most base level of match building, without trying to figure out all the specific cases in which we recurse while building MIR. This may have negligible perf impact or it might have a very notable one.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-8 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
##[section]Starting: Linux x86_64-gnu-llvm-8
##[section]Starting: Initialize job
Agent name: 'Hosted Agent'
Agent machine name: 'fv-az619'
Current agent version: '2.169.1'
##[group]Operating System
16.04.6
LTS
LTS
##[endgroup]
##[group]Virtual Environment
Environment: ubuntu-16.04
Version: 20200517.1
Included Software: https://github.com/actions/virtual-environments/blob/ubuntu16/20200517.1/images/linux/Ubuntu1604-README.md
##[endgroup]
Agent running as: 'vsts'
Prepare build directory.
Set build variables.
Download all required tasks.
Download all required tasks.
Downloading task: Bash (3.163.3)
Checking job knob settings.
   Knob: AgentToolsDirectory = /opt/hostedtoolcache Source: ${AGENT_TOOLSDIRECTORY} 
   Knob: AgentPerflog = /home/vsts/perflog Source: ${VSTS_AGENT_PERFLOG} 
Start tracking orphan processes.
##[section]Finishing: Initialize job
##[section]Starting: Configure Job Name
==============================================================================
---
========================== Starting Command Output ===========================
[command]/bin/bash --noprofile --norc /home/vsts/work/_temp/faf88f6b-f4bd-4729-b20c-a0080bcb818f.sh

##[section]Finishing: Disable git automatic line ending conversion
##[section]Starting: Checkout rust-lang/rust@refs/pull/72941/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
---
##[command]git remote add origin https://github.com/rust-lang/rust
##[command]git config gc.auto 0
##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
##[command]git config --get-all http.proxy
##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/72941/merge:refs/remotes/pull/72941/merge
---
 ---> cb2676f08729
Step 5/8 : ENV RUST_CONFIGURE_ARGS       --build=x86_64-unknown-linux-gnu       --llvm-root=/usr/lib/llvm-8       --enable-llvm-link-shared       --set rust.thin-lto-import-instr-limit=10
 ---> Using cache
 ---> df25ce111862
Step 6/8 : ENV SCRIPT python2.7 ../x.py test --exclude src/tools/tidy &&            python2.7 ../x.py test src/test/mir-opt --pass=build                                   --target=armv5te-unknown-linux-gnueabi &&            python2.7 ../x.py test src/tools/tidy
 ---> 599b9ac96b27
Step 7/8 : ENV NO_DEBUG_ASSERTIONS=1
 ---> Using cache
 ---> 091087e35a36
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
   Compiling fmt_macros v0.0.0 (/checkout/src/libfmt_macros)
   Compiling chalk-rust-ir v0.10.0
   Compiling rustc_ast_pretty v0.0.0 (/checkout/src/librustc_ast_pretty)
   Compiling rustc_hir v0.0.0 (/checkout/src/librustc_hir)
   Compiling rustc_query_system v0.0.0 (/checkout/src/librustc_query_system)
   Compiling chalk-solve v0.10.0
   Compiling rustc_hir_pretty v0.0.0 (/checkout/src/librustc_hir_pretty)
   Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
   Compiling rustc_ast_lowering v0.0.0 (/checkout/src/librustc_ast_lowering)
---
.................................................................................................... 1700/10281
...................................................................................i................ 1800/10281
.................................................................................................... 1900/10281
.................................................................................................... 2000/10281
.....i..i........................................................................................... 2100/10281
...............................................................................................iiiii 2200/10281
.................................................................................................... 2400/10281
.................................................................................................... 2500/10281
.................................................................................................... 2600/10281
.................................................................................................... 2700/10281
---
.................................................................................................... 5100/10281
..........................i...............i......................................................... 5200/10281
.................................................................................................... 5300/10281
..........................................................................i......................... 5400/10281
....................................................................i............................F.. 5500/10281
.....................................................................................ii.ii........i. 5600/10281
............................i....................................................................... 5800/10281
....................................i............................................................... 5900/10281
..........................................................................................ii........ 6000/10281
.............................i...................................................................... 6100/10281
.............................i...................................................................... 6100/10281
.................................................................................................... 6200/10281
.................................................................................................... 6300/10281
....................................................ii...i..ii...........i.......................... 6400/10281
.................................................................................................... 6600/10281
.................................................................................................... 6700/10281
.................................................................................................... 6700/10281
.....................................................................................i..ii.......... 6800/10281
.................................................................................................... 7000/10281
.................................................................................................... 7100/10281
.......................................i............................................................ 7200/10281
.................................................................................................... 7300/10281
---
.................................................................................................... 8200/10281
.................................................................................................... 8300/10281
.............................................................................i...................... 8400/10281
.................................................................................................... 8500/10281
...............................iiiiii.iiiiii.i...................................................... 8600/10281
.................................................................................................... 8800/10281
.................................................................................................... 8900/10281
.................................................................................................... 9000/10281
.................................................................................................... 9100/10281
---
---- [ui] ui/issues/issue-72933-match-stack-overflow.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit code: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issues/issue-72933-match-stack-overflow.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issues/issue-72933-match-stack-overflow/a" "-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/issues/issue-72933-match-stack-overflow/auxiliary"
------------------------------------------

------------------------------------------
stderr:
stderr:
------------------------------------------
error[E0601]: `main` function not found in crate `issue_72933_match_stack_overflow`
  --> /checkout/src/test/ui/issues/issue-72933-match-stack-overflow.rs:3:1
   |
LL | / fn banana(v: &str) -> u32 {
LL | |         "0" => 0,
LL | |         "1" => 1,
...  |
LL | |     }
LL | |     }
LL | | }
   | |_^ consider adding a `main` function to `/checkout/src/test/ui/issues/issue-72933-match-stack-overflow.rs`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0601`.

---
thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


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" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-8/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/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "8.0.0" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"


failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --exclude src/tools/tidy
Build completed unsuccessfully in 1:03:55
Build completed unsuccessfully in 1:03:55
== clock drift check ==
  local time: Wed Jun  3 12:41:52 UTC 2020
  network time: Wed, 03 Jun 2020 12:41:52 GMT
== end clock drift check ==

##[error]Bash exited with code '1'.
##[section]Finishing: Run build
##[section]Starting: Checkout rust-lang/rust@refs/pull/72941/merge to s
Task         : Get sources
Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version      : 1.0.0
Author       : Microsoft
Author       : Microsoft
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: rust-lang/rust (GitHub)
##[section]Finishing: Checkout rust-lang/rust@refs/pull/72941/merge to s
Cleaning up task key
Start cleaning up orphan processes.
Terminate orphan process: pid (5700) (python)
##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

In particular matching on complex types such as strings will cause
deep recursion to happen.

Fixes rust-lang#72933
@nagisa
Copy link
Member Author

nagisa commented Jun 3, 2020

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Jun 3, 2020

⌛ Trying commit 6b1ee67 with merge ec1ed34e80a25ce5ffc9a484481731a807be7f4d...

@bors
Copy link
Contributor

bors commented Jun 3, 2020

☀️ Try build successful - checks-azure
Build commit: ec1ed34e80a25ce5ffc9a484481731a807be7f4d (ec1ed34e80a25ce5ffc9a484481731a807be7f4d)

@rust-timer
Copy link
Collaborator

Queued ec1ed34e80a25ce5ffc9a484481731a807be7f4d with parent ff4aff6, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit ec1ed34e80a25ce5ffc9a484481731a807be7f4d, comparison URL.

@oli-obk
Copy link
Contributor

oli-obk commented Jun 4, 2020

Looks good to me. Perf is also clean. The test is a bit annoyingly big, but I can't think of anything to change here. Generating it from a proc macro is overkill.

@bors r+

@bors
Copy link
Contributor

bors commented Jun 4, 2020

📌 Commit 6b1ee67 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 4, 2020
@oli-obk oli-obk added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jun 4, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jun 9, 2020
…i-obk

Ensure stack when building MIR for matches

In particular matching on complex types such as strings will cause
deep recursion to happen.

Fixes rust-lang#72933

r? @matthewjasper @oli-obk
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 11, 2020
Rollup of 11 pull requests

Successful merges:

 - rust-lang#72380 (Fix `is_const_context`, update `check_for_cast`)
 - rust-lang#72941 (Ensure stack when building MIR for matches)
 - rust-lang#72976 (Clean up E0642 explanation)
 - rust-lang#73080 (doc/rustdoc: Fix incorrect external_doc feature flag)
 - rust-lang#73155 (save_analysis: better handle paths and functions signature)
 - rust-lang#73164 (Add new E0762 error code)
 - rust-lang#73172 (Fix more clippy warnings)
 - rust-lang#73181 (Automatically prioritize unsoundness issues)
 - rust-lang#73183 (Support proc macros in intra doc link resolution)
 - rust-lang#73208 (Fix doctest template)
 - rust-lang#73219 (x.py: with --json-output, forward cargo's JSON)

Failed merges:

r? @ghost
@bors bors merged commit adc92be into rust-lang:master Jun 11, 2020
@spastorino spastorino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 17, 2020
@pnkfelix
Copy link
Member

Discussed at T-compiler meeting; beta backport approved.

@pnkfelix pnkfelix added the beta-accepted Accepted for backporting to the compiler in the beta channel. label Jun 18, 2020
@Mark-Simulacrum Mark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jun 26, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 27, 2020
…ulacrum

[beta] backports

This PR backports the following:

* Make novel structural match violations not a `bug` rust-lang#73446
* linker: Never pass `-no-pie` to non-gnu linkers rust-lang#73384
* Disable the `SimplifyArmIdentity` pass rust-lang#73262
* Allow inference regions when relating consts rust-lang#73225
* Fix link error with #[thread_local] introduced by rust-lang#71192 rust-lang#73065
* Ensure stack when building MIR for matches rust-lang#72941
* Don't create impl candidates when obligation contains errors rust-lang#73005

r? @ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

thread 'rustc' has overflowed its stack
9 participants