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

in which we check for confusable Unicodepoints in float literal exponent #49989

Conversation

zackmdavis
Copy link
Member

The FatalError.raise() might seem unmotivated (in most places in
the compiler, err.emit() suffices), but it's actually used to
maintain behavior (viz., stop lexing, don't emit potentially spurious
errors looking for the next token after the bad Unicodepoint in the
exponent): the previous revision's self.err_span_ ultimately calls
Handler::emit, which aborts if the Handler's continue_after_error
flag is set, which seems to typically be true during lexing (see
phase_1_parse_input and and how CompileController::basic has
continue_parse_after_error: false in librustc_driver).

Also, let's avoid apostrophes in error messages (the present author
would argue that users expect a reassuringly detached, formal,
above-it-all tone from a Serious tool like a compiler), and use an
RLS-friendly structured suggestion.

Resolves #49746.

r? @estebank

The `FatalError.raise()` might seem unmotivated (in most places in
the compiler, `err.emit()` suffices), but it's actually used to
maintain behavior (viz., stop lexing, don't emit potentially spurious
errors looking for the next token after the bad Unicodepoint in the
exponent): the previous revision's `self.err_span_` ultimately calls
`Handler::emit`, which aborts if the `Handler`'s continue_after_error
flag is set, which seems to typically be true during lexing (see
`phase_1_parse_input` and and how `CompileController::basic` has
`continue_parse_after_error: false` in librustc_driver).

Also, let's avoid apostrophes in error messages (the present author
would argue that users expect a reassuringly detached, formal,
above-it-all tone from a Serious tool like a compiler), and use an
RLS-friendly structured suggestion.

Resolves rust-lang#49746.
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 15, 2018
@rust-highfive
Copy link
Collaborator

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.
[00:00:47] configure: rust.quiet-tests     := True
---
[00:44:50] .................................................................................i..................
[00:44:56] ........................i...........................................................................
---
[00:45:37] ........................i...........................................................................
[00:45:43] i...................................................................................................
[00:45:50] ..............ii....................................................................................
---
[00:46:35] .............................................i......................................................
---
[00:50:27] ..............................i.....................................................................
[00:50:41] ...............................................................i....................................
[00:50:56] .................................................i..................................................
[00:51:16] ....................................................................................................
[00:51:38] ....................................................................................................
[00:51:59] ....................................................................................................
[00:52:24] .......i............................................................................................
[00:52:52] ...i...................................................................................test [run-pass] run-pass/mir_heavy_promoted.rs has been running for over 60 seconds
[00:52:59] .............
[00:53:31] ....................................................................................................
[00:54:02] .....................................................................ii.............................
[00:54:53] ................................i....................................................i.ii...test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:54:56] ........
[00:55:38] .............................................................................................iiiiiii
---
[00:57:51] ...................i............................................................ii.iii..............
[00:57:59] ....................................................................................................
[00:58:06] ........i..............................i............................................................
[00:58:14] ....................................................................................................
[00:58:20] ..........i.........................................................................................
[00:58:28] ....................................................................................................
[00:58:38] ....................................................................................................
[00:58:48] ....................................................................................................
[00:58:58] ....................................................................................................
[00:59:12] ....................................................................................................
[00:59:20] ...i................................................................................................
[00:59:29] .......i..ii........................................................................................
[00:59:39] ....................................................................................................
[00:59:48] ....................................................................................................
[00:59:58] .........................................................................i..........................
[01:00:08] ...................i................................................................................
---
[01:00:42] ............................i.......................................................................
[01:00:43] .....................................................F..............i...............................
[01:00:44] ................i...........................................F...........
[01:00:44] failures:
[01:00:44]
[01:00:44] ---- [parse-fail] parse-fail/lex-bad-numeric-literals.rs stdout ----
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:15: expected error not found: octal float literal is not supported
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:25: expected error not found: hexadecimal float literal is not supported
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:26: expected error not found: int literal is too large
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:27: expected error not found: int literal is too large
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:28: expected error not found: no valid digits
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:29: expected error not found: no valid digits
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:30: expected error not found: no valid digits
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:31: expected error not found: no valid digits
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:32: expected error not found: no valid digits
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:33: expected error not found: octal float literal is not supported
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:34: expected error not found: octal float literal is not supported
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:35: expected error not found: binary float literal is not supported
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/lex-bad-numeric-literals.rs:36: expected error not found: binary float literal is not supported
[01:00:44]
[01:00:44] error: 0 unexpected errors found, 13 expected errors not found
[01:00:44] status: exit code: 101
[01:00:44] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/parse-fail/lex-bad-numeric-literals.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail" "--target=x86_64-unknown-linux-gnu" "--error-format" "jsoed"
[01:00:44]     }
[01:00:44] ]
[01:00:44]
[01:00:44] thread '[parse-fail] parse-fail/lex-bad-numeric-literals.rs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:1254:13
[01:00:44] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:00:44]
[01:00:44] ---- [parse-fail] parse-fail/unicode-chars.rs stdout ----
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/unicode-chars.rs:14: unexpected help message: '14:14: 14:15: Unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it is not'
[01:00:44]
[01:00:44] error: /checkout/src/test/parse-fail/unicode-chars.rs:14: expected help message not found: unicode character ';' (Greek Question Mark) looks like ';' (Semicolon), but it's not
[01:00:44]
[01:00:44] error: 1 unexpected errors found, 1 expected errors not found
[01:00:44] status: exit code: 101
[01:00:44] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/parse-fail/unicode-chars.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail/unicode-chars.stage2-x86_64-unknown-linux-gnu" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "parse-only" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/parse-fail/unicode-chars.stage2-x86_64-unknown-linux-gnu.aux"
[01:00:44] unexpected errors (from JSON output): [
[01:00:44]     Error {
[01:00:44]         line_num: 14,
[ei3hhuv/s-f05hjrxqjv-lta4um-3ssff2uugm5rt
109936 ./obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu
109932 ./obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release
106040 ./obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps
102812 ./obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends
102508 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-31lccp6wy7orz
102504 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-31lccp6wy7orz/s-f05imq1viy-1b9jmn-bcs1sclq83s
100744 ./obj/build/bootstrap/debug/incremental/bootstrap-zki88qpb4pjm
100740 ./obj/build/bootstrap/debug/incremental/bootstrap-zki88qpb4pjm/s-f05ip9ov4z-wrkc4m-2fm8hlvdg42qh
---
55760 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/incremental/syntax-33oa6nnkk1g08/s-f05iogumvd-1h40n44-2ne0q77addm7i

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
Copy link
Contributor

The failing test might be due to compile-flags: -Z parse-only -Z continue-parse-after-error, can you verify wether all those lines on their own do fail as expected with this PR?

@mark-i-m
Copy link
Member

👍 Intro programming students stumble over this all the time by copy/paste from a browser.

@TimNN TimNN 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 Apr 24, 2018
@TimNN
Copy link
Contributor

TimNN commented Apr 24, 2018

Friendly triage ping, @zackmdavis. What is the status of this PR? Could look into the test failure and @estebank's question?

@zackmdavis
Copy link
Member Author

Wednesday

@zackmdavis
Copy link
Member Author

update: too sleepy to fix now (extant Handler/DiagnosticBuilder APIs seemingly don't make it possible to simultaneously set a note/suggestion and respect Handler.continue_after_error, the least violent change necessary is best considered in a more alert state of mind)

@estebank
Copy link
Contributor

@zackmdavis no hurries. That restriction might merely be an oversight. If you see a path to fix it in this PR, feel free to go forward and add it, otherwise I would side step it and change the test to work regardless of continue_after_error.

@shepmaster
Copy link
Member

Ping from triage, @zackmdavis ! Making sure you still have time to work on this PR.

@pietroalbini
Copy link
Member

Thank you for this PR @zackmdavis! Unfortunately we haven't heard from you on this in a while, so I'm closing the PR to keep things tidy. Don't worry though, if you'll have time again in the future please reopen this PR, we'll be happy to review it again!

@pietroalbini pietroalbini added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 14, 2018
bors added a commit that referenced this pull request May 27, 2018
…exponent, r=eddyb

Check for confusable Unicode chars in float literal exponent

Fixing tests for #49989. Resolves #49746.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants