Skip to content

Less unused argument spew#37729

Closed
DanielKeep wants to merge 1 commit into
rust-lang:masterfrom
DanielKeep:less-unused-argument-spew
Closed

Less unused argument spew#37729
DanielKeep wants to merge 1 commit into
rust-lang:masterfrom
DanielKeep:less-unused-argument-spew

Conversation

@DanielKeep

Copy link
Copy Markdown
Contributor

Unused arguments are attached to the main error as labels. This drops
the traditional named/positional message split (except in the case of a
single unused argument) for "unused" in interest of terseness.

Closes #37718.


I tried using MultiSpan with struct_err_span, but none of the spans were emitted. This was also the case with trying to attach a MultiSpan to the Diagnostic as a note. span_label was the only seemingly relevant method I found that would actually display.

It feels a bit ugly, but works.

I also chose to merge the two branches for how to display the error for the sake of simplifying and unifying the diagnostic construction a little.

@rust-highfive

Copy link
Copy Markdown
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (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. Due to 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.

@brson brson Nov 15, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The remaining three cases in this diff all ended up bigger! Can they be special cased back to the old way?

@brson

brson commented Nov 15, 2016

Copy link
Copy Markdown
Contributor

Looks good. Can you add a test case with a multi-line span so we can see what it looks like?

@DanielKeep DanielKeep force-pushed the less-unused-argument-spew branch from fb8da44 to d8dd579 Compare November 18, 2016 02:46
Unused arguments are attached to the main error as labels.  This drops
the traditional named/positional message split (except in the case of a
*single* unused argument) for "unused" in interest of terseness.

Closes rust-lang#37718.
@DanielKeep DanielKeep force-pushed the less-unused-argument-spew branch from d8dd579 to 6f0ba7e Compare November 18, 2016 02:51
@DanielKeep

Copy link
Copy Markdown
Contributor Author

I reverted the change to the single missing argument case, so it's back to the way it was. I also added a multi-line macro invocation to show what that looks like.

The Travis failure appears to be unrelated to these changes: something about a lock file while it was setting up for the build.

@estebank

estebank commented Dec 5, 2016

Copy link
Copy Markdown
Contributor

@DanielKeep FYI, I believe MultiSpans are accepted by all the span_* methods now.

BTW, this looks great!

@steveklabnik

Copy link
Copy Markdown
Contributor

The Travis failure appears to be unrelated to these changes: something about a lock file while it was setting up for the build.

I've re-queued Travis. @brson are you happy with this PR now, assuming it passes?

@alexcrichton

Copy link
Copy Markdown
Member

Sorry for the delay here @DanielKeep! It looks like the UI test may be failing on Travis though? If you want to rebase, fix tests, and ping me I'll r+

@mrhota

mrhota commented Feb 23, 2017

Copy link
Copy Markdown
Contributor

@DanielKeep ping?

@brson

brson commented Feb 24, 2017

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Feb 24, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 6f0ba7e has been approved by brson

@bors

bors commented Feb 25, 2017

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 6f0ba7e with merge abed1ac...

@eddyb

eddyb commented Feb 25, 2017

Copy link
Copy Markdown
Contributor

@brson see @alexcrichton's message, the UI test just doesn't pass.

@bors r-

@eddyb

eddyb commented Feb 25, 2017

Copy link
Copy Markdown
Contributor

@bors force

@bors

bors commented Feb 25, 2017

Copy link
Copy Markdown
Collaborator

💔 Test failed - status-travis

@alexcrichton

Copy link
Copy Markdown
Member

@bors: r=brson

@bors

bors commented Feb 28, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 6f0ba7e has been approved by brson

@alexcrichton

Copy link
Copy Markdown
Member

@bors: retry

@frewsxcv

Copy link
Copy Markdown
Contributor

There's a test failure here https://travis-ci.org/rust-lang/rust/jobs/176910049

@frewsxcv

Copy link
Copy Markdown
Contributor

@bors r-

@estebank

Copy link
Copy Markdown
Contributor

@DanielKeep @frewsxcv It looks like the test stderr output has to be updated to latest master, that's all.

@alexcrichton

Copy link
Copy Markdown
Member

Closing due to inactivity, but feel free to resubmit with tests fixed!

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