-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Do not expand a derive invocation when derive is not allowed #47013
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
Conversation
1. Change the return type of `expand_invoc()` and its subroutines to `Option<Expansion>` from `Expansion`. 2. Return `None` when expanding a derive invocation if the item cannot have derive on it (in `expand_derive_invoc()`).
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors r+ |
📌 Commit f4a76f3 has been approved by |
💔 Test failed - status-travis |
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.
test/run-pass-fulldeps/proc-macro/issue-40001.rs
is failing:
[01:05:24] error: Missing 'whitelited_attr' attribute
[01:05:24] --> /checkout/src/test/run-pass-fulldeps/proc-macro/issue-40001.rs:18:1
[01:05:24] |
[01:05:24] 18 | fn main() {}
[01:05:24] | ^^^^^^^^^^^^
[01:05:24] |
[01:05:24] = note: #[deny(missing_whitelisted_attr)] on by default
[01:05:24]
[01:05:24] error: aborting due to previous error
@@ -59,7 +60,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingWhitelistedAttrPass { | |||
_ => cx.tcx.hir.expect_item(cx.tcx.hir.get_parent(id)), | |||
}; | |||
|
|||
if !item.attrs.iter().any(|a| a.check_name("whitelisted_attr")) { | |||
if attr::contains_name(&item.attrs, "whitelisted_attr") { | |||
cx.span_lint(MISSING_WHITELISTED_ATTR, span, | |||
"Missing 'whitelited_attr' attribute"); |
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.
There is a typo: whitelited
-> whitelisted
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.
Yeah I forgot !
. I fixed the whitelited
typo as well.
f4a76f3
to
d882691
Compare
@bors r=petrochenkov |
📌 Commit d882691 has been approved by |
☀️ Test successful - status-appveyor, status-travis |
Closes #46655.
The first commit is what actually closes #46655. The second one is just a refactoring I have done while waiting on a test.