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

rustc: remove Res::Upvar. #61276

Merged
merged 11 commits into from
Jun 2, 2019
Merged

rustc: remove Res::Upvar. #61276

merged 11 commits into from
Jun 2, 2019

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented May 28, 2019

By keeping track of the current "body_owner" (the DefId of the current fn/closure/const/etc.) in several passes, Res::Upvar and hir::Upvar don't need to contain contextual information about the closure.

By leveraging indexmap, the list of upvars for a given closure can now also be queried, to check whether a local variable is a closure capture, and so Res::Upvar can be merged with Res::Local.

And finally, the tcx.upvars(...) query now collects upvars from HIR, without relying on rustc_resolve.

r? @petrochenkov cc @varkor @davidtwco

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 28, 2019
@eddyb
Copy link
Member Author

eddyb commented May 28, 2019

@bors try

@bors
Copy link
Contributor

bors commented May 28, 2019

⌛ Trying commit 5934fcc73a9c9950978089c185877fbc85ea9b4b with merge 65978d81bc091c03518ff224ee97411cb6091b4d...

@bors
Copy link
Contributor

bors commented May 28, 2019

☀️ Try build successful - checks-travis
Build commit: 65978d81bc091c03518ff224ee97411cb6091b4d

@Centril
Copy link
Contributor

Centril commented May 28, 2019

@rust-timer build 65978d81bc091c03518ff224ee97411cb6091b4d

@rust-timer
Copy link
Collaborator

Success: Queued 65978d81bc091c03518ff224ee97411cb6091b4d with parent 7da1185, comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 65978d81bc091c03518ff224ee97411cb6091b4d, comparison URL.

@varkor
Copy link
Member

varkor commented May 28, 2019

Looks good!

@eddyb
Copy link
Member Author

eddyb commented May 28, 2019

Looks like noise to me. Also, I've pushed the HIR-based upvar collection.
Only part left now is removing the closure hacks from async fn/closures.

@bors
Copy link
Contributor

bors commented May 29, 2019

