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

or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve #64111

Merged
merged 27 commits into from Sep 6, 2019

Conversation

@Centril
Copy link
Member

commented Sep 3, 2019

Following up on work in #63693 and #61708, in this PR we:

  • Uniformly use PatKind::Or(...) in AST:

    • Change ast::Arm.pats: Vec<P<Pat>> => ast::Arm.pat: P<Pat>

    • Change ast::ExprKind::Let.0: Vec<P<Pat>> => ast::ExprKind::Let.0: P<Pat>

  • Adjust librustc_resolve/late.rs to correctly handle or-patterns at any level of nesting as a result.

    In particular, the already-bound check which rejects e.g. let (a, a); now accounts for or-patterns. The consistency checking (ensures no missing bindings and binding mode consistency) also now accounts for or-patterns. In the process, a bug was found in the current compiler which allowed:

    enum E<T> { A(T, T), B(T) }
    use E::*;
    fn foo() {
        match A(0, 1) {
            B(mut a) | A(mut a, mut a) => {}
        }
    }

    The new algorithms took a few iterations to get right. I tried several clever schemes but ultimately a version based on a stack of hashsets and recording product/sum contexts was chosen since it is more clearly correct.

  • Clean up librustc_resolve/late.rs by, among other things, using a new with_rib function to better ensure stack dicipline.

  • Do not push the change in AST to HIR for now to avoid doing too much in this PR. To cope with this, we introduce a temporary hack in rustc::hir::lowering (clearly marked in the diff).

cc #54883
cc @dlrobertson @matthewjasper
r? @petrochenkov

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

