Skip to content

Fix float bug in help suggestion for incorrect tuple indexing #28247

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

Merged
merged 1 commit into from
Sep 14, 2015
Merged

Fix float bug in help suggestion for incorrect tuple indexing #28247

merged 1 commit into from
Sep 14, 2015

Conversation

alexispurslane
Copy link
Contributor

as per #28243.

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@alexispurslane
Copy link
Contributor Author

@nikomatsakis By the way, some changes from an earlier pull request of mine found their way into this PR branch, so I had to change them back.

@eddyb
Copy link
Member

eddyb commented Sep 5, 2015

You should squash those commits to simplify the history.

@alexispurslane
Copy link
Contributor Author

Yes, defiantly!

@nikomatsakis
Copy link
Contributor

Can you add a testcase? I'm always torn about tests that have specific error msgs, but it seems appropriate in this instance. If you could include a comment identifying the precise thing you are testing (the formatting of the float in the suggestion) that'd be great.

@alexispurslane
Copy link
Contributor Author

Sure.

@alexispurslane
Copy link
Contributor Author

How do the tests work?

@alexispurslane
Copy link
Contributor Author

I'm changing the help message in this PR, so it seems like I need to test the help message, but I'm not sure how using the tests that I see already there. Heres my start on the test (in src/test/parse-fail/):

// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn main () {
    (1, (2, 3)).1.1;
    //~ERROR unexpected token: `1.1`
}

@nikomatsakis
Copy link
Contributor

@ChristopherDumas

I'm changing the help message in this PR, so it seems like I need to test the help message, but I'm not sure how using the tests that I see already there.

I think you can just add a line like //~ HELP ... -- but the parse-fail tests may work differently than compile-fail? I forget. I'll have to check.

@alexispurslane
Copy link
Contributor Author

Do you have any idea why this test is failing?

// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// compile-flags: -Z parse-only

fn main () {
    (1, (2, 3)).1.1; //~HELP try parenthesizing the first index; e.g., `(foo.1).1`
}

@jonas-schievink
Copy link
Contributor

"Unexpected compiler error or warning". Looks like you have to tell it about the actual error. Try this:

(1, (2, 3)).1.1;  //~ ERROR unexpected token
                  //~^ HELP try parenthesizing the first index

The //~^ tells it to look for the help message in the line above

@alexispurslane
Copy link
Contributor Author

@jonas-schievink Thanks. I think that should do the trick!

@bors
Copy link
Collaborator

bors commented Sep 12, 2015

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

@alexispurslane
Copy link
Contributor Author

@nikomatsakis Can you make bors retry?

@eddyb
Copy link
Member

eddyb commented Sep 12, 2015

@ChristopherDumas I don't see any approvals on this PR. The @bors message above was just a friendly reminder that the PR needed rebasing.

@alexispurslane
Copy link
Contributor Author

Why is this a merge conflict? I tried to rebase to rust-lang/rust master, and llvm has a merge conflict. I tried all kinds of things, but I'm stuck.

@eddyb
Copy link
Member

eddyb commented Sep 13, 2015

@ChristopherDumas You already fixed it, but the comment doesn't just go away.
GitHub tells you that "This branch is up-to-date with the base branch (Merging can be performed automatically)".

@eddyb
Copy link
Member

eddyb commented Sep 13, 2015

@ChristopherDumas As for LLVM, use some tool like git gui, or at least never use git commit -a, to avoid committing changes to submodules like src/llvm.
You get those in between updating a branch and running make (which updates submodules as well).
Also, you should squash to hide those extra back-and-forth changes.

@alexispurslane
Copy link
Contributor Author

@nikomatsakis This is ready to be merged....


fn main () {
(1, (2, 3)).1.1; //~ ERROR unexpected token
//~^ HELP try parenthesizing the first index
Copy link
Contributor

Choose a reason for hiding this comment

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

the actual fix would help (e.g. try parenthesizing the first index; e.g., (foo.1).1``)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Totally! Thanks.

@arielb1
Copy link
Contributor

arielb1 commented Sep 13, 2015

Could you squash all commits together? r+ modulo that

@alexispurslane
Copy link
Contributor Author

Yes! thanks.

@alexispurslane
Copy link
Contributor Author

I squashed the commits.

@eddyb
Copy link
Member

eddyb commented Sep 14, 2015

@ChristopherDumas You might want to amend the commit to fix the message (I don't think the issue there is even related to this PR).

@alexispurslane
Copy link
Contributor Author

Whoops. sorry i must have gotten confused.

@alexispurslane
Copy link
Contributor Author

I amended the commit message.

@eddyb
Copy link
Member

eddyb commented Sep 14, 2015

Thanks! @bors r+

@bors
Copy link
Collaborator

bors commented Sep 14, 2015

📌 Commit afa905f has been approved by eddyb

@bors
Copy link
Collaborator

bors commented Sep 14, 2015

⌛ Testing commit afa905f with merge 7b2fdc4...

@bors
Copy link
Collaborator

bors commented Sep 14, 2015

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

@alexcrichton
Copy link
Member

@bors: retry

On Mon, Sep 14, 2015 at 10:10 AM, bors [email protected] wrote:

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


Reply to this email directly or view it on GitHub
#28247 (comment).

@bors
Copy link
Collaborator

bors commented Sep 14, 2015

⌛ Testing commit afa905f with merge bc6c397...

bors added a commit that referenced this pull request Sep 14, 2015
@bors bors merged commit afa905f into rust-lang:master Sep 14, 2015
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.

8 participants