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

Less unused argument spew #37729

Closed

Conversation

DanielKeep
Copy link
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
Collaborator

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.

| ^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^-------^^
| |
| unused
Copy link
Contributor

@brson brson Nov 15, 2016

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

brson commented Nov 15, 2016

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

estebank commented Dec 5, 2016

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

BTW, this looks great!

@steveklabnik
Copy link
Member

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

mrhota commented Feb 23, 2017

@DanielKeep ping?

@brson
Copy link
Contributor

brson commented Feb 24, 2017

@bors r+

@bors
Copy link
Contributor

bors commented Feb 24, 2017

📌 Commit 6f0ba7e has been approved by brson

@bors
Copy link
Contributor

bors commented Feb 25, 2017

⌛ Testing commit 6f0ba7e with merge abed1ac...

@eddyb
Copy link
Member

eddyb commented Feb 25, 2017

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

@bors r-

@eddyb
Copy link
Member

eddyb commented Feb 25, 2017

@bors force

@bors
Copy link
Contributor

bors commented Feb 25, 2017

💔 Test failed - status-travis

@alexcrichton
Copy link
Member

@bors: r=brson

@bors
Copy link
Contributor

bors commented Feb 28, 2017

📌 Commit 6f0ba7e has been approved by brson

@alexcrichton
Copy link
Member

@bors: retry

@frewsxcv
Copy link
Member

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

@frewsxcv
Copy link
Member

@bors r-

@estebank
Copy link
Contributor

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

@alexcrichton
Copy link
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