commented Sep 3, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (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.
2019-09-03T02:50:35.8023347Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-03T02:50:35.8257897Z ##[command]git config gc.auto 0
2019-09-03T02:50:35.8356073Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-03T02:50:35.8448177Z ##[command]git config --get-all http.proxy
2019-09-03T02:50:35.8607209Z ##[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/64111/merge:refs/remotes/pull/64111/merge
---
2019-09-03T03:56:42.7716889Z .................................................................................................... 1500/8991
2019-09-03T03:56:48.7139387Z .................................................................................................... 1600/8991
2019-09-03T03:57:02.1165103Z .................................................i...............i.................................. 1700/8991
2019-09-03T03:57:10.8809925Z .................................................................................................... 1800/8991
2019-09-03T03:57:25.9832408Z ........................................iiiii....................................................... 1900/8991
2019-09-03T03:57:37.4422484Z .................................................................................................... 2100/8991
2019-09-03T03:57:40.2133086Z .................................................................................................... 2200/8991
2019-09-03T03:57:44.4614689Z .................................................................................................... 2300/8991
2019-09-03T03:57:52.4723036Z .................................................................................................... 2400/8991
---
2019-09-03T04:01:00.0997792Z ...........................i...............i........................................................ 4700/8991
2019-09-03T04:01:12.9505217Z .................................................................................................... 4800/8991
2019-09-03T04:01:19.3568574Z .................................................................................................... 4900/8991
2019-09-03T04:01:30.5777330Z .................................................................................................... 5000/8991
2019-09-03T04:01:36.5072312Z ........ii.ii....................................................................................... 5100/8991
2019-09-03T04:01:50.3452365Z .................................................................................................... 5300/8991
2019-09-03T04:01:59.0805934Z .......................................................................i............................ 5400/8991
2019-09-03T04:02:06.7517968Z .................................................................................................... 5500/8991
2019-09-03T04:02:13.9580713Z .................................................................................................... 5600/8991
2019-09-03T04:02:13.9580713Z .................................................................................................... 5600/8991
2019-09-03T04:02:25.2449135Z .................................................................ii...i..ii...........i............. 5700/8991
2019-09-03T04:02:51.9101120Z .................................................................................................... 5900/8991
2019-09-03T04:03:02.2984730Z .................................................................................................... 6000/8991
2019-09-03T04:03:02.2984730Z .................................................................................................... 6000/8991
2019-09-03T04:03:12.4414408Z ...................................................................i..ii............................ 6100/8991
2019-09-03T04:03:43.1225824Z .................................................................................................... 6300/8991
2019-09-03T04:03:45.3644750Z ..........................i......................................................................... 6400/8991
2019-09-03T04:03:47.6516342Z ..................................................................................................i. 6500/8991
2019-09-03T04:03:50.5368163Z .................................................................................................... 6600/8991
---
2019-09-03T04:08:53.7624182Z  finished in 21.979
2019-09-03T04:08:53.7841151Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-03T04:08:53.9692871Z 
2019-09-03T04:08:53.9694062Z running 149 tests
2019-09-03T04:08:57.4917213Z i....iii......iii..iiii....i.............................i..i..................i....i.........ii.i.i 100/149
2019-09-03T04:08:59.6004681Z ..iiii..............i.........iii.i......ii......
2019-09-03T04:08:59.6005699Z 
2019-09-03T04:08:59.6010785Z  finished in 5.817
2019-09-03T04:08:59.6207267Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-03T04:08:59.7908287Z 
---
2019-09-03T04:09:01.9815053Z  finished in 2.360
2019-09-03T04:09:02.0061654Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-03T04:09:02.1946178Z 
2019-09-03T04:09:02.1946364Z running 9 tests
2019-09-03T04:09:02.1947218Z iiiiiiiii
2019-09-03T04:09:02.1951864Z 
2019-09-03T04:09:02.1951913Z  finished in 0.189
2019-09-03T04:09:02.2197870Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-03T04:09:03.1041150Z 
---
2019-09-03T04:09:21.5657274Z  finished in 19.346
2019-09-03T04:09:21.5908558Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-03T04:09:21.7886524Z 
2019-09-03T04:09:21.7888058Z running 123 tests
2019-09-03T04:09:47.8595033Z .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....ii..........iiii..........i...ii...i.......ii. 100/123
2019-09-03T04:09:53.0016855Z i.i.i......iii.i.....ii
2019-09-03T04:09:53.0018749Z 
2019-09-03T04:09:53.0022242Z  finished in 31.411
2019-09-03T04:09:53.0031660Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-03T04:09:53.0035623Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-09-03T04:10:46.5077791Z ---- [ui] ui-fulldeps/pprust-expr-roundtrip.rs stdout ----
2019-09-03T04:10:46.5078003Z 
2019-09-03T04:10:46.5078421Z error: test compilation failed although it shouldn't!
2019-09-03T04:10:46.5078608Z status: exit code: 1
2019-09-03T04:10:46.5079460Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui-fulldeps/pprust-expr-roundtrip.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-fulldeps/pprust-expr-roundtrip/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-fulldeps/pprust-expr-roundtrip/auxiliary" "-A" "unused"
2019-09-03T04:10:46.5080340Z ------------------------------------------
2019-09-03T04:10:46.5080560Z 
2019-09-03T04:10:46.5080934Z ------------------------------------------
2019-09-03T04:10:46.5081112Z stderr:
2019-09-03T04:10:46.5081112Z stderr:
2019-09-03T04:10:46.5081483Z ------------------------------------------
2019-09-03T04:10:46.5081663Z error[E0308]: mismatched types
2019-09-03T04:10:46.5082039Z   --> /checkout/src/test/ui-fulldeps/pprust-expr-roundtrip.rs:158:64
2019-09-03T04:10:46.5082249Z    |
2019-09-03T04:10:46.5082660Z LL |                 iter_exprs(depth - 1, &mut |e| g(ExprKind::Let(ps.clone(), e)))
2019-09-03T04:10:46.5082900Z    |                                                                ^^^^^^^^^^ expected struct `syntax::ptr::P`, found struct `std::vec::Vec`
2019-09-03T04:10:46.5083195Z    = note: expected type `syntax::ptr::P<_>`
2019-09-03T04:10:46.5083195Z    = note: expected type `syntax::ptr::P<_>`
2019-09-03T04:10:46.5084292Z               found type `std::vec::Vec<syntax::ptr::P<_>>`
2019-09-03T04:10:46.5084615Z error: aborting due to previous error
2019-09-03T04:10:46.5085100Z 
2019-09-03T04:10:46.5085671Z For more information about this error, try `rustc --explain E0308`.
2019-09-03T04:10:46.5085969Z 
---
2019-09-03T04:10:46.5089965Z test result: FAILED. 68 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
2019-09-03T04:10:46.5090038Z 
2019-09-03T04:10:46.5095148Z 
2019-09-03T04:10:46.5104281Z 
2019-09-03T04:10:46.5106990Z 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-fulldeps" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps" "--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"
2019-09-03T04:10:46.5107697Z 
2019-09-03T04:10:46.5107850Z 
2019-09-03T04:10:46.5108086Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-09-03T04:10:46.5108281Z Build completed unsuccessfully in 1:12:42
2019-09-03T04:10:46.5108281Z Build completed unsuccessfully in 1:12:42
2019-09-03T04:10:46.5166967Z == clock drift check ==
2019-09-03T04:10:46.5199545Z   local time: Tue Sep  3 04:10:46 UTC 2019
2019-09-03T04:10:46.6682621Z   network time: Tue, 03 Sep 2019 04:10:46 GMT
2019-09-03T04:10:46.6682755Z == end clock drift check ==
2019-09-03T04:10:47.5768521Z ##[error]Bash exited with code '1'.
2019-09-03T04:10:47.5811934Z ##[section]Starting: Checkout
2019-09-03T04:10:47.5814306Z ==============================================================================
2019-09-03T04:10:47.5814368Z Task         : Get sources
2019-09-03T04:10:47.5814419Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@@ -450,6 +439,16 @@ impl LoweringContext<'_> {
}
}

/// HACK(or_patterns; Centril | dlrobertson): For now we don't push down top level or-patterns

This comment has been minimized.

Copy link
@Centril

Centril Sep 3, 2019

Author Member

@dlrobertson We should discuss how to divvy up the remaining work. Most of the changes that you need to do if you push down this change to HIR are not too hard but

for pat in &arm.pats {
// Visit the pattern, coming from the discriminant exit
let mut pat_exit = self.pat(&pat, discr_exit);
// If there is a guard expression, handle it here
if let Some(ref guard) = arm.guard {
// Add a dummy node for the previous guard
// expression to target
let guard_start = self.add_dummy_node(&[pat_exit]);
// Visit the guard expression
let guard_exit = match guard {
hir::Guard::If(ref e) => (&**e, self.expr(e, guard_start)),
};
// #47295: We used to have very special case code
// here for when a pair of arms are both formed
// solely from constants, and if so, not add these
// edges. But this was not actually sound without
// other constraints that we stopped enforcing at
// some point.
if let Some((prev_guard, prev_index)) = prev_guard.take() {
self.add_exiting_edge(prev_guard, prev_index, match_scope, guard_start);
}
// Push the guard onto the list of previous guards
prev_guard = Some(guard_exit);
// Update the exit node for the pattern
pat_exit = guard_exit.1;
}
// Add an edge from the exit of this pattern to the
// exit of the arm
self.add_contained_edge(pat_exit, bindings_exit);
}
seems like an unpleasant one to deal with and probably more relevant to the MIR changes. What I could do (e.g. in a follow up) is to push the hack down to construct.rs instead by special casing there + appropriate FIXMEs.

For now I'll go fix the unused_parens lint since that is AST based and can be done in parallel with this PR.

This comment has been minimized.

Copy link
@dlrobertson

dlrobertson Sep 3, 2019

Contributor

We should discuss how to divvy up the remaining work.

Yeah, for now I'm working on getting this working in MIR (so we can start testing).

src/libsyntax/ast.rs Outdated Show resolved Hide resolved
src/librustc_resolve/late.rs Outdated Show resolved Hide resolved
src/librustc_resolve/late.rs Outdated Show resolved Hide resolved
src/librustc_resolve/late.rs Outdated Show resolved Hide resolved
src/librustc_resolve/late.rs Show resolved Hide resolved
src/libsyntax/ast.rs Outdated Show resolved Hide resolved
src/libsyntax/visit.rs Show resolved Hide resolved
@Centril

This comment has been minimized.

Copy link
Member Author

commented Sep 4, 2019

Addressed the comments, hopefully. :)

@Centril Centril force-pushed the Centril:ast-only-patkind-or branch from aad2579 to 97cce77 Sep 4, 2019

@petrochenkov

This comment has been minimized.

Copy link
Contributor

commented Sep 4, 2019

r=me with the remaining comment addressed

@Centril

This comment has been minimized.

Copy link
Member Author

commented Sep 4, 2019

@bors r=petrochenkov

