-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Modify derive(Debug)
to use Self
in struct literal to avoid redundant error
#97458
Conversation
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
use std::fmt::Debug; | ||
|
||
#[derive(Debug)] | ||
pub struct Irrelevant<Irrelevant> { //~ ERROR type arguments are not allowed for this type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, this error message is very confusing imo. I guess that's not necessarily the purpose of this PR.
r=me anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving #97343 open to both address that (I think a new error code is warranted) and potentially make the macro smarter to make this code work in the first place.
@bors r+ rollup |
📌 Commit f2a1b7b has been approved by |
re the existing error message this doesn't touch, @estebank, should I reword that message to say something like "type argument shadows item name" or something? |
…askrgr Rollup of 6 pull requests Successful merges: - rust-lang#95214 (Remove impossible panic note from `Vec::append`) - rust-lang#97411 (Print stderr consistently) - rust-lang#97453 (rename `TyKind` to `RegionKind` in comment in rustc_middle) - rust-lang#97457 (Add regression test for rust-lang#81899) - rust-lang#97458 (Modify `derive(Debug)` to use `Self` in struct literal to avoid redundant error) - rust-lang#97462 (Add more eslint rules) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
@compiler-errors if you can do that, that'd be great. I think that you'll need to do name resolution on the parent scope (to avoid the shadowing) and compare the def id of what you find and what we currently have. Once we have that we can go fancy and point at "this type argument..."/"...shadows this item name in the current scope"/"consider renaming the type parameter". |
Reduce verbosity in #97343.