1
Fork 0

Auto merge of #122021 - oli-obk:delangitemification, r=compiler-errors

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

I wanted to do something entirely different and stumbled upon a bunch of cleanups
This commit is contained in:
bors 2024-03-19 11:05:45 +00:00
commit f296c162d8
8 changed files with 54 additions and 184 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,