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

Modify derive(Debug) to use Self in struct literal to avoid redundant error #97458

Merged
merged 2 commits into from
May 28, 2022

Conversation

estebank
Copy link
Contributor

Reduce verbosity in #97343.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 27, 2022
@rust-highfive
Copy link
Collaborator

r? @nagisa

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 27, 2022
@estebank
Copy link
Contributor Author

r? @compiler-errors

use std::fmt::Debug;

#[derive(Debug)]
pub struct Irrelevant<Irrelevant> { //~ ERROR type arguments are not allowed for this type
Copy link
Member

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.

Copy link
Contributor Author

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.

@compiler-errors
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented May 27, 2022

📌 Commit f2a1b7b has been approved by compiler-errors

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 27, 2022
@compiler-errors
Copy link
Member

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?

bors added a commit to rust-lang-ci/rust that referenced this pull request May 27, 2022
…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
@bors bors merged commit 0804ef6 into rust-lang:master May 28, 2022
@rustbot rustbot added this to the 1.63.0 milestone May 28, 2022
@estebank
Copy link
Contributor Author

estebank commented Jun 1, 2022

@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".

@estebank estebank deleted the use-self-in-derive-macro branch November 9, 2023 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants