Skip to content

make easier/possible to detect derive attributes after expansion #45216

Open
@zackmdavis

Description

@zackmdavis

In the spirit of #44942, it would be nice if the missing_debug_implementations and missing_copy_implementations lints suggested adding a derive attribute (in the case where one does not already exist) or adding Debug (respectively Copy) to the list of traits in the derive attribute (in the case where it already exists). (This mostly for the sake of RLS and other tools, but the span highlighting is pretty, too.) But while the lints (obviously, necessarily) know how to look up whether the trait has been implemented, it's not clear how to make them detect an existing derive attribute (and its span): cx.tcx.get_attrs doesn't work because we apparently strip off the attribute during expansion (it looks like this happens twice, which is confusing: 1 2). But I can't modify the expansion code because I'm still not smart enough to understand it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions