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

Fix the span for try shorthand expressions #32711

Merged
merged 1 commit into from
Apr 12, 2016
Merged

Fix the span for try shorthand expressions #32711

merged 1 commit into from
Apr 12, 2016

Conversation

marcusklaas
Copy link
Contributor

My five character contribution to the rust parser! Fixes #32709.

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

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

@jseyfried
Copy link
Contributor

Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 4, 2016

📌 Commit 081a7a9 has been approved by jseyfried

@nagisa
Copy link
Member

nagisa commented Apr 4, 2016

Needs a test.

@bors r-

@marcusklaas
Copy link
Contributor Author

@nagisa AFAIK, there is no way to test against regressions of overly long spans. If you know of a way, I'd be happy to write one!

@jseyfried
Copy link
Contributor

@marcusklaas I believe you can do something like this:

fn main() {
    a?; //~ ERROR 2:5: 2:7
}

@nikomatsakis
Copy link
Contributor

as @marcusklaas notes, we don't usually test these, though indeed we probably should... would be nice to add a more targeted way of testing them. I guess that what @jseyfried suggests may actually work.

@nagisa
Copy link
Member

nagisa commented Apr 4, 2016

It does indeed work. We also have a bunch of regression tests all around already, testing that the span (where it was misaligned before) is correct by using some smart whitespacing in test (though I’m not sure whether the tests actually properly test the span).

I don’t see how this case is any different.

@marcusklaas
Copy link
Contributor Author

@nagisa these whitespace tests can only verify that some part of the code is part of the span. Here we want to ensure that the span does not contain something. I'll give @jseyfried's approach a try; looks promising!

@marcusklaas
Copy link
Contributor Author

Added a test! r? @nagisa

@rust-highfive rust-highfive assigned nagisa and unassigned nikomatsakis Apr 4, 2016
@nagisa
Copy link
Member

nagisa commented Apr 4, 2016

@bors r+ cfe25ad

@mitaa
Copy link
Contributor

mitaa commented Apr 5, 2016

/home/travis/build/rust-lang/rust/src/test/compile-fail/symbol-names/issue-32709.rs:11: trailing whitespace

steveklabnik added a commit to steveklabnik/rust that referenced this pull request Apr 6, 2016
… r=nagisa

Fix the span for try shorthand expressions

My five character contribution to the rust parser! Fixes rust-lang#32709.
@steveklabnik
Copy link
Member

@bors: r-

this has a tidy error

@marcusklaas
Copy link
Contributor Author

Fixed. Apologies for the mess.

@alexcrichton
Copy link
Member

@bors: r=nagisa 81a37e8d9ba19f0b40509d220da85c7e15e3467d

@Manishearth
Copy link
Member

http://buildbot.rust-lang.org/builders/auto-linux-musl-64-opt/builds/3787/steps/test/logs/stdio



---- [compile-fail] compile-fail/symbol-names/issue-32709.rs stdout ----

error: unexpected compiler message: '/buildslave/rust-buildbot/slave/auto-linux-musl-64-opt/build/src/test/compile-fail/symbol-names/issue-32709.rs:16:5: 16:6 error: unresolved name `a` [E0425]'

error: unexpected compiler message: '/buildslave/rust-buildbot/slave/auto-linux-musl-64-opt/build/src/test/compile-fail/symbol-names/issue-32709.rs:16:5: 16:7 error: mismatched types:'

error: expected error on line 16 not found: 2:5: 2:7

