1
Fork 0

Use hir::Node helper methods instead of repeat the same impl multiple times

There already were inconsistencies, so this ensures we don't introduce subtle surprising bugs
This commit is contained in:
Oli Scherer 2024-03-05 12:16:22 +00:00
parent 419d205dad
commit 69c4e813fe
4 changed files with 21 additions and 118 deletions

View file

@ -609,13 +609,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
&& !self.tcx.sess.target.is_like_wasm
&& !self.tcx.sess.opts.actually_rustdoc
{
let hir::Node::Item(item) = self.tcx.hir_node(hir_id) else {
unreachable!();
};
let hir::ItemKind::Fn(sig, _, _) = item.kind else {
// target is `Fn`
unreachable!();
};
let sig = self.tcx.hir_node(hir_id).fn_sig().unwrap();
self.dcx().emit_err(errors::LangItemWithTargetFeature {
attr_span: attr.span,