☔ The latest upstream changes (presumably #61305) made this pull request unmergeable. Please resolve the merge conflicts.

@eddyb
Copy link
Member Author

eddyb commented May 29, 2019

(You can ignore test failures, I just wanted to push my progress in moving the async argument lowering to HIR for @davidtwco to look at, as I'm not sure when I'll have the time to finish it)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed on Travis (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.
travis_time:end:0acc755f:start=1559148490593146262,finish=1559148493102367268,duration=2509221006
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
$ export AWS_ACCESS_KEY_ID=AKIA46X5W6CZEJZ6XT55
---
Check compiletest suite=ui mode=ui (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:09:53] 
[01:09:53] running 5599 tests
[01:09:56] .................................................................................................... 100/5599
[01:10:02] ...........F..........FF.................F.......................................................... 200/5599
[01:10:08] .................................................................................................... 400/5599
[01:10:11] ...................................................................................................i 500/5599
[01:10:15] .................................................................................................... 600/5599
[01:10:19] .................................................................................................... 700/5599
---
[01:13:26] failures:
[01:13:26] 
[01:13:26] ---- [ui] ui/async-await/argument-patterns.rs stdout ----
[01:13:26] 
[01:13:26] error: test compilation failed although it shouldn't!
[01:13:26] status: exit code: 1
[01:13:26] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/async-await/argument-patterns.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/async-await/argument-patterns/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/async-await/argument-patterns/auxiliary" "-A" "unused"
[01:13:26] ------------------------------------------
[01:13:26] 
[01:13:26] ------------------------------------------
[01:13:26] stderr:
[01:13:26] stderr:
[01:13:26] ------------------------------------------
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/argument-patterns.rs:14:20
[01:13:26]    |
[01:13:26] LL | async fn b(n: u32, ref mut vec: A) {
[01:13:26]    |                    ^^^^^^^^^^^     - opaque type requires that borrow lasts for `'static`
[01:13:26]    |                    creates a temporary which is freed while still in use
[01:13:26] LL |     vec.push(n);
[01:13:26] LL | }
[01:13:26]    | - temporary value is freed at the end of this statement
[01:13:26]    | - temporary value is freed at the end of this statement
[01:13:26] 
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/argument-patterns.rs:18:12
[01:13:26]    |
[01:13:26] LL | async fn c(ref vec: A) {
[01:13:26]    |            ^^^^^^^     - opaque type requires that borrow lasts for `'static`
[01:13:26]    |            creates a temporary which is freed while still in use
[01:13:26] LL |     vec.contains(&0);
[01:13:26] LL | }
[01:13:26]    | - temporary value is freed at the end of this statement
---
[01:13:26] ---- [ui] ui/async-await/dont-print-desugared-async.rs stdout ----
[01:13:26] 
[01:13:26] error: ui test compiled successfully!
[01:13:26] status: exit code: 0
[01:13:26] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/async-await/dont-print-desugared-async.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/async-await/dont-print-desugared-async" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/async-await/dont-print-desugared-async/auxiliary" "-A" "unused"
[01:13:26] ------------------------------------------
[01:13:26] 
[01:13:26] ------------------------------------------
[01:13:26] stderr:
[01:13:26] stderr:
[01:13:26] ------------------------------------------
[01:13:26] warning[E0596]: cannot borrow data in a `&` reference as mutable
[01:13:26]    |
[01:13:26]    |
[01:13:26] LL | async fn async_fn(&ref mut s: &[i32]) {}
[01:13:26]    |                    ^^^^^^^^^ cannot borrow as mutable
[01:13:26]    = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
[01:13:26]    = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
[01:13:26]    = note: for more information, try `rustc --explain E0729`
[01:13:26] 
[01:13:26] 
[01:13:26] 
[01:13:26] ------------------------------------------
[01:13:26] 
[01:13:26] 
[01:13:26] ---- [ui] ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs stdout ----
[01:13:26] 
[01:13:26] error: test compilation failed although it shouldn't!
[01:13:26] status: exit code: 1
[01:13:26] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2018" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding/auxiliary" "-A" "unused"
[01:13:26] ------------------------------------------
[01:13:26] 
[01:13:26] ------------------------------------------
[01:13:26] stderr:
[01:13:26] stderr:
[01:13:26] ------------------------------------------
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:45:20
[01:13:26]    |
[01:13:26] LL | async fn foo_async(ref mut x: D, ref mut _y: D) {
[01:13:26]    |                    ^^^^^^^^^                    - opaque type requires that borrow lasts for `'static`
[01:13:26]    |                    creates a temporary which is freed while still in use
[01:13:26]    |                    creates a temporary which is freed while still in use
[01:13:26] LL |     x.1.borrow_mut().push(DropOrder::Function);
[01:13:26] LL | }
[01:13:26]    | - temporary value is freed at the end of this statement
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:54:20
[01:13:26]    |
[01:13:26]    |
[01:13:26] LL | async fn bar_async(ref mut x: D, _: D) {
[01:13:26]    |                    ^^^^^^^^^           - opaque type requires that borrow lasts for `'static`
[01:13:26]    |                    creates a temporary which is freed while still in use
[01:13:26]    |                    creates a temporary which is freed while still in use
[01:13:26] LL |     x.1.borrow_mut().push(DropOrder::Function);
[01:13:26] LL | }
[01:13:26]    | - temporary value is freed at the end of this statement
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:64:20
[01:13:26]    |
[01:13:26]    |
[01:13:26] LL | async fn baz_async((ref mut x, _): (D, D)) {
[01:13:26]    |                    ^^^^^^^^^^^^^^          - opaque type requires that borrow lasts for `'static`
[01:13:26]    |                    creates a temporary which is freed while still in use
[01:13:26]    |                    creates a temporary which is freed while still in use
[01:13:26] LL |     x.1.borrow_mut().push(DropOrder::Function);
[01:13:26] LL | }
[01:13:26]    | - temporary value is freed at the end of this statement
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:74:23
[01:13:26]    |
[01:13:26]    |
[01:13:26] LL | async fn foobar_async(ref mut x: D, (ref mut a, _, ref mut _c): (D, D, D), _: D, ref mut _y: D) {
[01:13:26]    |                       ^^^^^^^^^ creates a temporary which is freed while still in use           - opaque type requires that borrow lasts for `'static`
[01:13:26] LL |     x.1.borrow_mut().push(DropOrder::Function);
[01:13:26] LL | }
[01:13:26]    | - temporary value is freed at the end of this statement
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:86:24
[01:13:26]    |
[01:13:26]    |
[01:13:26] LL |     async fn foo_async(ref mut x: D, ref mut _y: D) {
[01:13:26]    |                        ^^^^^^^^^                    - opaque type requires that borrow lasts for `'static`
[01:13:26]    |                        creates a temporary which is freed while still in use
[01:13:26]    |                        creates a temporary which is freed while still in use
[01:13:26] LL |         x.1.borrow_mut().push(DropOrder::Function);
[01:13:26]    |     - temporary value is freed at the end of this statement
[01:13:26] 
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:95:24
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:95:24
[01:13:26]    |
[01:13:26] LL |     async fn bar_async(ref mut x: D, _: D) {
[01:13:26]    |                        ^^^^^^^^^           - opaque type requires that borrow lasts for `'static`
[01:13:26]    |                        creates a temporary which is freed while still in use
[01:13:26]    |                        creates a temporary which is freed while still in use
[01:13:26] LL |         x.1.borrow_mut().push(DropOrder::Function);
[01:13:26]    |     - temporary value is freed at the end of this statement
[01:13:26] 
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:105:24
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:105:24
[01:13:26]    |
[01:13:26] LL |     async fn baz_async((ref mut x, _): (D, D)) {
[01:13:26]    |                        ^^^^^^^^^^^^^^          - opaque type requires that borrow lasts for `'static`
[01:13:26]    |                        creates a temporary which is freed while still in use
[01:13:26]    |                        creates a temporary which is freed while still in use
[01:13:26] LL |         x.1.borrow_mut().push(DropOrder::Function);
[01:13:26]    |     - temporary value is freed at the end of this statement
[01:13:26] 
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:116:9
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:116:9
[01:13:26]    |
[01:13:26] LL |         ref mut x: D, (ref mut a, _, ref mut _c): (D, D, D), _: D, ref mut _y: D,
[01:13:26]    |         ^^^^^^^^^ creates a temporary which is freed while still in use
[01:13:26] LL |     ) {
[01:13:26]    |       - opaque type requires that borrow lasts for `'static`
[01:13:26] LL |         x.1.borrow_mut().push(DropOrder::Function);
[01:13:26]    |     - temporary value is freed at the end of this statement
[01:13:26] 
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:132:34
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:132:34
[01:13:26]    |
[01:13:26] LL | impl<'a> Bar<'a> {
[01:13:26] LL |     /// Check that unused bindings are dropped after the method with self is polled.
[01:13:26] LL |     /// Check that unused bindings are dropped after the method with self is polled.
[01:13:26] LL |     async fn foo_async(&'a self, ref mut x: D, ref mut _y: D) {
[01:13:26]    |                                  ^^^^^^^^^                    - opaque type requires that borrow lasts for `'a`
[01:13:26]    |                                  creates a temporary which is freed while still in use
[01:13:26]    |                                  creates a temporary which is freed while still in use
[01:13:26] LL |         x.1.borrow_mut().push(DropOrder::Function);
[01:13:26]    |     - temporary value is freed at the end of this statement
[01:13:26] 
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:141:34
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:141:34
[01:13:26]    |
[01:13:26] LL | impl<'a> Bar<'a> {
[01:13:26] ...
[01:13:26] ...
[01:13:26] LL |     async fn bar_async(&'a self, ref mut x: D, _: D) {
[01:13:26]    |                                  ^^^^^^^^^           - opaque type requires that borrow lasts for `'a`
[01:13:26]    |                                  creates a temporary which is freed while still in use
[01:13:26]    |                                  creates a temporary which is freed while still in use
[01:13:26] LL |         x.1.borrow_mut().push(DropOrder::Function);
[01:13:26]    |     - temporary value is freed at the end of this statement
[01:13:26] 
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:151:34
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:151:34
[01:13:26]    |
[01:13:26] LL | impl<'a> Bar<'a> {
[01:13:26] ...
[01:13:26] ...
[01:13:26] LL |     async fn baz_async(&'a self, (ref mut x, _): (D, D)) {
[01:13:26]    |                                  ^^^^^^^^^^^^^^          - opaque type requires that borrow lasts for `'a`
[01:13:26]    |                                  creates a temporary which is freed while still in use
[01:13:26]    |                                  creates a temporary which is freed while still in use
[01:13:26] LL |         x.1.borrow_mut().push(DropOrder::Function);
[01:13:26]    |     - temporary value is freed at the end of this statement
[01:13:26] 
[01:13:26] error[E0716]: temporary value dropped while borrowed
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:162:19
[01:13:26]   --> /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs:162:19
[01:13:26]    |
[01:13:26] LL | impl<'a> Bar<'a> {
[01:13:26] ...
[01:13:26] ...
[01:13:26] LL |         &'a self, ref mut x: D, (ref mut a, _, ref mut _c): (D, D, D), _: D, ref mut _y: D,
[01:13:26]    |                   ^^^^^^^^^ creates a temporary which is freed while still in use
[01:13:26] LL |     ) {
[01:13:26]    |       - opaque type requires that borrow lasts for `'a`
[01:13:26] LL |         x.1.borrow_mut().push(DropOrder::Function);
[01:13:26]    |     - temporary value is freed at the end of this statement
[01:13:26] 
[01:13:26] error: aborting due to 12 previous errors
[01:13:26] 
---
[01:13:26] ------------------------------------------
[01:13:26] stderr:
[01:13:26] ------------------------------------------
[01:13:26] thread 'main' panicked at 'assertion failed: `(left == right)`
[01:13:26]   left: `[Val("_y"), Function, Val("x")]`,
[01:13:26]  right: `[Function, Val("_y"), Val("x")]`', /checkout/src/test/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs:181:5
[01:13:26] 
[01:13:26] ------------------------------------------
[01:13:26] 
[01:13:26] 
---
[01:13:26] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:521:22
[01:13:26] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
[01:13:26] 
[01:13:26] 
[01:13:26] 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-6.0/bin/FileCheck" "--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" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:13:26] 
[01:13:26] 
[01:13:26] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:13:26] Build completed unsuccessfully in 0:04:45
[01:13:26] Build completed unsuccessfully in 0:04:45
[01:13:26] Makefile:48: recipe for target 'check' failed
[01:13:26] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0e3a2bf2
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed May 29 18:01:51 UTC 2019
---
travis_time:end:0ef0ca7e:start=1559152912409229411,finish=1559152912414525220,duration=5295809
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:099c10f8
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:03f56e1a
travis_time:start:03f56e1a
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:288b99e8
$ dmesg | grep -i kill

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 @TimNN. (Feature Requests)

@@ -1183,6 +1183,11 @@ dependencies = [
"typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "indexmap"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this data structure have any "classic" name?
Search by "IndexMap" only leads to the Rust version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really know (for the record, this crate used to be called ordermap). cc @bluss

///
/// The arguments of the function are replaced in HIR lowering with the arguments created by
/// this function and the statements created here are inserted at the top of the closure body.
fn construct_async_arguments(&mut self, asyncness: &mut Spanned<IsAsync>, decl: &mut FnDecl) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see this removed.
I somehow missed the moment when all this out-of-place stuff was added to the parser.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The replacement in HIR lowering is not done yet, so if you want I can back out the async changes and do that in a future PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me for the part before async then

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've submitted #61413 that builds upon this and implements the async part.

@petrochenkov petrochenkov 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 30, 2019
@petrochenkov
Copy link
Contributor

I didn't look at the async parts very carefully, perhaps some other reviewer would be more suitable for those.

@bors

This comment has been minimized.

@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 1, 2019
@Centril
Copy link
Contributor

Centril commented Jun 1, 2019

@bors retry collection-tests...

@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 1, 2019
@bors
Copy link
Contributor

bors commented Jun 1, 2019

⌛ Testing commit f7a4c9d with merge 044fb846ee76c0a864e75d5ae20b6ca398b119be...

@bors
Copy link
Contributor

bors commented Jun 2, 2019

💔 Test failed - status-appveyor

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 2, 2019
@eddyb
Copy link
Member Author

eddyb commented Jun 2, 2019

@bors retry (spurious Windows link failure?)

@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 2, 2019
@bors
Copy link
Contributor

bors commented Jun 2, 2019

⌛ Testing commit f7a4c9d with merge 4c7bb8b...

bors added a commit that referenced this pull request Jun 2, 2019
rustc: remove Res::Upvar.

By keeping track of the current "`body_owner`" (the `DefId` of the current fn/closure/const/etc.) in several passes, `Res::Upvar` and `hir::Upvar` don't need to contain contextual information about the closure.

By leveraging [`indexmap`](https://docs.rs/indexmap), the list of upvars for a given closure can now also be queried, to check whether a local variable is a closure capture, and so `Res::Upvar` can be merged with `Res::Local`.

And finally, the `tcx.upvars(...)` query now collects upvars from HIR, without relying on `rustc_resolve`.

r? @petrochenkov cc @varkor @davidtwco
@bors
Copy link
Contributor

bors commented Jun 2, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: petrochenkov
Pushing 4c7bb8b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 2, 2019
@bors bors merged commit f7a4c9d into rust-lang:master Jun 2, 2019
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #61276!

Tested on commit 4c7bb8b.
Direct link to PR: #61276

💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra).
💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra).
💔 rls on windows: test-pass → build-fail (cc @Xanewok, @rust-lang/infra).
💔 rls on linux: test-pass → build-fail (cc @Xanewok, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Jun 2, 2019
Tested on commit rust-lang/rust@4c7bb8b.
Direct link to PR: <rust-lang/rust#61276>

💔 clippy-driver on windows: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra).
💔 clippy-driver on linux: test-pass → build-fail (cc @Manishearth @llogiq @mcarton @oli-obk @phansch, @rust-lang/infra).
💔 rls on windows: test-pass → build-fail (cc @Xanewok, @rust-lang/infra).
💔 rls on linux: test-pass → build-fail (cc @Xanewok, @rust-lang/infra).
@eddyb eddyb deleted the kill-res-upvar branch June 2, 2019 14:54
mati865 added a commit to mati865/rust-clippy that referenced this pull request Jun 2, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request Jun 2, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request Jun 2, 2019
Centril added a commit to Centril/rust that referenced this pull request Jun 4, 2019
…-sane-way, r=eddyb

Re-implement async fn drop order lowering

This PR re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
@eddyb to refactor `Res::Upvar`.

Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.

This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.

Only b7aa4ed and 71fb8fa should be reviewed, any other commits
are from rust-lang#61276 (though 447e336 might end up staying in this PR).

As a nice side effect, it also fixes rust-lang#61187 (cc rust-lang#61192).

r? @eddyb
cc @cramertj
Centril added a commit to Centril/rust that referenced this pull request Jun 4, 2019
…-sane-way, r=eddyb

Re-implement async fn drop order lowering

This PR re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
@eddyb to refactor `Res::Upvar`.

Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.

This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.

Only b7aa4ed and 71fb8fa should be reviewed, any other commits
are from rust-lang#61276 (though 447e336 might end up staying in this PR).

As a nice side effect, it also fixes rust-lang#61187 (cc rust-lang#61192).

r? @eddyb
cc @cramertj
Centril added a commit to Centril/rust that referenced this pull request Jun 4, 2019
…-sane-way, r=eddyb

Re-implement async fn drop order lowering

This PR re-implements the async fn drop order lowering changes so
that it all takes place in HIR lowering, building atop the work done by
@eddyb to refactor `Res::Upvar`.

Previously, this types involved in the lowering were constructed in
libsyntax as they had to be used during name resolution and HIR
lowering. This was awful because none of that logic should have existed
in libsyntax.

This commit also changes `ArgSource` to keep a `HirId` to the original
argument pattern rather than a cloned copy of the pattern.

Only b7aa4ed and 71fb8fa should be reviewed, any other commits
are from rust-lang#61276 (though 447e336 might end up staying in this PR).

As a nice side effect, it also fixes rust-lang#61187 (cc rust-lang#61192).

r? @eddyb
cc @cramertj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants