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

Reduce amount of errors given unclosed delimiter #65838

Merged
merged 2 commits into from Nov 4, 2019

Conversation

@estebank
Copy link
Contributor

estebank commented Oct 26, 2019

When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it on a more granular way in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.

Fix #63690.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Oct 26, 2019

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@estebank

This comment has been minimized.

Copy link
Contributor Author

estebank commented Oct 26, 2019

@rust-highfive rust-highfive assigned Centril and unassigned eddyb Oct 26, 2019
src/libsyntax/parse/parser.rs Outdated Show resolved Hide resolved
src/libsyntax/parse/mod.rs Outdated Show resolved Hide resolved
src/libsyntax/parse/parser/diagnostics.rs Outdated Show resolved Hide resolved
src/libsyntax/parse/parser/diagnostics.rs Outdated Show resolved Hide resolved
src/libsyntax/parse/parser/diagnostics.rs Outdated Show resolved Hide resolved
@@ -1520,14 +1522,15 @@ impl<'a> Parser<'a> {
if self.eat(&token::OpenDelim(token::Brace)) {
while self.token != token::CloseDelim(token::Brace) {
let field = self.parse_struct_decl_field().map_err(|e| {
self.recover_stmt();
self.consume_block(token::Brace, false);

This comment has been minimized.

Copy link
@Centril

Centril Oct 26, 2019

Member

Btw... this function and friends are a mess; I tried to convert this to use the list parsing utilities before but the success was not complete; I'll probably give it a go some time in the future.

src/test/ui/did_you_mean/issue-40006.rs Show resolved Hide resolved
src/test/ui/parser/issue-62973.stderr Show resolved Hide resolved
@Centril

This comment has been minimized.

Copy link
Member

Centril commented Oct 26, 2019

src/libsyntax/parse/parser.rs Outdated Show resolved Hide resolved
@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Oct 26, 2019

The job x86_64-gnu-llvm-6.0 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.
2019-10-26T20:48:39.1880666Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-26T20:48:39.2113769Z ##[command]git config gc.auto 0
2019-10-26T20:48:39.2203105Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-26T20:48:39.2267759Z ##[command]git config --get-all http.proxy
2019-10-26T20:48:39.2449097Z ##[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/65838/merge:refs/remotes/pull/65838/merge
---
2019-10-26T21:52:37.5851608Z .................................................................................................... 1600/9254
2019-10-26T21:52:43.5960270Z .................................................................................................... 1700/9254
2019-10-26T21:52:57.2116789Z ........................................................i...............i........................... 1800/9254
2019-10-26T21:53:05.3207148Z .................................................................................................... 1900/9254
2019-10-26T21:53:21.1553415Z ..............................................iiiii................................................. 2000/9254
2019-10-26T21:53:32.8533688Z .................................................................................................... 2200/9254
2019-10-26T21:53:35.6076887Z .................................................................................................... 2300/9254
2019-10-26T21:53:39.9061107Z .................................................................................................... 2400/9254
2019-10-26T21:54:04.7059552Z .................................................................................................... 2500/9254
---
2019-10-26T21:57:08.7975372Z .................................................i...............i.................................. 4800/9254
2019-10-26T21:57:18.6208195Z .................................................................................................... 4900/9254
2019-10-26T21:57:27.6460205Z .................................................................................................... 5000/9254
2019-10-26T21:57:34.4693948Z .................................................................................................... 5100/9254
2019-10-26T21:57:45.7603757Z ..................................................ii.ii...........i................................. 5200/9254
2019-10-26T21:57:56.3885650Z .................................................................................................... 5400/9254
2019-10-26T21:58:06.2949798Z .................................................................................................... 5500/9254
2019-10-26T21:58:14.8047426Z ....................i............................................................................... 5600/9254
2019-10-26T21:58:20.8243714Z .................................................................................................... 5700/9254
2019-10-26T21:58:20.8243714Z .................................................................................................... 5700/9254
2019-10-26T21:58:33.8953426Z .................................................................................................... 5800/9254
2019-10-26T21:58:46.0190381Z .................ii...i..ii...........i............................................................. 5900/9254
2019-10-26T21:59:09.2685870Z .................................................................................................... 6100/9254
2019-10-26T21:59:18.4445058Z .................................................................................................... 6200/9254
2019-10-26T21:59:18.4445058Z .................................................................................................... 6200/9254
2019-10-26T21:59:33.5750550Z ........................................i..ii....................................................... 6300/9254
2019-10-26T21:59:57.4298138Z .................................................................................................... 6500/9254
2019-10-26T21:59:59.8193364Z ......i............................................................................................. 6600/9254
2019-10-26T22:00:02.2607516Z ................................................................................F...i............... 6700/9254
2019-10-26T22:00:05.1446369Z .................................................................................................... 6800/9254
---
2019-10-26T22:04:19.7981578Z ..........................................................i......................................... 9200/9254
2019-10-26T22:04:31.3004696Z ......................................................
2019-10-26T22:04:31.3006073Z failures:
2019-10-26T22:04:31.3052587Z 
2019-10-26T22:04:31.3053477Z ---- [ui] ui/parser/mismatched-braces/missing-close-brace-in-struct.rs stdout ----
2019-10-26T22:04:31.3054109Z 
2019-10-26T22:04:31.3054352Z 12    |
2019-10-26T22:04:31.3054352Z 12    |
2019-10-26T22:04:31.3054585Z 13 LL | trait T {
2019-10-26T22:04:31.3055291Z +    |
2019-10-26T22:04:31.3055507Z 15 help: you can escape reserved keywords to use them as identifiers
2019-10-26T22:04:31.3055907Z 16    |
2019-10-26T22:04:31.3055907Z 16    |
2019-10-26T22:04:31.3056110Z 17 LL | r#trait T {
2019-10-26T22:04:31.3056499Z 
2019-10-26T22:04:31.3056724Z The actual stderr differed from the expected stderr.
2019-10-26T22:04:31.3056724Z The actual stderr differed from the expected stderr.
2019-10-26T22:04:31.3057314Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/mismatched-braces/missing-close-brace-in-struct/missing-close-brace-in-struct.stderr
2019-10-26T22:04:31.3057903Z To update references, rerun the tests and pass the `--bless` flag
2019-10-26T22:04:31.3058525Z To only update this specific test, also pass `--test-args parser/mismatched-braces/missing-close-brace-in-struct.rs`
2019-10-26T22:04:31.3059050Z error: 1 errors occurred comparing output.
2019-10-26T22:04:31.3059269Z status: exit code: 1
2019-10-26T22:04:31.3059269Z status: exit code: 1
2019-10-26T22:04:31.3060629Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.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/parser/mismatched-braces/missing-close-brace-in-struct" "-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/parser/mismatched-braces/missing-close-brace-in-struct/auxiliary" "-A" "unused"
2019-10-26T22:04:31.3062150Z ------------------------------------------
2019-10-26T22:04:31.3062431Z 
2019-10-26T22:04:31.3062940Z ------------------------------------------
2019-10-26T22:04:31.3063519Z stderr:
2019-10-26T22:04:31.3063519Z stderr:
2019-10-26T22:04:31.3064042Z ------------------------------------------
2019-10-26T22:04:31.3064751Z error: this file contains an un-closed delimiter
2019-10-26T22:04:31.3065297Z   --> /checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs:14:66
2019-10-26T22:04:31.3065567Z    |
2019-10-26T22:04:31.3065813Z LL | pub(crate) struct Bar<T> { //~ ERROR `main` function not found
2019-10-26T22:04:31.3066258Z    |                          - un-closed delimiter
2019-10-26T22:04:31.3067001Z LL | fn main() {} //~ ERROR this file contains an un-closed delimiter
2019-10-26T22:04:31.3067290Z    |                                                                  ^
2019-10-26T22:04:31.3067490Z 
2019-10-26T22:04:31.3067737Z error: expected identifier, found keyword `trait`
2019-10-26T22:04:31.3067737Z error: expected identifier, found keyword `trait`
2019-10-26T22:04:31.3068224Z   --> /checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs:4:1
2019-10-26T22:04:31.3068490Z    |
2019-10-26T22:04:31.3068733Z LL | trait T { //~ ERROR expected identifier, found keyword `trait`
2019-10-26T22:04:31.3069704Z    |
2019-10-26T22:04:31.3070091Z help: you can escape reserved keywords to use them as identifiers
2019-10-26T22:04:31.3070307Z    |
2019-10-26T22:04:31.3070307Z    |
2019-10-26T22:04:31.3071129Z LL | r#trait T { //~ ERROR expected identifier, found keyword `trait`
2019-10-26T22:04:31.3071602Z 
2019-10-26T22:04:31.3071602Z 
2019-10-26T22:04:31.3071835Z error: expected `:`, found `T`
2019-10-26T22:04:31.3072423Z   --> /checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs:4:7
2019-10-26T22:04:31.3072883Z    |
2019-10-26T22:04:31.3073201Z LL | trait T { //~ ERROR expected identifier, found keyword `trait`
2019-10-26T22:04:31.3073449Z    |       ^ expected `:`
2019-10-26T22:04:31.3073790Z 
2019-10-26T22:04:31.3074198Z error[E0601]: `main` function not found in crate `missing_close_brace_in_struct`
2019-10-26T22:04:31.3074734Z   --> /checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs:1:1
2019-10-26T22:04:31.3075012Z    |
2019-10-26T22:04:31.3075424Z LL | / pub(crate) struct Bar<T> { //~ ERROR `main` function not found
2019-10-26T22:04:31.3075652Z LL | |   foo: T,
2019-10-26T22:04:31.3075864Z LL | |
2019-10-26T22:04:31.3076109Z LL | | trait T { //~ ERROR expected identifier, found keyword `trait`
2019-10-26T22:04:31.3076721Z LL | |
2019-10-26T22:04:31.3077762Z LL | | fn main() {} //~ ERROR this file contains an un-closed delimiter
2019-10-26T22:04:31.3077762Z LL | | fn main() {} //~ ERROR this file contains an un-closed delimiter
2019-10-26T22:04:31.3079677Z    | |_________________________________________________________________^ consider adding a `main` function to `/checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-struct.rs`
2019-10-26T22:04:31.3081754Z error: aborting due to 4 previous errors
2019-10-26T22:04:31.3081796Z 
2019-10-26T22:04:31.3082158Z For more information about this error, try `rustc --explain E0601`.
2019-10-26T22:04:31.3082216Z 
2019-10-26T22:04:31.3082216Z 
2019-10-26T22:04:31.3082453Z ------------------------------------------
2019-10-26T22:04:31.3082484Z 
2019-10-26T22:04:31.3082510Z 
2019-10-26T22:04:31.3082536Z 
2019-10-26T22:04:31.3082594Z failures:
2019-10-26T22:04:31.3082852Z     [ui] ui/parser/mismatched-braces/missing-close-brace-in-struct.rs
2019-10-26T22:04:31.3083190Z test result: FAILED. 9212 passed; 1 failed; 41 ignored; 0 measured; 0 filtered out
2019-10-26T22:04:31.3083226Z 
2019-10-26T22:04:31.3091918Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-10-26T22:04:31.3092018Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-26T22:04:31.3092018Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-26T22:04:31.3117618Z 
2019-10-26T22:04:31.3117722Z 
2019-10-26T22:04:31.3119320Z 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"
2019-10-26T22:04:31.3119605Z 
2019-10-26T22:04:31.3119632Z 
2019-10-26T22:04:31.3146656Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-10-26T22:04:31.3146739Z Build completed unsuccessfully in 1:08:41
2019-10-26T22:04:31.3146739Z Build completed unsuccessfully in 1:08:41
2019-10-26T22:04:31.3176661Z == clock drift check ==
2019-10-26T22:04:31.3191613Z   local time: Sat Oct 26 22:04:31 UTC 2019
2019-10-26T22:04:31.4047747Z   network time: Sat, 26 Oct 2019 22:04:31 GMT
2019-10-26T22:04:31.4052533Z == end clock drift check ==
2019-10-26T22:04:32.3885449Z 
2019-10-26T22:04:32.3973728Z ##[error]Bash exited with code '1'.
2019-10-26T22:04:32.4028008Z ##[section]Starting: Checkout
2019-10-26T22:04:32.4032434Z ==============================================================================
2019-10-26T22:04:32.4032498Z Task         : Get sources
2019-10-26T22:04:32.4032564Z 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)

@estebank estebank force-pushed the estebank:resilient-recovery branch from 177db47 to 482e245 Oct 26, 2019
@estebank estebank changed the title Reduce ammount of errors given unclosed delimiter Reduce amount of errors given unclosed delimiter Oct 29, 2019
@estebank estebank force-pushed the estebank:resilient-recovery branch from bd19be1 to ba25cfe Oct 29, 2019
src/libsyntax/parse/mod.rs Outdated Show resolved Hide resolved
src/librustc_passes/entry.rs Show resolved Hide resolved
@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Oct 29, 2019

The job x86_64-gnu-llvm-6.0 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.
2019-10-29T01:03:57.1723600Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-29T01:03:57.1914548Z ##[command]git config gc.auto 0
2019-10-29T01:03:57.1988382Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-29T01:03:57.2042294Z ##[command]git config --get-all http.proxy
2019-10-29T01:03:57.2179629Z ##[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/65838/merge:refs/remotes/pull/65838/merge
---
2019-10-29T02:05:08.6493612Z .................................................................................................... 1600/9262
2019-10-29T02:05:14.8401762Z .................................................................................................... 1700/9262
2019-10-29T02:05:28.0289455Z ..........................................................i...............i......................... 1800/9262
2019-10-29T02:05:36.2541404Z .................................................................................................... 1900/9262
2019-10-29T02:05:52.3321545Z ................................................iiiii............................................... 2000/9262
2019-10-29T02:06:03.9615919Z .................................................................................................... 2200/9262
2019-10-29T02:06:06.7582108Z .................................................................................................... 2300/9262
2019-10-29T02:06:10.9245658Z .................................................................................................... 2400/9262
2019-10-29T02:06:36.5907670Z .................................................................................................... 2500/9262
---
2019-10-29T02:09:38.1350424Z .................................................i...............i.................................. 4800/9262
2019-10-29T02:09:47.8290231Z .................................................................................................... 4900/9262
2019-10-29T02:09:57.1103718Z .................................................................................................... 5000/9262
2019-10-29T02:10:03.8727938Z .................................................................................................... 5100/9262
2019-10-29T02:10:15.2239632Z ..................................................ii.ii...........i................................. 5200/9262
2019-10-29T02:10:25.6192772Z .................................................................................................... 5400/9262
2019-10-29T02:10:35.5752517Z .................................................................................................... 5500/9262
2019-10-29T02:10:43.9138668Z ....................i............................................................................... 5600/9262
2019-10-29T02:10:50.3029389Z .................................................................................................... 5700/9262
2019-10-29T02:10:50.3029389Z .................................................................................................... 5700/9262
2019-10-29T02:11:02.7353329Z .................................................................................................... 5800/9262
2019-10-29T02:11:15.5857698Z .....ii...i..ii...........i......................................................................... 5900/9262
2019-10-29T02:11:38.2661347Z .................................................................................................... 6100/9262
2019-10-29T02:11:44.7104330Z .................................................................................................... 6200/9262
2019-10-29T02:11:44.7104330Z .................................................................................................... 6200/9262
2019-10-29T02:11:59.6534680Z ........................i..ii....................................................................... 6300/9262
2019-10-29T02:12:20.9428047Z ..........................................................................................i......... 6500/9262
2019-10-29T02:12:23.3862986Z .................................................................................................... 6600/9262
2019-10-29T02:12:25.8115801Z ...............................................................F..F.i............................... 6700/9262
2019-10-29T02:12:28.9099939Z .................................................................................................... 6800/9262
---
2019-10-29T02:16:35.3137493Z ..................................................................i................................. 9200/9262
2019-10-29T02:16:46.7984760Z ..............................................................
2019-10-29T02:16:46.7985688Z failures:
2019-10-29T02:16:46.8022566Z 
2019-10-29T02:16:46.8023319Z ---- [ui] ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs stdout ----
2019-10-29T02:16:46.8024042Z 
2019-10-29T02:16:46.8024199Z 7 LL |
2019-10-29T02:16:46.8024341Z 8    |                                                     ^
2019-10-29T02:16:46.8024737Z 9 
2019-10-29T02:16:46.8024737Z 9 
2019-10-29T02:16:46.8025248Z - error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `trait`
2019-10-29T02:16:46.8025477Z + error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found keyword `trait`
2019-10-29T02:16:46.8025872Z 11   --> $DIR/missing-close-brace-in-impl-trait.rs:5:1
2019-10-29T02:16:46.8026082Z 12    |
2019-10-29T02:16:46.8026244Z 13 LL | impl T for () {
2019-10-29T02:16:46.8026484Z 
2019-10-29T02:16:46.8026643Z The actual stderr differed from the expected stderr.
2019-10-29T02:16:46.8026643Z The actual stderr differed from the expected stderr.
2019-10-29T02:16:46.8027140Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait/missing-close-brace-in-impl-trait.stderr
2019-10-29T02:16:46.8027854Z To update references, rerun the tests and pass the `--bless` flag
2019-10-29T02:16:46.8028450Z To only update this specific test, also pass `--test-args parser/mismatched-braces/missing-close-brace-in-impl-trait.rs`
2019-10-29T02:16:46.8028804Z error: 1 errors occurred comparing output.
2019-10-29T02:16:46.8028954Z status: exit code: 1
2019-10-29T02:16:46.8028954Z status: exit code: 1
2019-10-29T02:16:46.8029972Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.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/parser/mismatched-braces/missing-close-brace-in-impl-trait" "-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/parser/mismatched-braces/missing-close-brace-in-impl-trait/auxiliary" "-A" "unused"
2019-10-29T02:16:46.8030896Z ------------------------------------------
2019-10-29T02:16:46.8031062Z 
2019-10-29T02:16:46.8031434Z ------------------------------------------
2019-10-29T02:16:46.8031631Z stderr:
2019-10-29T02:16:46.8031631Z stderr:
2019-10-29T02:16:46.8031998Z ------------------------------------------
2019-10-29T02:16:46.8032400Z error: this file contains an un-closed delimiter
2019-10-29T02:16:46.8033023Z   --> /checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs:12:53
2019-10-29T02:16:46.8033219Z    |
2019-10-29T02:16:46.8033363Z LL | impl T for () { //~ ERROR cannot find trait `T` in this scope
2019-10-29T02:16:46.8033730Z    |               - un-closed delimiter
2019-10-29T02:16:46.8034251Z LL | //~ ERROR this file contains an un-closed delimiter
2019-10-29T02:16:46.8034420Z    |                                                     ^
2019-10-29T02:16:46.8034536Z 
2019-10-29T02:16:46.8034536Z 
2019-10-29T02:16:46.8034696Z error: expected one of `async`, `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found keyword `trait`
2019-10-29T02:16:46.8035094Z   --> /checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs:5:1
2019-10-29T02:16:46.8035266Z    |
2019-10-29T02:16:46.8035442Z LL | impl T for () { //~ ERROR cannot find trait `T` in this scope
2019-10-29T02:16:46.8035932Z LL | 
2019-10-29T02:16:46.8036084Z LL | fn foo(&self) {}
2019-10-29T02:16:46.8036520Z    |                 -
2019-10-29T02:16:46.8036737Z    |                 |
2019-10-29T02:16:46.8036737Z    |                 |
2019-10-29T02:16:46.8036876Z    |                 expected one of 10 possible tokens here
2019-10-29T02:16:46.8037015Z    |                 help: `}` may belong here
2019-10-29T02:16:46.8037160Z LL | 
2019-10-29T02:16:46.8037292Z LL | trait T { //~ ERROR expected one of
2019-10-29T02:16:46.8037555Z 
2019-10-29T02:16:46.8038129Z error[E0405]: cannot find trait `T` in this scope
2019-10-29T02:16:46.8038129Z error[E0405]: cannot find trait `T` in this scope
2019-10-29T02:16:46.8038603Z   --> /checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs:1:6
2019-10-29T02:16:46.8038806Z    |
2019-10-29T02:16:46.8038946Z LL | impl T for () { //~ ERROR cannot find trait `T` in this scope
2019-10-29T02:16:46.8039087Z    |      ^ not found in this scope
2019-10-29T02:16:46.8039363Z error: aborting due to 3 previous errors
2019-10-29T02:16:46.8039480Z 
2019-10-29T02:16:46.8039873Z For more information about this error, try `rustc --explain E0405`.
2019-10-29T02:16:46.8040059Z 
2019-10-29T02:16:46.8040059Z 
2019-10-29T02:16:46.8040407Z ------------------------------------------
2019-10-29T02:16:46.8040905Z 
2019-10-29T02:16:46.8041314Z 
2019-10-29T02:16:46.8042351Z ---- [ui] ui/parser/mismatched-braces/missing-close-brace-in-trait.rs stdout ----
2019-10-29T02:16:46.8042459Z 
2019-10-29T02:16:46.8042500Z 7 LL | fn main() {}
2019-10-29T02:16:46.8042548Z 8    |                                                                  ^
2019-10-29T02:16:46.8042592Z 9 
2019-10-29T02:16:46.8042592Z 9 
2019-10-29T02:16:46.8042876Z - error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found `pub`
2019-10-29T02:16:46.8042936Z + error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found keyword `pub`
2019-10-29T02:16:46.8043547Z 11   --> $DIR/missing-close-brace-in-trait.rs:4:1
2019-10-29T02:16:46.8043612Z 12    |
2019-10-29T02:16:46.8043652Z 13 LL | trait T {
2019-10-29T02:16:46.8043840Z 
2019-10-29T02:16:46.8043902Z The actual stderr differed from the expected stderr.
2019-10-29T02:16:46.8043902Z The actual stderr differed from the expected stderr.
2019-10-29T02:16:46.8044505Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/parser/mismatched-braces/missing-close-brace-in-trait/missing-close-brace-in-trait.stderr
2019-10-29T02:16:46.8044763Z To update references, rerun the tests and pass the `--bless` flag
2019-10-29T02:16:46.8045188Z To only update this specific test, also pass `--test-args parser/mismatched-braces/missing-close-brace-in-trait.rs`
2019-10-29T02:16:46.8045283Z error: 1 errors occurred comparing output.
2019-10-29T02:16:46.8045351Z status: exit code: 1
2019-10-29T02:16:46.8045351Z status: exit code: 1
2019-10-29T02:16:46.8046192Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.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/parser/mismatched-braces/missing-close-brace-in-trait" "-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/parser/mismatched-braces/missing-close-brace-in-trait/auxiliary" "-A" "unused"
2019-10-29T02:16:46.8046568Z ------------------------------------------
2019-10-29T02:16:46.8046608Z 
2019-10-29T02:16:46.8046862Z ------------------------------------------
2019-10-29T02:16:46.8046910Z stderr:
2019-10-29T02:16:46.8046910Z stderr:
2019-10-29T02:16:46.8047141Z ------------------------------------------
2019-10-29T02:16:46.8047658Z error: this file contains an un-closed delimiter
2019-10-29T02:16:46.8047937Z   --> /checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs:10:66
2019-10-29T02:16:46.8047992Z    |
2019-10-29T02:16:46.8048060Z LL | trait T {
2019-10-29T02:16:46.8048273Z    |         - un-closed delimiter
2019-10-29T02:16:46.8048740Z LL | fn main() {} //~ ERROR this file contains an un-closed delimiter
2019-10-29T02:16:46.8048799Z    |                                                                  ^
2019-10-29T02:16:46.8048832Z 
2019-10-29T02:16:46.8048832Z 
2019-10-29T02:16:46.8048882Z error: expected one of `async`, `const`, `extern`, `fn`, `type`, `unsafe`, or `}`, found keyword `pub`
2019-10-29T02:16:46.8049173Z   --> /checkout/src/test/ui/parser/mismatched-braces/missing-close-brace-in-trait.rs:4:1
2019-10-29T02:16:46.8049227Z    |
2019-10-29T02:16:46.8049272Z LL | trait T {
2019-10-29T02:16:46.8049566Z LL |     fn foo(&self);
2019-10-29T02:16:46.8049777Z    |                   -
2019-10-29T02:16:46.8049845Z    |                   |
2019-10-29T02:16:46.8049896Z    |                   expected one of 7 possible tokens here
2019-10-29T02:16:46.8049896Z    |                   expected one of 7 possible tokens here
2019-10-29T02:16:46.8049949Z    |                   help: `}` may belong here
2019-10-29T02:16:46.8050011Z LL | 
2019-10-29T02:16:46.8050079Z LL | pub(crate) struct Bar<T>(); //~ ERROR expected one of
2019-10-29T02:16:46.8050160Z 
2019-10-29T02:16:46.8050223Z error: aborting due to 2 previous errors
2019-10-29T02:16:46.8050256Z 
2019-10-29T02:16:46.8050283Z 
2019-10-29T02:16:46.8050283Z 
2019-10-29T02:16:46.8050526Z ------------------------------------------
2019-10-29T02:16:46.8050561Z 
2019-10-29T02:16:46.8050605Z 
2019-10-29T02:16:46.8050632Z 
2019-10-29T02:16:46.8050674Z failures:
2019-10-29T02:16:46.8050939Z     [ui] ui/parser/mismatched-braces/missing-close-brace-in-impl-trait.rs
2019-10-29T02:16:46.8051228Z     [ui] ui/parser/mismatched-braces/missing-close-brace-in-trait.rs
2019-10-29T02:16:46.8051548Z test result: FAILED. 9219 passed; 2 failed; 41 ignored; 0 measured; 0 filtered out
2019-10-29T02:16:46.8051586Z 
2019-10-29T02:16:46.8055792Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-10-29T02:16:46.8056019Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-29T02:16:46.8056019Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-29T02:16:46.8080467Z 
2019-10-29T02:16:46.8080657Z 
2019-10-29T02:16:46.8082571Z 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"
2019-10-29T02:16:46.8082856Z 
2019-10-29T02:16:46.8082887Z 
2019-10-29T02:16:46.8086604Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-10-29T02:16:46.8086708Z Build completed unsuccessfully in 1:05:44
2019-10-29T02:16:46.8086708Z Build completed unsuccessfully in 1:05:44
2019-10-29T02:16:46.8141618Z == clock drift check ==
2019-10-29T02:16:46.8153153Z   local time: Tue Oct 29 02:16:46 UTC 2019
2019-10-29T02:16:46.9608179Z   network time: Tue, 29 Oct 2019 02:16:46 GMT
2019-10-29T02:16:46.9611038Z == end clock drift check ==
2019-10-29T02:16:48.0784272Z 
2019-10-29T02:16:48.0909441Z ##[error]Bash exited with code '1'.
2019-10-29T02:16:48.0956440Z ##[section]Starting: Checkout
2019-10-29T02:16:48.0958609Z ==============================================================================
2019-10-29T02:16:48.0958667Z Task         : Get sources
2019-10-29T02:16:48.0958733Z 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)

@estebank estebank force-pushed the estebank:resilient-recovery branch from ba25cfe to d6a0b3c Oct 29, 2019
@Centril

This comment has been minimized.

Copy link
Member

Centril commented Oct 30, 2019

Thanks; this looks good. r=me with commits reasonably squashed in some manner (into one or as you see fit).

estebank added 2 commits Oct 26, 2019
When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it more granularly in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.
@estebank estebank force-pushed the estebank:resilient-recovery branch from d6a0b3c to 454e2aa Oct 30, 2019
@estebank

This comment has been minimized.

Copy link
Contributor Author

estebank commented Oct 30, 2019

@bors r=Centril

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Oct 30, 2019

📌 Commit 454e2aa has been approved by Centril

tmandry added a commit to tmandry/rust that referenced this pull request Nov 1, 2019
Reduce amount of errors given unclosed delimiter

When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it on a more granular way in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.

Fix rust-lang#63690.
tmandry added a commit to tmandry/rust that referenced this pull request Nov 1, 2019
Reduce amount of errors given unclosed delimiter

When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it on a more granular way in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.

Fix rust-lang#63690.
bors added a commit that referenced this pull request Nov 1, 2019
Rollup of 5 pull requests

Successful merges:

 - #65759 (Validate error patterns and error annotation in ui tests when present)
 - #65838 (Reduce amount of errors given unclosed delimiter)
 - #65911 (Statically link libstdc++ on windows-gnu)
 - #65953 (Allow specifying LLVM's MCTargetOptions::ABIName in target specification files)
 - #66012 (De-querify `trivial_dropck_outlives`.)

Failed merges:

r? @ghost
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 4, 2019

⌛️ Testing commit 454e2aa with merge f49f388...

bors added a commit that referenced this pull request Nov 4, 2019
Reduce amount of errors given unclosed delimiter

When in a file with a non-terminated item, catch the error and consume
the block instead of trying to recover it on a more granular way in order to
reduce the amount of unrelated errors that would be fixed after adding
the missing closing brace. Also point out the possible location of the
missing closing brace.

Fix #63690.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Nov 4, 2019

☀️ Test successful - checks-azure
Approved by: Centril
Pushing f49f388 to master...

@bors bors added the merged-by-bors label Nov 4, 2019
@bors bors merged commit 454e2aa into rust-lang:master Nov 4, 2019
5 checks passed
5 checks passed
homu Test successful
Details
pr Build #20191030.68 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 (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
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.