-
Notifications
You must be signed in to change notification settings - Fork 1.6k
rustup https://github.com/rust-lang/rust/pull/71116 #5467
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
Conversation
clippy_lints/src/utils/author.rs
Outdated
use rustc_hir::def_id::{LocalDefId, CRATE_DEF_INDEX}; | ||
use rustc_hir::{HirId, DUMMY_ITEM_LOCAL_ID}; | ||
|
||
const DUMMY_HIR_ID: HirId = HirId { | ||
owner: LocalDefId { | ||
local_def_index: CRATE_DEF_INDEX, | ||
}, | ||
local_id: DUMMY_ITEM_LOCAL_ID, | ||
}; |
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 must be a way to avoid reintroducing this.
clippy_lints/src/utils/author.rs
Outdated
if !has_attr(cx.sess(), &var.attrs) { | ||
return; | ||
} | ||
prelude(); | ||
PrintVisitor::new("var").visit_variant(var, &hir::Generics::empty(), hir::DUMMY_HIR_ID); | ||
PrintVisitor::new("var").visit_variant(var, &hir::Generics::empty(), DUMMY_HIR_ID); |
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.
Something like cx.tcx.hir().get_parent(var.hir_id)
should give you a valid HirId
.
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.
Which probably means we can remove the HirId
arguments from visit_variant
and visit_variant_data
and visit_enum_def
, maybe. Depends on which visitors use them and for what.
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.
Thanks!
I'm not familiar with how the author lint works, I switched to cx.tcx.hir().get_parent_node(var.id);
now.
LGTM @bors r+ |
📌 Commit 7215495 has been approved by |
rustup rust-lang/rust#71116 changelog: none
@bors p=2 treeclosed=1 |
clippy_lints/src/utils/author.rs
Outdated
@@ -97,7 +97,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Author { | |||
return; | |||
} | |||
prelude(); | |||
PrintVisitor::new("var").visit_variant(var, &hir::Generics::empty(), hir::DUMMY_HIR_ID); | |||
let dummy_hir_id = cx.tcx.hir().get_parent_node(var.id); |
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.
This is not dummy. This is the correct HirId
for the HIR visitor method.
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.
Eh.. :(
I'll change it in a follow up pr that we can add to the rollup
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.
GHA got stuck anyway in the caching process.
💔 Test failed - checks-action_test |
@bors r+ |
📌 Commit a353f0f has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
changelog: none