@bors

This comment has been minimized.

Copy link
Contributor

commented Sep 4, 2019

📌 Commit 359c3c0 has been approved by petrochenkov

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

commented Sep 5, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (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.
2019-09-04T23:44:51.9853670Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-09-04T23:44:52.6279641Z ##[command]git config gc.auto 0
2019-09-04T23:44:52.6283530Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-09-04T23:44:52.6285422Z ##[command]git config --get-all http.proxy
2019-09-04T23:44:52.6292132Z ##[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/64111/merge:refs/remotes/pull/64111/merge
---
2019-09-05T00:48:55.3383360Z .................................................................................................... 1500/8994
2019-09-05T00:49:01.0050461Z .................................................................................................... 1600/8994
2019-09-05T00:49:13.7542216Z .................................................i...............i.................................. 1700/8994
2019-09-05T00:49:22.2725493Z .................................................................................................... 1800/8994
2019-09-05T00:49:36.5387506Z ........................................iiiii....................................................... 1900/8994
2019-09-05T00:49:47.6994927Z .................................................................................................... 2100/8994
2019-09-05T00:49:50.3380209Z .................................................................................................... 2200/8994
2019-09-05T00:49:54.5090871Z .................................................................................................... 2300/8994
2019-09-05T00:50:02.1858226Z .................................................................................................... 2400/8994
---
2019-09-05T00:53:02.6403779Z ...........................i...............i........................................................ 4700/8994
2019-09-05T00:53:14.6521703Z .................................................................................................... 4800/8994
2019-09-05T00:53:20.9040620Z .................................................................................................... 4900/8994
2019-09-05T00:53:31.8980047Z .................................................................................................... 5000/8994
2019-09-05T00:53:37.6081286Z ........ii.ii....................................................................................... 5100/8994
2019-09-05T00:53:50.8143250Z .................................................................................................... 5300/8994
2019-09-05T00:53:59.1676601Z .......................................................................i............................ 5400/8994
2019-09-05T00:54:06.5443208Z .................................................................................................... 5500/8994
2019-09-05T00:54:13.4960462Z .................................................................................................... 5600/8994
2019-09-05T00:54:13.4960462Z .................................................................................................... 5600/8994
2019-09-05T00:54:24.5043147Z .................................................................ii...i..ii...........i............. 5700/8994
2019-09-05T00:54:51.7192929Z .................................................................................................... 5900/8994
2019-09-05T00:55:02.0769286Z .................................................................................................... 6000/8994
2019-09-05T00:55:02.0769286Z .................................................................................................... 6000/8994
2019-09-05T00:55:09.7260033Z ...................................................................i..ii............................ 6100/8994
2019-09-05T00:55:40.6365741Z .................................................................................................... 6300/8994
2019-09-05T00:55:42.7430152Z ..........................i......................................................................... 6400/8994
2019-09-05T00:55:45.0303641Z ..................................................................................................i. 6500/8994
2019-09-05T00:55:47.7855812Z .................................................................................................... 6600/8994
---
2019-09-05T01:00:45.1231858Z  finished in 19.660
2019-09-05T01:00:45.1411486Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-05T01:00:45.3124961Z 
2019-09-05T01:00:45.3126089Z running 149 tests
2019-09-05T01:00:48.8712831Z i....iii......iii..iiii....i.............................i..i..................i....i.........ii.i.i 100/149
2019-09-05T01:00:50.9212056Z ..iiii..............i.........iii.i......ii......
2019-09-05T01:00:50.9213937Z 
2019-09-05T01:00:50.9214232Z  finished in 5.779
2019-09-05T01:00:50.9399407Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-05T01:00:51.1029515Z 
---
2019-09-05T01:00:53.2308240Z  finished in 2.290
2019-09-05T01:00:53.2500080Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-05T01:00:53.4101218Z 
2019-09-05T01:00:53.4102222Z running 9 tests
2019-09-05T01:00:53.4103383Z iiiiiiiii
2019-09-05T01:00:53.4104289Z 
2019-09-05T01:00:53.4104325Z  finished in 0.160
2019-09-05T01:00:53.4289881Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-05T01:00:53.5968931Z 
---
2019-09-05T01:01:11.8497974Z  finished in 18.421
2019-09-05T01:01:11.8691986Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-05T01:01:12.0345447Z 
2019-09-05T01:01:12.0354899Z running 123 tests
2019-09-05T01:01:36.2470479Z .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....ii..........iiii..........i...ii...i.......ii. 100/123
2019-09-05T01:01:40.9466956Z i.i.i......iii.i.....ii
2019-09-05T01:01:40.9467785Z 
2019-09-05T01:01:40.9468471Z  finished in 29.077
2019-09-05T01:01:40.9479448Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-09-05T01:01:40.9480255Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-09-05T01:13:30.8491954Z 
2019-09-05T01:13:30.8492286Z running 459 tests
2019-09-05T01:13:49.0056783Z .................................................................................................... 100/459
2019-09-05T01:14:05.0001442Z .......................................................................................i............ 200/459
2019-09-05T01:14:17.8717395Z ..F.FF.............................................................................................. 300/459
2019-09-05T01:14:38.7236887Z ...........................................................
2019-09-05T01:14:38.7237686Z failures:
2019-09-05T01:14:38.7237966Z 
2019-09-05T01:14:38.7238857Z ---- prelude/mod.rs - prelude (line 6) stdout ----
2019-09-05T01:14:38.7238857Z ---- prelude/mod.rs - prelude (line 6) stdout ----
2019-09-05T01:14:38.7239202Z error[E0523]: found two different crates with name `alloc` that are not distinguished by differing `-C metadata`. This will result in symbol conflicts between the two.
2019-09-05T01:14:38.7239401Z  --> prelude/mod.rs:8:1
2019-09-05T01:14:38.7239503Z 5 | extern crate alloc;
2019-09-05T01:14:38.7239539Z   | ^^^^^^^^^^^^^^^^^^^
2019-09-05T01:14:38.7239564Z 
2019-09-05T01:14:38.7239620Z error: aborting due to previous error
2019-09-05T01:14:38.7239620Z error: aborting due to previous error
2019-09-05T01:14:38.7239645Z 
2019-09-05T01:14:38.7239824Z Couldn't compile the test.
2019-09-05T01:14:38.7240522Z ---- raw_vec.rs - raw_vec::RawVec<T, A>::double (line 261) stdout ----
2019-09-05T01:14:38.7241186Z error[E0523]: found two different crates with name `alloc` that are not distinguished by differing `-C metadata`. This will result in symbol conflicts between the two.
2019-09-05T01:14:38.7241471Z  --> raw_vec.rs:263:1
2019-09-05T01:14:38.7241582Z 4 | extern crate alloc;
2019-09-05T01:14:38.7241626Z   | ^^^^^^^^^^^^^^^^^^^
2019-09-05T01:14:38.7241655Z 
2019-09-05T01:14:38.7241716Z error: aborting due to previous error
2019-09-05T01:14:38.7241716Z error: aborting due to previous error
2019-09-05T01:14:38.7241747Z 
2019-09-05T01:14:38.7241950Z Couldn't compile the test.
2019-09-05T01:14:38.7242205Z ---- raw_vec.rs - raw_vec::RawVec<T, A>::reserve (line 466) stdout ----
2019-09-05T01:14:38.7242569Z error[E0523]: found two different crates with name `alloc` that are not distinguished by differing `-C metadata`. This will result in symbol conflicts between the two.
2019-09-05T01:14:38.7242782Z  --> raw_vec.rs:468:1
2019-09-05T01:14:38.7243048Z 4 | extern crate alloc;
2019-09-05T01:14:38.7243099Z   | ^^^^^^^^^^^^^^^^^^^
2019-09-05T01:14:38.7243128Z 
2019-09-05T01:14:38.7243251Z error: aborting due to previous error
---
2019-09-05T01:14:38.7244854Z 
2019-09-05T01:14:38.7294362Z error: test failed, to rerun pass '--doc'
2019-09-05T01:14:38.7315735Z 
2019-09-05T01:14:38.7316068Z 
2019-09-05T01:14:38.7317533Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libtest/Cargo.toml" "-p" "alloc" "--" "--quiet"
2019-09-05T01:14:38.7317693Z 
2019-09-05T01:14:38.7317723Z 
2019-09-05T01:14:38.7327821Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-09-05T01:14:38.7327966Z Build completed unsuccessfully in 1:22:23
2019-09-05T01:14:38.7327966Z Build completed unsuccessfully in 1:22:23
2019-09-05T01:14:38.7385863Z == clock drift check ==
2019-09-05T01:14:38.7407313Z   local time: Thu Sep  5 01:14:38 UTC 2019
2019-09-05T01:14:38.9051729Z   network time: Thu, 05 Sep 2019 01:14:38 GMT
2019-09-05T01:14:38.9056819Z == end clock drift check ==
2019-09-05T01:14:39.4876713Z ##[error]Bash exited with code '1'.
2019-09-05T01:14:39.4919067Z ##[section]Starting: Checkout
2019-09-05T01:14:39.4920893Z ==============================================================================
2019-09-05T01:14:39.4920955Z Task         : Get sources
2019-09-05T01:14:39.4920992Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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)

@Centril Centril force-pushed the Centril:ast-only-patkind-or branch from 359c3c0 to bc023ec Sep 5, 2019

@Centril

This comment has been minimized.

Copy link
Member Author

commented Sep 5, 2019

Tested locally with ./x.py test src/liballoc --stage 1 before and after rebase. Cannot reproduce the failure. Let's see if rebase changes anything in CI.

Centril added a commit to Centril/rust that referenced this pull request Sep 5, 2019
Centril added a commit to Centril/rust that referenced this pull request Sep 5, 2019

@Centril Centril force-pushed the Centril:ast-only-patkind-or branch from bc023ec to 16ba502 Sep 5, 2019

@Centril

This comment has been minimized.

Copy link
Member Author

commented Sep 5, 2019

Rebased & fixed the fallout from #64128 in 16ba502.

@bors r=petrochenkov

@bors

This comment has been minimized.

Copy link
Contributor

commented Sep 5, 2019

📌 Commit 16ba502 has been approved by petrochenkov

Centril added a commit to Centril/rust that referenced this pull request Sep 5, 2019
Rollup merge of rust-lang#64111 - Centril:ast-only-patkind-or, r=petr…
…ochenkov

or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve

Following up on work in rust-lang#63693 and rust-lang#61708, in this PR we:

- Uniformly use `PatKind::Or(...)` in AST:

   - Change `ast::Arm.pats: Vec<P<Pat>>` => `ast::Arm.pat: P<Pat>`

   - Change `ast::ExprKind::Let.0: Vec<P<Pat>>` => `ast::ExprKind::Let.0: P<Pat>`

- Adjust `librustc_resolve/late.rs` to correctly handle or-patterns at any level of nesting as a result.

  In particular, the already-bound check which rejects e.g. `let (a, a);` now accounts for or-patterns. The consistency checking (ensures no missing bindings and binding mode consistency) also now accounts for or-patterns. In the process, a bug was found in the current compiler which allowed:

   ```rust
   enum E<T> { A(T, T), B(T) }
   use E::*;
   fn foo() {
       match A(0, 1) {
           B(mut a) | A(mut a, mut a) => {}
       }
   }
   ```

   The new algorithms took a few iterations to get right. I tried several clever schemes but ultimately a version based on a stack of hashsets and recording product/sum contexts was chosen since it is more clearly correct.

- Clean up `librustc_resolve/late.rs` by, among other things, using a new `with_rib` function to better ensure stack dicipline.

- Do not push the change in AST to HIR for now to avoid doing too much in this PR. To cope with  this, we introduce a temporary hack in `rustc::hir::lowering` (clearly marked in the diff).

cc rust-lang#54883
cc @dlrobertson @matthewjasper
r? @petrochenkov
@Centril Centril referenced this pull request Sep 5, 2019
Centril added a commit to Centril/rust that referenced this pull request Sep 5, 2019
Rollup merge of rust-lang#64111 - Centril:ast-only-patkind-or, r=petr…
…ochenkov

or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve

Following up on work in rust-lang#63693 and rust-lang#61708, in this PR we:

- Uniformly use `PatKind::Or(...)` in AST:

   - Change `ast::Arm.pats: Vec<P<Pat>>` => `ast::Arm.pat: P<Pat>`

   - Change `ast::ExprKind::Let.0: Vec<P<Pat>>` => `ast::ExprKind::Let.0: P<Pat>`

- Adjust `librustc_resolve/late.rs` to correctly handle or-patterns at any level of nesting as a result.

  In particular, the already-bound check which rejects e.g. `let (a, a);` now accounts for or-patterns. The consistency checking (ensures no missing bindings and binding mode consistency) also now accounts for or-patterns. In the process, a bug was found in the current compiler which allowed:

   ```rust
   enum E<T> { A(T, T), B(T) }
   use E::*;
   fn foo() {
       match A(0, 1) {
           B(mut a) | A(mut a, mut a) => {}
       }
   }
   ```

   The new algorithms took a few iterations to get right. I tried several clever schemes but ultimately a version based on a stack of hashsets and recording product/sum contexts was chosen since it is more clearly correct.

- Clean up `librustc_resolve/late.rs` by, among other things, using a new `with_rib` function to better ensure stack dicipline.

- Do not push the change in AST to HIR for now to avoid doing too much in this PR. To cope with  this, we introduce a temporary hack in `rustc::hir::lowering` (clearly marked in the diff).

cc rust-lang#54883
cc @dlrobertson @matthewjasper
r? @petrochenkov
@Centril Centril referenced this pull request Sep 5, 2019
bors added a commit that referenced this pull request Sep 5, 2019
Auto merge of #64182 - Centril:rollup-fmohja1, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #63676 (Use wasi crate for Core API)
 - #64094 (Improve searching in rustdoc and add tests)
 - #64111 (or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve)
 - #64156 (Assume non-git LLVM is fresh if the stamp file exists)
 - #64175 (Fix invalid span generation when it should be div)

Failed merges:

 - #63806 (Upgrade rand to 0.7)

r? @ghost
bors added a commit that referenced this pull request Sep 5, 2019
Auto merge of #64182 - Centril:rollup-fmohja1, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #63676 (Use wasi crate for Core API)
 - #64094 (Improve searching in rustdoc and add tests)
 - #64111 (or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve)
 - #64156 (Assume non-git LLVM is fresh if the stamp file exists)
 - #64175 (Fix invalid span generation when it should be div)

Failed merges:

 - #63806 (Upgrade rand to 0.7)

r? @ghost
bors added a commit that referenced this pull request Sep 6, 2019
Auto merge of #64182 - Centril:rollup-fmohja1, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #63676 (Use wasi crate for Core API)
 - #64094 (Improve searching in rustdoc and add tests)
 - #64111 (or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve)
 - #64156 (Assume non-git LLVM is fresh if the stamp file exists)
 - #64175 (Fix invalid span generation when it should be div)

Failed merges:

 - #63806 (Upgrade rand to 0.7)

r? @ghost
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Sep 6, 2019
Rollup merge of rust-lang#64111 - Centril:ast-only-patkind-or, r=petr…
…ochenkov

or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve

Following up on work in rust-lang#63693 and rust-lang#61708, in this PR we:

- Uniformly use `PatKind::Or(...)` in AST:

   - Change `ast::Arm.pats: Vec<P<Pat>>` => `ast::Arm.pat: P<Pat>`

   - Change `ast::ExprKind::Let.0: Vec<P<Pat>>` => `ast::ExprKind::Let.0: P<Pat>`

- Adjust `librustc_resolve/late.rs` to correctly handle or-patterns at any level of nesting as a result.

  In particular, the already-bound check which rejects e.g. `let (a, a);` now accounts for or-patterns. The consistency checking (ensures no missing bindings and binding mode consistency) also now accounts for or-patterns. In the process, a bug was found in the current compiler which allowed:

   ```rust
   enum E<T> { A(T, T), B(T) }
   use E::*;
   fn foo() {
       match A(0, 1) {
           B(mut a) | A(mut a, mut a) => {}
       }
   }
   ```

   The new algorithms took a few iterations to get right. I tried several clever schemes but ultimately a version based on a stack of hashsets and recording product/sum contexts was chosen since it is more clearly correct.

- Clean up `librustc_resolve/late.rs` by, among other things, using a new `with_rib` function to better ensure stack dicipline.

- Do not push the change in AST to HIR for now to avoid doing too much in this PR. To cope with  this, we introduce a temporary hack in `rustc::hir::lowering` (clearly marked in the diff).

cc rust-lang#54883
cc @dlrobertson @matthewjasper
r? @petrochenkov
bors added a commit that referenced this pull request Sep 6, 2019
Auto merge of #64200 - Mark-Simulacrum:rollup-17sz11e, r=Mark-Simulacrum
Rollup of 13 pull requests

Successful merges:

 - #63676 (Use wasi crate for Core API)
 - #64019 (Update libc to 0.2.62)
 - #64052 (Rename test locals to work around LLDB bug)
 - #64094 (Improve searching in rustdoc and add tests)
 - #64096 (Fix regex replacement in theme detection)
 - #64111 (or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve)
 - #64156 (Assume non-git LLVM is fresh if the stamp file exists)
 - #64166 (Better way of conditioning the sanitizer builds)
 - #64171 (Update Clippy)
 - #64175 (Fix invalid span generation when it should be div)
 - #64186 (std: Improve downstream codegen in `Command::env`)
 - #64190 (fill metadata in rustc_lexer's Cargo.toml)
 - #64198 (Add Fuchsia to actually_monotonic)

Failed merges:

 - #63806 (Upgrade rand to 0.7)

r? @ghost
Centril added a commit to Centril/rust that referenced this pull request Sep 6, 2019
Rollup merge of rust-lang#64111 - Centril:ast-only-patkind-or, r=petr…
…ochenkov

or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve

Following up on work in rust-lang#63693 and rust-lang#61708, in this PR we:

- Uniformly use `PatKind::Or(...)` in AST:

   - Change `ast::Arm.pats: Vec<P<Pat>>` => `ast::Arm.pat: P<Pat>`

   - Change `ast::ExprKind::Let.0: Vec<P<Pat>>` => `ast::ExprKind::Let.0: P<Pat>`

- Adjust `librustc_resolve/late.rs` to correctly handle or-patterns at any level of nesting as a result.

  In particular, the already-bound check which rejects e.g. `let (a, a);` now accounts for or-patterns. The consistency checking (ensures no missing bindings and binding mode consistency) also now accounts for or-patterns. In the process, a bug was found in the current compiler which allowed:

   ```rust
   enum E<T> { A(T, T), B(T) }
   use E::*;
   fn foo() {
       match A(0, 1) {
           B(mut a) | A(mut a, mut a) => {}
       }
   }
   ```

   The new algorithms took a few iterations to get right. I tried several clever schemes but ultimately a version based on a stack of hashsets and recording product/sum contexts was chosen since it is more clearly correct.

- Clean up `librustc_resolve/late.rs` by, among other things, using a new `with_rib` function to better ensure stack dicipline.

- Do not push the change in AST to HIR for now to avoid doing too much in this PR. To cope with  this, we introduce a temporary hack in `rustc::hir::lowering` (clearly marked in the diff).

cc rust-lang#54883
cc @dlrobertson @matthewjasper
r? @petrochenkov
bors added a commit that referenced this pull request Sep 6, 2019
Auto merge of #64209 - Centril:rollup-x9kvjb7, r=Centril
Rollup of 10 pull requests

Successful merges:

 - #63676 (Use wasi crate for Core API)
 - #64094 (Improve searching in rustdoc and add tests)
 - #64111 (or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve)
 - #64156 (Assume non-git LLVM is fresh if the stamp file exists)
 - #64161 (Point at variant on pattern field count mismatch)
 - #64174 (Add missing code examples on Iterator trait)
 - #64175 (Fix invalid span generation when it should be div)
 - #64186 (std: Improve downstream codegen in `Command::env`)
 - #64190 (fill metadata in rustc_lexer's Cargo.toml)
 - #64198 (Add Fuchsia to actually_monotonic)

Failed merges:

r? @ghost

@bors bors merged commit 16ba502 into rust-lang:master Sep 6, 2019

4 checks passed

pr Build #20190905.14 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-6.0) Linux x86_64-gnu-llvm-6.0 succeeded
Details
pr (LinuxTools) LinuxTools succeeded
Details

@Centril Centril deleted the Centril:ast-only-patkind-or branch Sep 6, 2019

mati865 added a commit to mati865/rust-clippy that referenced this pull request Sep 6, 2019
bors added a commit to rust-lang/rust-clippy that referenced this pull request Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.