Skip to content

Update error message E0120#35298

Merged
bors merged 1 commit into
rust-lang:masterfrom
Keats:err-120
Aug 5, 2016
Merged

Update error message E0120#35298
bors merged 1 commit into
rust-lang:masterfrom
Keats:err-120

Conversation

@Keats

@Keats Keats commented Aug 4, 2016

Copy link
Copy Markdown

Fixes #35253 as part of #35233.

r? @jonathandturner

@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 @jonathandturner (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.

@Keats

Keats commented Aug 4, 2016

Copy link
Copy Markdown
Author

Is there a better way to get the type name span? Also I guess I should put something other than unreachable!?

@sophiajt

sophiajt commented Aug 4, 2016

Copy link
Copy Markdown
Contributor

There may be a better way to get the type name span, but if that works, it's fine with me.

For unreachable!, it looks like people are using panic! instead and passing in a short message.

Actually, in your case, can we do something more like:

let mut err = struct_span_err!(tcx.sess, item.span, E0120,
                                                  "the Drop trait may only be implemented on structures");
match item.node {
    ItemImpl(_, _, _, _, ref ty, _) => {
        err.span = ty.span;
        err.span_label(ty.span, &format!("implementing Drop requires a struct"));
    },
    _ => {
        err.span_label(item.span, &format!("implementing Drop requires a struct"));
    }
};
err.emit();

That way we can fall-back to the larger span if we have a node type we don't expect.

@Keats

Keats commented Aug 4, 2016

Copy link
Copy Markdown
Author

Updated

@sophiajt

sophiajt commented Aug 4, 2016

Copy link
Copy Markdown
Contributor

Even better :) Thanks!

@bors r+ rollup

@bors

bors commented Aug 4, 2016

Copy link
Copy Markdown
Collaborator

📌 Commit 4492838 has been approved by jonathandturner

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Aug 4, 2016
steveklabnik added a commit to steveklabnik/rust that referenced this pull request Aug 4, 2016
@sophiajt

sophiajt commented Aug 4, 2016

Copy link
Copy Markdown
Contributor

Can you run:

python src/bootstrap/bootstrap.py --stage 1 --step check-tidy

and update this PR after fixing the tidy errors?

@sophiajt

sophiajt commented Aug 4, 2016

Copy link
Copy Markdown
Contributor

@bors r-

@Keats

Keats commented Aug 4, 2016

Copy link
Copy Markdown
Author

Sorry, updated

@sophiajt

sophiajt commented Aug 4, 2016

Copy link
Copy Markdown
Contributor

No worries, thanks for updating.

@bors r+ rollup

@bors

bors commented Aug 4, 2016

Copy link
Copy Markdown
Collaborator

📌 Commit 3b2f184 has been approved by jonathandturner

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 5, 2016
bors added a commit that referenced this pull request Aug 5, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Aug 5, 2016
bors added a commit that referenced this pull request Aug 5, 2016
@bors bors merged commit 3b2f184 into rust-lang:master Aug 5, 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.

4 participants