about summary refs log tree commit diff
path: root/compiler/rustc_passes
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-19 11:05:45 +0000
committerbors <bors@rust-lang.org>2024-03-19 11:05:45 +0000
commitf296c162d8c6f84bcfee99c152d4fd63aaef3e38 (patch)
tree09b86cf1ffc6904592ad7753fc4ca5880d9a71d9 /compiler/rustc_passes
parent8579a1856a868033b792c08e5c73a7c9dbe4d273 (diff)
parent69c4e813fe1887883a55ff59c30443ee8299399b (diff)
downloadrust-f296c162d8c6f84bcfee99c152d4fd63aaef3e38.tar.gz
rust-f296c162d8c6f84bcfee99c152d4fd63aaef3e38.zip
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
Diffstat (limited to 'compiler/rustc_passes')
-rw-r--r--compiler/rustc_passes/src/check_attr.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index eb2399f7a64..1254ae8cfc8 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -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,