error: 2 unexpected errors found, 1 expected errors not found
status: exit code: 101
command: x86_64-unknown-linux-gnu/stage2/bin/rustc /buildslave/rust-buildbot/slave/auto-linux-musl-64-opt/build/src/test/compile-fail/symbol-names/issue-32709.rs -L x86_64-unknown-linux-gnu/test/compile-fail/ --target=x86_64-unknown-linux-musl -L x86_64-unknown-linux-gnu/test/compile-fail/symbol-names/issue-32709.stage2-x86_64-unknown-linux-musl.compile-fail.libaux -C prefer-dynamic -o x86_64-unknown-linux-gnu/test/compile-fail/symbol-names/issue-32709.stage2-x86_64-unknown-linux-musl -C linker=/musl-x86_64/bin/musl-gcc -C ar=ar --cfg rtopt -C rpath -O -L x86_64-unknown-linux-musl/rt
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
/buildslave/rust-buildbot/slave/auto-linux-musl-64-opt/build/src/test/compile-fail/symbol-names/issue-32709.rs:16:5: 16:6 error: unresolved name `a` [E0425]
/buildslave/rust-buildbot/slave/auto-linux-musl-64-opt/build/src/test/compile-fail/symbol-names/issue-32709.rs:16     a?; //~ ERROR 2:5: 2:7
                                                                                                                      ^
/buildslave/rust-buildbot/slave/auto-linux-musl-64-opt/build/src/test/compile-fail/symbol-names/issue-32709.rs:16:5: 16:6 help: run `rustc --explain E0425` to see a detailed explanation
/buildslave/rust-buildbot/slave/auto-linux-musl-64-opt/build/src/test/compile-fail/symbol-names/issue-32709.rs:16:5: 16:7 error: mismatched types:
 expected `()`,
    found `std::result::Result<_, _>`
(expected (),
    found enum `std::result::Result`) [E0308]
/buildslave/rust-buildbot/slave/auto-linux-musl-64-opt/build/src/test/compile-fail/symbol-names/issue-32709.rs:16     a?; //~ ERROR 2:5: 2:7
                                                                                                                      ^~
/buildslave/rust-buildbot/slave/auto-linux-musl-64-opt/build/src/test/compile-fail/symbol-names/issue-32709.rs:16:5: 16:7 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to previous error

------------------------------------------

thread '[compile-fail] compile-fail/symbol-names/issue-32709.rs' panicked at 'explicit panic', /buildslave/rust-buildbot/slave/auto-linux-musl-64-opt/build/src/compiletest/runtest.rs:1677


failures:
    [compile-fail] compile-fail/symbol-names/issue-32709.rs

bors added a commit that referenced this pull request Apr 7, 2016
Rollup of 7 pull requests

- Successful merges: #32674, #32699, #32711, #32745, #32748, #32757, #32789
- Failed merges:
@nagisa
Copy link
Member

nagisa commented Apr 7, 2016

Oh, it still has the rollup flag on! My bad @Manishearth!

@bors rollup- r-

@marcusklaas need to adjust line numbers from 2 to 16 in the test.

@marcusklaas
Copy link
Contributor Author

Ugh - I force pushed an experimental test the last time around :/ My bad. All should be well now.

@nagisa
Copy link
Member

nagisa commented Apr 11, 2016

@bors r+ 05e4116

@bors
Copy link
Contributor

bors commented Apr 11, 2016

⌛ Testing commit 05e4116 with merge 3fb3cf3...

bors added a commit that referenced this pull request Apr 11, 2016
Fix the span for try shorthand expressions

My five character contribution to the rust parser! Fixes #32709.
@bors
Copy link
Contributor

bors commented Apr 12, 2016

💔 Test failed - auto-win-msvc-32-opt

@alexcrichton
Copy link
Member

@bors: retry

On Mon, Apr 11, 2016 at 5:13 PM, bors [email protected] wrote:

[image: 💔] Test failed - auto-win-msvc-32-opt
http://buildbot.rust-lang.org/builders/auto-win-msvc-32-opt/builds/2943


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#32711 (comment)

@bors
Copy link
Contributor

bors commented Apr 12, 2016

⌛ Testing commit 05e4116 with merge 28c9fda...

bors added a commit that referenced this pull request Apr 12, 2016
Fix the span for try shorthand expressions

My five character contribution to the rust parser! Fixes #32709.
@bors bors merged commit 05e4116 into rust-lang:master Apr 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants