Skip to content

warning: empty trait list in derive should not emit if created by a macro #54652

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
Havvy opened this issue Sep 28, 2018 · 1 comment
Closed
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Havvy
Copy link
Contributor

Havvy commented Sep 28, 2018

The following code should not emit a warning at the call site of the macro:

#![crate_type="lib"]

macro_rules! ds {
    () => (#[derive()] struct StructDs;)
}

ds!{}

Currently, it does:

warning: empty trait list in `derive`
  --> src/lib.rs:8:12
   |
8  |     () => (#[derive()] struct StructDs;)
   |            ^^^^^^^^^^^
...
11 | ds!{}
   | ----- in this macro invocation
@Havvy Havvy added the A-diagnostics Area: Messages for errors, warnings, and lints label Sep 28, 2018
@Havvy Havvy changed the title warning: empty trait list in derive should not fired if created by a macro warning: empty trait list in derive should not fire if created by a macro Sep 28, 2018
@Havvy Havvy changed the title warning: empty trait list in derive should not fire if created by a macro warning: empty trait list in derive should not emit if created by a macro Sep 28, 2018
@hdhoang hdhoang added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-enhancement Category: An issue proposing an enhancement or a PR with one. labels Dec 26, 2019
@crlf0710 crlf0710 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 11, 2020
@fmease fmease added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. and removed A-diagnostics Area: Messages for errors, warnings, and lints labels Dec 28, 2024
@fmease
Copy link
Member

fmease commented Dec 28, 2024

Since #79078, #[derive()] no longer triggers a lint anywhere / at all. Closing as (coincidentally) fixed.

@fmease fmease closed this as completed Dec 28, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants