Skip to content

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

Merged
merged 2 commits into from
Apr 15, 2020

Conversation

matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr commented Apr 15, 2020

changelog: none

Comment on lines 96 to 104
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,
};
Copy link
Member

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.

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);
Copy link
Member

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.

Copy link
Member

@eddyb eddyb Apr 15, 2020

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.

Copy link
Member Author

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.

@flip1995 flip1995 added the S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) label Apr 15, 2020
@flip1995
Copy link
Member

LGTM

@bors r+

@bors
Copy link
Contributor

bors commented Apr 15, 2020

📌 Commit 7215495 has been approved by flip1995

@bors
Copy link
Contributor

bors commented Apr 15, 2020

⌛ Testing commit 7215495 with merge cf3850e...

bors added a commit that referenced this pull request Apr 15, 2020
@flip1995
Copy link
Member

@bors p=2 treeclosed=1

@@ -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);
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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.

@bors
Copy link
Contributor

bors commented Apr 15, 2020

💔 Test failed - checks-action_test

@flip1995
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Apr 15, 2020

📌 Commit a353f0f has been approved by flip1995

@bors
Copy link
Contributor

bors commented Apr 15, 2020

⌛ Testing commit a353f0f with merge a9a4c8e...

@bors
Copy link
Contributor

bors commented Apr 15, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: flip1995
Pushing a9a4c8e to master...

@bors bors merged commit a9a4c8e into rust-lang:master Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants