Rollup merge of #163170 - mejrs:hir_imports, r=oli-obk

Update deprecated rustc_hir imports

Followup to https://github.com/rust-lang/rust/pull/160336

That's ~half of them, I'm not doing it all in one go to reduce conflicts.
diff --git a/Cargo.lock b/Cargo.lock
index 4336ffa..a1a43f4 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4168,6 +4168,7 @@
  "rustc_abi",
  "rustc_ast",
  "rustc_ast_pretty",
+ "rustc_attr_ir",
  "rustc_hir",
  "rustc_span",
 ]
@@ -4732,6 +4733,7 @@
  "rustc_arena",
  "rustc_ast",
  "rustc_ast_pretty",
+ "rustc_attr_ir",
  "rustc_attr_parsing",
  "rustc_data_structures",
  "rustc_errors",
@@ -4848,6 +4850,7 @@
  "punycode",
  "rustc-demangle",
  "rustc_abi",
+ "rustc_attr_ir",
  "rustc_data_structures",
  "rustc_hashes",
  "rustc_hir",
@@ -4947,8 +4950,8 @@
 dependencies = [
  "itertools",
  "rustc_abi",
+ "rustc_attr_ir",
  "rustc_data_structures",
- "rustc_hir",
  "rustc_middle",
  "rustc_span",
  "smallvec",
@@ -4961,6 +4964,7 @@
 dependencies = [
  "itertools",
  "rustc_abi",
+ "rustc_attr_ir",
  "rustc_data_structures",
  "rustc_errors",
  "rustc_hashes",
diff --git a/compiler/rustc_ast_lowering/src/block.rs b/compiler/rustc_ast_lowering/src/block.rs
index b52af8f..b2cb171 100644
--- a/compiler/rustc_ast_lowering/src/block.rs
+++ b/compiler/rustc_ast_lowering/src/block.rs
@@ -1,6 +1,6 @@
 use rustc_ast::{Block, BlockCheckMode, Local, LocalKind, Stmt, StmtKind};
+use rustc_attr_ir::target::Target;
 use rustc_hir as hir;
-use rustc_hir::Target;
 use rustc_span::sym;
 use smallvec::SmallVec;
 
diff --git a/compiler/rustc_ast_lowering/src/contract.rs b/compiler/rustc_ast_lowering/src/contract.rs
index eaebff5..80bd0f7 100644
--- a/compiler/rustc_ast_lowering/src/contract.rs
+++ b/compiler/rustc_ast_lowering/src/contract.rs
@@ -1,6 +1,7 @@
 use std::sync::Arc;
 
-use rustc_hir::attrs::lang_items::LangItem;
+use rustc_attr_ir::lang_items::LangItem;
+use rustc_attr_ir::target::Target;
 use thin_vec::thin_vec;
 
 use crate::LoweringContext;
@@ -209,7 +210,7 @@ fn lower_contract_check_with_postcond(
 
         let postcond_checker = self.arena.alloc(self.expr_enum_variant_lang_item(
             postcond_checker.span,
-            rustc_hir::attrs::lang_items::LangItem::OptionSome,
+            LangItem::OptionSome,
             &*arena_vec![self; *postcond_checker],
         ));
         let then_block_stmts = self.block_all(span, stmts, Some(postcond_checker));
@@ -217,7 +218,7 @@ fn lower_contract_check_with_postcond(
 
         let none_expr = self.arena.alloc(self.expr_enum_variant_lang_item(
             postcond_checker.span,
-            rustc_hir::attrs::lang_items::LangItem::OptionNone,
+            LangItem::OptionNone,
             Default::default(),
         ));
         let else_block = self.block_expr(none_expr);
@@ -350,7 +351,7 @@ pub(super) fn inject_ensures_check(
         ));
 
         let attrs: rustc_ast::AttrVec = thin_vec![self.unreachable_code_attr(span)];
-        self.lower_attrs(contract_check.hir_id, &attrs, span, rustc_hir::Target::Expression);
+        self.lower_attrs(contract_check.hir_id, &attrs, span, Target::Expression);
 
         let ret_block = self.block_all(span, arena_vec![self; ret_stmt], Some(contract_check));
         self.arena.alloc(self.expr_block(self.arena.alloc(ret_block)))
diff --git a/compiler/rustc_ast_lowering/src/delegation/attributes.rs b/compiler/rustc_ast_lowering/src/delegation/attributes.rs
index 834f854..686f5bb 100644
--- a/compiler/rustc_ast_lowering/src/delegation/attributes.rs
+++ b/compiler/rustc_ast_lowering/src/delegation/attributes.rs
@@ -1,5 +1,5 @@
+use rustc_attr_ir::{AttributeKind, InlineAttr};
 use rustc_hir as hir;
-use rustc_hir::attrs::{AttributeKind, InlineAttr};
 use rustc_span::Span;
 use rustc_span::def_id::DefId;
 
@@ -7,33 +7,37 @@
 use crate::delegation::DelegationResolution;
 
 struct AdditionInfo {
-    pub equals: fn(&hir::Attribute) -> bool,
+    pub equals: fn(&rustc_attr_ir::Attribute) -> bool,
     pub kind: AdditionKind,
 }
 
 enum AdditionKind {
-    Default { factory: fn(Span) -> hir::Attribute },
-    Inherit { factory: fn(Span, &hir::Attribute) -> hir::Attribute },
+    Default { factory: fn(Span) -> rustc_attr_ir::Attribute },
+    Inherit { factory: fn(Span, &rustc_attr_ir::Attribute) -> rustc_attr_ir::Attribute },
 }
 
 static ADDITIONS: &[AdditionInfo] = &[
     AdditionInfo {
-        equals: |a| matches!(a, hir::Attribute::Parsed(AttributeKind::MustUse { .. })),
+        equals: |a| matches!(a, rustc_attr_ir::Attribute::Parsed(AttributeKind::MustUse { .. })),
         kind: AdditionKind::Inherit {
             factory: |span, original_attr| {
                 let reason = match original_attr {
-                    hir::Attribute::Parsed(AttributeKind::MustUse { reason, .. }) => *reason,
+                    rustc_attr_ir::Attribute::Parsed(AttributeKind::MustUse { reason, .. }) => {
+                        *reason
+                    }
                     _ => None,
                 };
 
-                hir::Attribute::Parsed(AttributeKind::MustUse { span, reason })
+                rustc_attr_ir::Attribute::Parsed(AttributeKind::MustUse { span, reason })
             },
         },
     },
     AdditionInfo {
-        equals: |a| matches!(a, hir::Attribute::Parsed(AttributeKind::Inline(..))),
+        equals: |a| matches!(a, rustc_attr_ir::Attribute::Parsed(AttributeKind::Inline(..))),
         kind: AdditionKind::Default {
-            factory: |span| hir::Attribute::Parsed(AttributeKind::Inline(InlineAttr::Hint, span)),
+            factory: |span| {
+                rustc_attr_ir::Attribute::Parsed(AttributeKind::Inline(InlineAttr::Hint, span))
+            },
         },
     },
 ];
@@ -61,8 +65,8 @@ fn create_new_attrs(
         &self,
         span: Span,
         sig_id: DefId,
-        existing: Option<&&[hir::Attribute]>,
-    ) -> Vec<hir::Attribute> {
+        existing: Option<&&[rustc_attr_ir::Attribute]>,
+    ) -> Vec<rustc_attr_ir::Attribute> {
         ADDITIONS
             .iter()
             .filter_map(|addition| {
diff --git a/compiler/rustc_ast_lowering/src/delegation/mod.rs b/compiler/rustc_ast_lowering/src/delegation/mod.rs
index 0e94016..b2c0e1f 100644
--- a/compiler/rustc_ast_lowering/src/delegation/mod.rs
+++ b/compiler/rustc_ast_lowering/src/delegation/mod.rs
@@ -45,7 +45,7 @@
 use rustc_abi::ExternAbi;
 use rustc_ast as ast;
 use rustc_ast::*;
-use rustc_hir::attrs::lang_items::LangItem;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_hir::def::DefKind;
 use rustc_hir::{self as hir, FnDeclFlags, QPath};
 use rustc_middle::ty::Asyncness;
diff --git a/compiler/rustc_ast_lowering/src/expr/closure.rs b/compiler/rustc_ast_lowering/src/expr/closure.rs
index 1b87409..c729565 100644
--- a/compiler/rustc_ast_lowering/src/expr/closure.rs
+++ b/compiler/rustc_ast_lowering/src/expr/closure.rs
@@ -1,6 +1,8 @@
 use rustc_ast::*;
+use rustc_attr_ir::find_attr;
+use rustc_attr_ir::target::Target;
 use rustc_hir as hir;
-use rustc_hir::{HirId, Target, find_attr};
+use rustc_hir::HirId;
 use rustc_span::{Span, span_bug};
 
 use super::{LoweringContext, MoveExprState};
@@ -55,7 +57,7 @@ pub(super) fn lower_expr_closure_expr(
     fn lower_expr_coroutine_closure_with_move_exprs(
         &mut self,
         expr_hir_id: HirId,
-        attrs: &[hir::Attribute],
+        attrs: &[rustc_attr_ir::Attribute],
         binder: &ClosureBinder,
         capture_clause: CaptureBy,
         closure_id: NodeId,
@@ -114,7 +116,7 @@ fn lower_expr_coroutine_closure_with_move_exprs(
     fn lower_expr_plain_closure_with_move_exprs(
         &mut self,
         expr_hir_id: HirId,
-        attrs: &[hir::Attribute],
+        attrs: &[rustc_attr_ir::Attribute],
         binder: &ClosureBinder,
         capture_clause: CaptureBy,
         closure_id: NodeId,
@@ -153,7 +155,7 @@ fn lower_expr_plain_closure_with_move_exprs(
     // local uses and the caller can later add the matching initializers.
     fn lower_expr_closure(
         &mut self,
-        attrs: &[hir::Attribute],
+        attrs: &[rustc_attr_ir::Attribute],
         binder: &ClosureBinder,
         capture_clause: CaptureBy,
         closure_id: NodeId,
@@ -283,7 +285,7 @@ fn lower_expr_coroutine_closure(
         body: &Expr,
         fn_decl_span: Span,
         fn_arg_span: Span,
-        attrs: &[hir::Attribute],
+        attrs: &[rustc_attr_ir::Attribute],
     ) -> hir::ExprKind<'hir> {
         let closure_def_id = self.local_def_id(closure_id);
         let (binder_clause, generic_params) = self.lower_closure_binder(binder);
diff --git a/compiler/rustc_ast_lowering/src/format.rs b/compiler/rustc_ast_lowering/src/format.rs
index b9974ed..9da4251 100644
--- a/compiler/rustc_ast_lowering/src/format.rs
+++ b/compiler/rustc_ast_lowering/src/format.rs
@@ -1,9 +1,9 @@
 use std::borrow::Cow;
 
 use rustc_ast::*;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_data_structures::fx::FxIndexMap;
 use rustc_hir as hir;
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_session::config::FmtDebug;
 use rustc_span::{ByteSymbol, DesugaringKind, Ident, Span, Symbol, sym};
 
diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs
index f8106bd..33b73ed 100644
--- a/compiler/rustc_ast_lowering/src/item.rs
+++ b/compiler/rustc_ast_lowering/src/item.rs
@@ -1,12 +1,11 @@
 use rustc_abi::ExternAbi;
 use rustc_ast::visit::AssocCtxt;
 use rustc_ast::*;
+use rustc_attr_ir::target::Target;
+use rustc_attr_ir::{AttributeKind, EiiImplResolution, find_attr};
 use rustc_errors::{E0570, ErrorGuaranteed, struct_span_code_err};
-use rustc_hir::attrs::{AttributeKind, EiiImplResolution};
 use rustc_hir::def::{DefKind, PerNS, Res};
-use rustc_hir::{
-    self as hir, HirId, ImplItemImplKind, LifetimeSource, PredicateOrigin, Target, find_attr,
-};
+use rustc_hir::{self as hir, HirId, ImplItemImplKind, LifetimeSource, PredicateOrigin};
 use rustc_middle::ty::data_structures::IndexMap;
 use rustc_span::def_id::{DefId, LocalDefId};
 use rustc_span::edit_distance::find_best_match_for_name;
@@ -68,8 +67,8 @@ fn lower_eii_decl(
         id: NodeId,
         name: Ident,
         EiiDecl { foreign_item, impl_unsafe }: &EiiDecl,
-    ) -> Option<hir::attrs::EiiDecl> {
-        self.lower_path_simple_eii(id, foreign_item).map(|did| hir::attrs::EiiDecl {
+    ) -> Option<rustc_attr_ir::EiiDecl> {
+        self.lower_path_simple_eii(id, foreign_item).map(|did| rustc_attr_ir::EiiDecl {
             foreign_item: did,
             impl_unsafe: *impl_unsafe,
             name,
@@ -87,7 +86,7 @@ fn lower_eii_impl(
             is_default,
             known_eii_macro_resolution,
         }: &EiiImpl,
-    ) -> hir::attrs::EiiImpl {
+    ) -> rustc_attr_ir::EiiImpl {
         let resolution = if let Some(target) = known_eii_macro_resolution
             && let Some(foreign_item_did) = self.lower_path_simple_eii(*node_id, target)
         {
@@ -100,7 +99,7 @@ fn lower_eii_impl(
             )
         };
 
-        hir::attrs::EiiImpl {
+        rustc_attr_ir::EiiImpl {
             span: self.lower_span(*span),
             inner_span: self.lower_span(*inner_span),
             impl_unsafe_span: match *impl_safety {
@@ -116,19 +115,21 @@ fn generate_extra_attrs_for_item_kind(
         &mut self,
         id: NodeId,
         i: &ItemKind,
-    ) -> Vec<hir::Attribute> {
+    ) -> Vec<rustc_attr_ir::Attribute> {
         match i {
             ItemKind::Fn(Fn { eii_impl: None, .. })
             | ItemKind::Static(StaticItem { eii_impl: None, .. }) => Vec::new(),
             ItemKind::Fn(Fn { eii_impl: Some(eii_impl), .. })
             | ItemKind::Static(StaticItem { eii_impl: Some(eii_impl), .. }) => {
-                vec![hir::Attribute::Parsed(AttributeKind::EiiImpl(Box::new(
+                vec![rustc_attr_ir::Attribute::Parsed(AttributeKind::EiiImpl(Box::new(
                     self.lower_eii_impl(eii_impl),
                 )))]
             }
             ItemKind::MacroDef(name, MacroDef { eii_declaration: Some(target), .. }) => self
                 .lower_eii_decl(id, *name, target)
-                .map(|decl| vec![hir::Attribute::Parsed(AttributeKind::EiiDeclaration(decl))])
+                .map(|decl| {
+                    vec![rustc_attr_ir::Attribute::Parsed(AttributeKind::EiiDeclaration(decl))]
+                })
                 .unwrap_or_default(),
 
             ItemKind::ExternCrate(..)
@@ -184,7 +185,7 @@ fn lower_item_kind(
         span: Span,
         id: NodeId,
         hir_id: hir::HirId,
-        attrs: &'hir [hir::Attribute],
+        attrs: &'hir [rustc_attr_ir::Attribute],
         vis_span: Span,
         i: &ItemKind,
     ) -> hir::ItemKind<'hir> {
@@ -551,7 +552,7 @@ fn lower_use_tree(
         prefix: &Path,
         id: NodeId,
         vis_span: Span,
-        attrs: &'hir [hir::Attribute],
+        attrs: &'hir [rustc_attr_ir::Attribute],
     ) -> hir::ItemKind<'hir> {
         let path = &tree.prefix;
         let segments = prefix.segments.iter().chain(path.segments.iter()).cloned().collect();
@@ -1351,7 +1352,7 @@ fn lower_maybe_coroutine_body(
         decl: &FnDecl,
         coroutine_marker: Option<CoroutineMarker>,
         body: Option<&Block>,
-        attrs: &'hir [hir::Attribute],
+        attrs: &'hir [rustc_attr_ir::Attribute],
         contract: Option<&FnContract>,
     ) -> hir::BodyId {
         let Some(body) = body else {
@@ -1612,7 +1613,7 @@ fn lower_method_sig(
         id: NodeId,
         kind: FnDeclKind,
         coroutine_marker: Option<CoroutineMarker>,
-        attrs: &[hir::Attribute],
+        attrs: &[rustc_attr_ir::Attribute],
     ) -> (&'hir hir::Generics<'hir>, hir::FnSig<'hir>) {
         let header = self.lower_fn_header(sig.header, hir::Safety::Safe, attrs);
         let itctx = ImplTraitContext::Universal;
@@ -1626,7 +1627,7 @@ pub(super) fn lower_fn_header(
         &mut self,
         h: FnHeader,
         default_safety: hir::Safety,
-        attrs: &[hir::Attribute],
+        attrs: &[rustc_attr_ir::Attribute],
     ) -> hir::FnHeader {
         let asyncness = if let Some(coroutine_marker) = h.coroutine_marker
             && let CoroutineKind::Async = coroutine_marker.kind
@@ -1713,7 +1714,11 @@ fn error_on_invalid_abi(&self, abi: StrLit) {
     /// Lowers constness or comptime attribute.
     /// Whether `const` is allowed here is checked by ast validation.
     /// Whether `comptime` is allowed here is checked by the `comptime` attribute parser.
-    pub(super) fn lower_constness(&mut self, attrs: &[hir::Attribute], c: Const) -> hir::Constness {
+    pub(super) fn lower_constness(
+        &mut self,
+        attrs: &[rustc_attr_ir::Attribute],
+        c: Const,
+    ) -> hir::Constness {
         let mut constness = match c {
             Const::Yes(_) => hir::Constness::Const { always: false },
             Const::No => hir::Constness::NotConst,
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs
index 7ff6a25..d35e8df 100644
--- a/compiler/rustc_ast_lowering/src/lib.rs
+++ b/compiler/rustc_ast_lowering/src/lib.rs
@@ -45,6 +45,9 @@
 use rustc_ast::node_id::NodeMap;
 use rustc_ast::visit::{self, Visitor};
 use rustc_ast::{self as ast, *};
+use rustc_attr_ir::find_attr;
+use rustc_attr_ir::lang_items::LangItem;
+use rustc_attr_ir::target::Target;
 use rustc_attr_parsing::{AttributeParser, Recovery, ShouldEmit};
 use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::sorted_map::SortedMap;
@@ -54,15 +57,13 @@
 use rustc_data_structures::unord::ExtendUnord;
 use rustc_errors::codes::*;
 use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle, ErrorGuaranteed};
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::def::{DefKind, Namespace, PerNS, Res};
 use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId, LocalDefIdMap};
 use rustc_hir::definitions::PerParentDisambiguatorState;
 use rustc_hir::lints::DelayedLint;
 use rustc_hir::{
     self as hir, AngleBrackets, CRATE_OWNER_ID, ConstArg, GenericArg, HirId, ItemLocalMap,
-    LifetimeSource, LifetimeSyntax, MissingLifetimeKind, ParamName, Target, TraitCandidate,
-    find_attr,
+    LifetimeSource, LifetimeSyntax, MissingLifetimeKind, ParamName, TraitCandidate,
 };
 use rustc_index::{Idx, IndexSlice, IndexVec};
 use rustc_macros::extension;
@@ -169,7 +170,7 @@ struct PerOwnerLoweringState<'a, 'hir> {
 
     // -- Accumulated outputs --
     /// Attributes inside the owner being lowered.
-    attrs: SortedMap<hir::ItemLocalId, &'hir [hir::Attribute]>,
+    attrs: SortedMap<hir::ItemLocalId, &'hir [rustc_attr_ir::Attribute]>,
     /// Bodies inside the owner being lowered.
     bodies: Vec<(hir::ItemLocalId, &'hir hir::Body<'hir>)>,
     /// `#[define_opaque]` attributes
@@ -1206,7 +1207,7 @@ fn lower_attrs(
         attrs: &[Attribute],
         target_span: Span,
         target: Target,
-    ) -> &'hir [hir::Attribute] {
+    ) -> &'hir [rustc_attr_ir::Attribute] {
         self.lower_attrs_with_extra(id, attrs, target_span, target, None, &[])
     }
 
@@ -1217,8 +1218,8 @@ fn lower_attrs_with_extra(
         target_span: Span,
         target: Target,
         target_item: Option<&ast::Item>,
-        extra_hir_attributes: &[hir::Attribute],
-    ) -> &'hir [hir::Attribute] {
+        extra_hir_attributes: &[rustc_attr_ir::Attribute],
+    ) -> &'hir [rustc_attr_ir::Attribute] {
         if attrs.is_empty() && extra_hir_attributes.is_empty() {
             &[]
         } else {
@@ -1251,7 +1252,7 @@ fn lower_attrs_vec(
         target_hir_id: HirId,
         target: Target,
         target_item: Option<&ast::Item>,
-    ) -> Vec<hir::Attribute> {
+    ) -> Vec<rustc_attr_ir::Attribute> {
         let l = self.span_lowerer();
         self.attribute_parser.parse_attribute_list(
             attrs,
@@ -3111,7 +3112,7 @@ fn stmt_expr(&mut self, span: Span, expr: hir::Expr<'hir>) -> hir::Stmt<'hir> {
 
     fn stmt_let_pat(
         &mut self,
-        attrs: Option<&'hir [hir::Attribute]>,
+        attrs: Option<&'hir [rustc_attr_ir::Attribute]>,
         span: Span,
         init: Option<&'hir hir::Expr<'hir>>,
         pat: &'hir hir::Pat<'hir>,
diff --git a/compiler/rustc_ast_lowering/src/pat.rs b/compiler/rustc_ast_lowering/src/pat.rs
index 0edba3f..df3d7b1 100644
--- a/compiler/rustc_ast_lowering/src/pat.rs
+++ b/compiler/rustc_ast_lowering/src/pat.rs
@@ -1,9 +1,10 @@
 use std::sync::Arc;
 
 use rustc_ast::*;
-use rustc_hir::attrs::lang_items::LangItem;
+use rustc_attr_ir::lang_items::LangItem;
+use rustc_attr_ir::target::Target;
+use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Res};
-use rustc_hir::{self as hir, Target};
 use rustc_span::{DesugaringKind, Ident, Span, Spanned, respan, span_bug};
 
 use crate::diagnostics::{
diff --git a/compiler/rustc_hir/src/lib.rs b/compiler/rustc_hir/src/lib.rs
index 0f31ed1..5855c11 100644
--- a/compiler/rustc_hir/src/lib.rs
+++ b/compiler/rustc_hir/src/lib.rs
@@ -24,20 +24,18 @@
 mod stable_hash_impls;
 mod target_impls;
 
+// FIXME: Remove this use tree, replace by `rustc_attr_ir` imports
+#[doc(hidden)]
+pub use attrs::{
+    Attribute, ConstStability, DefaultBodyStability, Stability, StabilityLevel, StableSince,
+    UnstableReason, target::Target,
+};
 #[doc(no_inline)]
 pub use hir::*;
+// FIXME: Remove this use tree, replace by `rustc_attr_ir` imports
+#[doc(hidden)]
 pub use rustc_attr_ir::{self as attrs, find_attr};
 pub use rustc_hir_id::*;
 pub use rustc_span::def_id;
-// FIXME: Remove this use tree, replace by `rustc_hir::attrs` or `rustc_attr_ir` imports
-#[doc(hidden)]
-pub use {
-    attrs::target::{self, AssocCtxt, MethodKind, Target},
-    attrs::{
-        AttrArgs, AttrItem, AttrPath, Attribute, ConstStability, DefaultBodyStability,
-        HashIgnoredAttrId, PartialConstStability, Stability, StabilityLevel, StableSince,
-        UnstableReason, VERSION_PLACEHOLDER,
-    },
-};
 
 pub use crate::arena::Arena;
diff --git a/compiler/rustc_hir_pretty/Cargo.toml b/compiler/rustc_hir_pretty/Cargo.toml
index f5d7dbd..8279d9c 100644
--- a/compiler/rustc_hir_pretty/Cargo.toml
+++ b/compiler/rustc_hir_pretty/Cargo.toml
@@ -8,6 +8,7 @@
 rustc_abi = { path = "../rustc_abi" }
 rustc_ast = { path = "../rustc_ast" }
 rustc_ast_pretty = { path = "../rustc_ast_pretty" }
+rustc_attr_ir = { path = "../rustc_attr_ir" }
 rustc_hir = { path = "../rustc_hir" }
 rustc_span = { path = "../rustc_span" }
 # tidy-alphabetical-end
diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs
index 6d1ae56..ddd1a29 100644
--- a/compiler/rustc_hir_pretty/src/lib.rs
+++ b/compiler/rustc_hir_pretty/src/lib.rs
@@ -16,8 +16,8 @@
 use rustc_ast_pretty::pp::{self, BoxMarker, Breaks};
 use rustc_ast_pretty::pprust::state::MacHeader;
 use rustc_ast_pretty::pprust::{Comments, PrintState};
+use rustc_attr_ir::{AttrArgs, AttrItem, Attribute, AttributeKind, PrintAttribute};
 use rustc_hir as hir;
-use rustc_hir::attrs::{AttributeKind, PrintAttribute};
 use rustc_hir::{
     BindingMode, ByRef, ConstArg, ConstArgExprField, ConstArgKind, GenericArg, GenericBound,
     GenericParam, GenericParamKind, HirId, ImplicitSelfKind, LifetimeParamKind, Node, PatKind,
@@ -72,12 +72,12 @@ fn nested(&self, state: &mut State<'_>, nested: Nested) {
 pub struct State<'a> {
     pub s: pp::Printer,
     comments: Option<Comments<'a>>,
-    attrs: &'a dyn Fn(HirId) -> &'a [hir::Attribute],
+    attrs: &'a dyn Fn(HirId) -> &'a [Attribute],
     ann: &'a (dyn PpAnn + 'a),
 }
 
 impl<'a> State<'a> {
-    fn attrs(&self, id: HirId) -> &'a [hir::Attribute] {
+    fn attrs(&self, id: HirId) -> &'a [Attribute] {
         (self.attrs)(id)
     }
 
@@ -86,7 +86,7 @@ fn precedence(&self, expr: &hir::Expr<'_>) -> ExprPrecedence {
         expr.precedence(&has_attr)
     }
 
-    fn print_attrs(&mut self, attrs: &[hir::Attribute]) {
+    fn print_attrs(&mut self, attrs: &[Attribute]) {
         if attrs.is_empty() {
             return;
         }
@@ -99,9 +99,9 @@ fn print_attrs(&mut self, attrs: &[hir::Attribute]) {
 
     /// Print a single attribute as if it has style `style`, disregarding the
     /// actual style of the attribute.
-    fn print_attribute_as_style(&mut self, attr: &hir::Attribute, style: ast::AttrStyle) {
+    fn print_attribute_as_style(&mut self, attr: &Attribute, style: ast::AttrStyle) {
         match &attr {
-            hir::Attribute::Unparsed(unparsed) => {
+            Attribute::Unparsed(unparsed) => {
                 self.maybe_print_comment(unparsed.span.lo());
                 match style {
                     ast::AttrStyle::Inner => self.word("#!["),
@@ -111,13 +111,13 @@ fn print_attribute_as_style(&mut self, attr: &hir::Attribute, style: ast::AttrSt
                 self.word("]");
                 self.hardbreak()
             }
-            hir::Attribute::Parsed(AttributeKind::DocComment { kind, comment, .. }) => {
+            Attribute::Parsed(AttributeKind::DocComment { kind, comment, .. }) => {
                 self.word(rustc_ast_pretty::pprust::state::doc_comment_to_string(
                     *kind, style, *comment,
                 ));
                 self.hardbreak()
             }
-            hir::Attribute::Parsed(pa) => {
+            Attribute::Parsed(pa) => {
                 match style {
                     ast::AttrStyle::Inner => self.word("#![attr = "),
                     ast::AttrStyle::Outer => self.word("#[attr = "),
@@ -129,7 +129,7 @@ fn print_attribute_as_style(&mut self, attr: &hir::Attribute, style: ast::AttrSt
         }
     }
 
-    fn print_attr_item(&mut self, item: &hir::AttrItem, span: Span) {
+    fn print_attr_item(&mut self, item: &AttrItem, span: Span) {
         let ib = self.ibox(0);
         let path = ast::Path {
             span,
@@ -146,21 +146,20 @@ fn print_attr_item(&mut self, item: &hir::AttrItem, span: Span) {
         };
 
         match &item.args {
-            hir::AttrArgs::Delimited(DelimArgs { dspan: _, delim, tokens }) => self
-                .print_mac_common(
-                    Some(MacHeader::Path(&path)),
-                    false,
-                    None,
-                    *delim,
-                    None,
-                    &tokens,
-                    true,
-                    span,
-                ),
-            hir::AttrArgs::Empty => {
+            AttrArgs::Delimited(DelimArgs { dspan: _, delim, tokens }) => self.print_mac_common(
+                Some(MacHeader::Path(&path)),
+                false,
+                None,
+                *delim,
+                None,
+                &tokens,
+                true,
+                span,
+            ),
+            AttrArgs::Empty => {
                 PrintState::print_path(self, &path, false, 0);
             }
-            hir::AttrArgs::Eq { eq_span: _, expr } => {
+            AttrArgs::Eq { eq_span: _, expr } => {
                 PrintState::print_path(self, &path, false, 0);
                 self.space();
                 self.word_space("=");
@@ -277,7 +276,7 @@ pub fn print_crate<'a>(
     krate: &hir::Mod<'_>,
     filename: FileName,
     input: String,
-    attrs: &'a dyn Fn(HirId) -> &'a [hir::Attribute],
+    attrs: &'a dyn Fn(HirId) -> &'a [Attribute],
     ann: &'a dyn PpAnn,
 ) -> String {
     let mut s = State {
@@ -311,7 +310,7 @@ fn to_string<F>(ann: &dyn PpAnn, f: F) -> String
     printer.s.eof()
 }
 
-pub fn attribute_to_string(ann: &dyn PpAnn, attr: &hir::Attribute) -> String {
+pub fn attribute_to_string(ann: &dyn PpAnn, attr: &Attribute) -> String {
     to_string(ann, |s| s.print_attribute_as_style(attr, ast::AttrStyle::Outer))
 }
 
diff --git a/compiler/rustc_middle/src/arena.rs b/compiler/rustc_middle/src/arena.rs
index ee71d4d..a423b6b 100644
--- a/compiler/rustc_middle/src/arena.rs
+++ b/compiler/rustc_middle/src/arena.rs
@@ -107,9 +107,9 @@
     upvars_mentioned: rustc_data_structures::fx::FxIndexMap<rustc_hir::HirId, rustc_hir::Upvar>,
     dyn_compatibility_violations: rustc_middle::traits::DynCompatibilityViolation,
     codegen_unit: rustc_middle::mono::CodegenUnit<'tcx>,
-    attribute: rustc_hir::Attribute,
+    attribute: rustc_attr_ir::Attribute,
     name_set: rustc_data_structures::unord::UnordSet<rustc_span::Symbol>,
-    autodiff_item: rustc_hir::attrs::AutoDiffItem,
+    autodiff_item: rustc_attr_ir::AutoDiffItem,
     ordered_name_set: rustc_data_structures::fx::FxIndexSet<rustc_span::Symbol>,
     stable_order_of_exportable_impls:
         rustc_data_structures::fx::FxIndexMap<rustc_hir::def_id::DefId, usize>,
@@ -131,7 +131,7 @@
         >,
     external_constraints: rustc_middle::traits::solve::ExternalConstraintsData<TyCtxt<'tcx>>,
     doc_link_resolutions: rustc_middle::middle::resolve::DocLinkResMap,
-    stripped_cfg_items: rustc_hir::attrs::StrippedCfgItem,
+    stripped_cfg_items: rustc_attr_ir::StrippedCfgItem,
     mod_child: rustc_middle::middle::resolve::ModChild,
     features: rustc_feature::Features,
     specialization_graph: rustc_middle::traits::specialization_graph::Graph,
@@ -204,9 +204,9 @@ fn decode(decoder: &mut impl TyDecoder<'tcx>) -> &'tcx Self {
     Spanned<MonoItem<'tcx>>,
     rustc_ast::InlineAsmTemplatePiece,
     rustc_ast::tokenstream::TokenStream,
+    rustc_attr_ir::Attribute,
     rustc_data_structures::unord::UnordMap<rustc_span::def_id::DefId, rustc_middle::ty::EarlyBinder<'tcx, Ty<'tcx>>>,
     rustc_data_structures::unord::UnordSet<rustc_span::def_id::LocalDefId>,
-    rustc_hir::Attribute,
     rustc_index::IndexVec<rustc_middle::mir::Promoted, rustc_middle::mir::Body<'tcx>>,
     rustc_middle::middle::deduced_param_attrs::DeducedParamAttrs,
     rustc_middle::mir::Body<'tcx>,
diff --git a/compiler/rustc_middle/src/hir/map.rs b/compiler/rustc_middle/src/hir/map.rs
index affadfd..664c859 100644
--- a/compiler/rustc_middle/src/hir/map.rs
+++ b/compiler/rustc_middle/src/hir/map.rs
@@ -4,6 +4,7 @@
 
 use rustc_abi::ExternAbi;
 use rustc_ast::visit::{VisitorResult, walk_list};
+use rustc_attr_ir::{Attribute, find_attr};
 use rustc_data_structures::fingerprint::Fingerprint;
 use rustc_data_structures::stable_hash::{StableHash, StableHasher};
 use rustc_data_structures::steal::Steal;
diff --git a/compiler/rustc_middle/src/hir/mod.rs b/compiler/rustc_middle/src/hir/mod.rs
index eae84fd..d899ba0 100644
--- a/compiler/rustc_middle/src/hir/mod.rs
+++ b/compiler/rustc_middle/src/hir/mod.rs
@@ -6,12 +6,13 @@
 pub mod nested_filter;
 pub mod place;
 
+use rustc_attr_ir::Attribute;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_data_structures::fingerprint::Fingerprint;
 use rustc_data_structures::sorted_map::SortedMap;
 use rustc_data_structures::stable_hash::{StableHash, StableHasher};
 use rustc_data_structures::steal::Steal;
 use rustc_data_structures::sync::{DynSend, DynSync, try_par_for_each_in};
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::def::{DefKind, Res};
 use rustc_hir::def_id::{DefId, LocalDefId, LocalDefIdMap, LocalModId};
 use rustc_hir::lints::DelayedLints;
diff --git a/compiler/rustc_middle/src/middle/debugger_visualizer.rs b/compiler/rustc_middle/src/middle/debugger_visualizer.rs
index b6fc2d4..0fded7a 100644
--- a/compiler/rustc_middle/src/middle/debugger_visualizer.rs
+++ b/compiler/rustc_middle/src/middle/debugger_visualizer.rs
@@ -1,7 +1,7 @@
 use std::path::PathBuf;
 use std::sync::Arc;
 
-use rustc_hir::attrs::DebuggerVisualizerType;
+use rustc_attr_ir::DebuggerVisualizerType;
 use rustc_macros::{Decodable, Encodable, StableHash};
 
 /// A single debugger visualizer file.
diff --git a/compiler/rustc_middle/src/middle/lang_items.rs b/compiler/rustc_middle/src/middle/lang_items.rs
index 829df12..9d07c2e 100644
--- a/compiler/rustc_middle/src/middle/lang_items.rs
+++ b/compiler/rustc_middle/src/middle/lang_items.rs
@@ -7,7 +7,7 @@
 //! * Traits that represent operators; e.g., `Add`, `Sub`, `Index`.
 //! * Functions called by the compiler itself.
 
-use rustc_hir::attrs::lang_items::LangItem;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_hir::def_id::DefId;
 use rustc_span::Span;
 use rustc_target::spec::PanicStrategy;
diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs
index 4c4a169..6bb0190 100644
--- a/compiler/rustc_middle/src/mir/syntax.rs
+++ b/compiler/rustc_middle/src/mir/syntax.rs
@@ -1712,7 +1712,7 @@ pub enum BinOp {
     /// - `Ordering::Equal` (`0_i8`, as a Scalar) if `A == B`
     /// - `Ordering::Greater` (`+1_i8`, as a Scalar) if `A > B`
     ///
-    /// [`LangItem::OrderingEnum`]: rustc_hir::attrs::lang_items::LangItem
+    /// [`LangItem::OrderingEnum`]: rustc_attr_ir::lang_items::LangItem
     Cmp,
     /// The `ptr.offset` operator
     Offset,
diff --git a/compiler/rustc_middle/src/mir/terminator.rs b/compiler/rustc_middle/src/mir/terminator.rs
index cc75beb..2d51f38 100644
--- a/compiler/rustc_middle/src/mir/terminator.rs
+++ b/compiler/rustc_middle/src/mir/terminator.rs
@@ -3,9 +3,9 @@
 use std::slice;
 
 use rustc_ast::InlineAsmOptions;
+use rustc_attr_ir::AttributeKind;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_data_structures::packed::Pu128;
-use rustc_hir::attrs::AttributeKind;
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_macros::{StableHash, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
 use rustc_span::bug;
 use smallvec::{SmallVec, smallvec};
diff --git a/compiler/rustc_middle/src/mono.rs b/compiler/rustc_middle/src/mono.rs
index 76828cb..a54ca4f 100644
--- a/compiler/rustc_middle/src/mono.rs
+++ b/compiler/rustc_middle/src/mono.rs
@@ -2,6 +2,7 @@
 use std::fmt;
 use std::hash::Hash;
 
+use rustc_attr_ir::{InlineAttr, Linkage};
 use rustc_data_structures::base_n::{BaseNString, CASE_INSENSITIVE, ToBaseN};
 use rustc_data_structures::fingerprint::Fingerprint;
 use rustc_data_structures::fx::FxIndexMap;
@@ -11,7 +12,6 @@
 use rustc_data_structures::unord::UnordMap;
 use rustc_hashes::Hash128;
 use rustc_hir::ItemId;
-use rustc_hir::attrs::{InlineAttr, Linkage};
 use rustc_hir::def_id::{CrateNum, DefId, DefIdSet, LOCAL_CRATE};
 use rustc_macros::{StableHash, TyDecodable, TyEncodable};
 use rustc_session::config::OptLevel;
diff --git a/compiler/rustc_middle/src/queries.rs b/compiler/rustc_middle/src/queries.rs
index 9e1bafa..cb39c17 100644
--- a/compiler/rustc_middle/src/queries.rs
+++ b/compiler/rustc_middle/src/queries.rs
@@ -53,6 +53,7 @@
 use rustc_ast as ast;
 use rustc_ast::expand::allocator::AllocatorKind;
 use rustc_ast::tokenstream::TokenStream;
+use rustc_attr_ir::diagnostic_items::DiagnosticItems;
 use rustc_attr_ir::lang_items::{LangItem, LanguageItems};
 use rustc_attr_ir::{CanonicalSymbols, EiiDecl, EiiImpl, StrippedCfgItem};
 use rustc_crate_store::{
@@ -1493,19 +1494,19 @@ fn describe_as_module(def_id: impl Into<LocalDefId>, tcx: TyCtxt<'_>) -> String
         cache_on_disk
     }
 
-    query lookup_stability(def_id: DefId) -> Option<hir::Stability> {
+    query lookup_stability(def_id: DefId) -> Option<rustc_attr_ir::Stability> {
         desc { "looking up stability of `{}`", tcx.def_path_str(def_id) }
         cache_on_disk
         separate_provide_extern
     }
 
-    query lookup_const_stability(def_id: DefId) -> Option<hir::ConstStability> {
+    query lookup_const_stability(def_id: DefId) -> Option<rustc_attr_ir::ConstStability> {
         desc { "looking up const stability of `{}`", tcx.def_path_str(def_id) }
         cache_on_disk
         separate_provide_extern
     }
 
-    query lookup_default_body_stability(def_id: DefId) -> Option<hir::DefaultBodyStability> {
+    query lookup_default_body_stability(def_id: DefId) -> Option<rustc_attr_ir::DefaultBodyStability> {
         desc { "looking up default body stability of `{}`", tcx.def_path_str(def_id) }
         separate_provide_extern
     }
@@ -2302,7 +2303,7 @@ fn describe_as_module(def_id: impl Into<LocalDefId>, tcx: TyCtxt<'_>) -> String
     }
 
     /// Returns all diagnostic items defined in all crates.
-    query all_diagnostic_items(_: ()) -> &'tcx rustc_hir::attrs::diagnostic_items::DiagnosticItems {
+    query all_diagnostic_items(_: ()) -> &'tcx DiagnosticItems {
         arena_cache
         eval_always
         desc { "calculating the diagnostic items map" }
@@ -2322,7 +2323,7 @@ fn describe_as_module(def_id: impl Into<LocalDefId>, tcx: TyCtxt<'_>) -> String
     }
 
     /// Returns the diagnostic items defined in a crate.
-    query diagnostic_items(_: CrateNum) -> &'tcx rustc_hir::attrs::diagnostic_items::DiagnosticItems {
+    query diagnostic_items(_: CrateNum) -> &'tcx DiagnosticItems {
         arena_cache
         desc { "calculating the diagnostic items map in a crate" }
         separate_provide_extern
diff --git a/compiler/rustc_middle/src/query/erase.rs b/compiler/rustc_middle/src/query/erase.rs
index 15a6844..b0281a7 100644
--- a/compiler/rustc_middle/src/query/erase.rs
+++ b/compiler/rustc_middle/src/query/erase.rs
@@ -185,11 +185,11 @@ impl Erasable for $ty {
     Option<(rustc_span::def_id::DefId, rustc_session::config::EntryFnType)>,
     Option<rustc_abi::Align>,
     Option<rustc_ast::expand::allocator::AllocatorKind>,
+    Option<rustc_attr_ir::ConstStability>,
+    Option<rustc_attr_ir::DefaultBodyStability>,
+    Option<rustc_attr_ir::Stability>,
     Option<rustc_data_structures::svh::Svh>,
-    Option<rustc_hir::ConstStability>,
     Option<rustc_hir::CoroutineKind>,
-    Option<rustc_hir::DefaultBodyStability>,
-    Option<rustc_hir::Stability>,
     Option<rustc_middle::middle::stability::DeprecationEntry>,
     Option<rustc_middle::ty::AsyncDestructor>,
     Option<rustc_middle::ty::Destructor>,
diff --git a/compiler/rustc_middle/src/thir.rs b/compiler/rustc_middle/src/thir.rs
index b20dfe6..69d518b 100644
--- a/compiler/rustc_middle/src/thir.rs
+++ b/compiler/rustc_middle/src/thir.rs
@@ -15,10 +15,10 @@
 
 use rustc_abi::{FieldIdx, Integer, Size, VariantIdx};
 use rustc_ast::{AsmMacro, InlineAsmOptions, InlineAsmTemplatePiece, Mutability};
+use rustc_attr_ir::AttributeKind;
 use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::thin_vec::ThinVec;
 use rustc_hir as hir;
-use rustc_hir::attrs::AttributeKind;
 use rustc_hir::def_id::DefId;
 use rustc_hir::{BindingMode, ByRef, HirId, MatchSource, RangeEnd};
 use rustc_index::{IndexVec, newtype_index};
diff --git a/compiler/rustc_middle/src/traits/specialization_graph.rs b/compiler/rustc_middle/src/traits/specialization_graph.rs
index 19b72d1..b13af27 100644
--- a/compiler/rustc_middle/src/traits/specialization_graph.rs
+++ b/compiler/rustc_middle/src/traits/specialization_graph.rs
@@ -1,7 +1,7 @@
+use rustc_attr_ir::find_attr;
 use rustc_data_structures::fx::FxIndexMap;
 use rustc_errors::ErrorGuaranteed;
 use rustc_hir::def_id::{DefId, DefIdMap};
-use rustc_hir::find_attr;
 use rustc_macros::{StableHash, TyDecodable, TyEncodable};
 
 use crate::diagnostics::StrictCoherenceNeedsNegativeCoherence;
diff --git a/compiler/rustc_middle/src/ty/adjustment.rs b/compiler/rustc_middle/src/ty/adjustment.rs
index 00efbe9..b3a2925 100644
--- a/compiler/rustc_middle/src/ty/adjustment.rs
+++ b/compiler/rustc_middle/src/ty/adjustment.rs
@@ -1,6 +1,6 @@
 use rustc_abi::FieldIdx;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_hir as hir;
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::def_id::DefId;
 use rustc_macros::{StableHash, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
 use rustc_span::Span;
diff --git a/compiler/rustc_middle/src/ty/adt.rs b/compiler/rustc_middle/src/ty/adt.rs
index d189fbc..8ad5de3 100644
--- a/compiler/rustc_middle/src/ty/adt.rs
+++ b/compiler/rustc_middle/src/ty/adt.rs
@@ -4,6 +4,8 @@
 use std::str;
 
 use rustc_abi::{FIRST_VARIANT, FieldIdx, ReprOptions, VariantIdx};
+use rustc_attr_ir::find_attr;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_data_structures::fingerprint::Fingerprint;
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::intern::Interned;
@@ -11,10 +13,9 @@
     StableHash, StableHashControls, StableHashCtxt, StableHasher,
 };
 use rustc_errors::ErrorGuaranteed;
-use rustc_hir::attrs::lang_items::LangItem;
+use rustc_hir as hir;
 use rustc_hir::def::{CtorKind, DefKind, Res};
 use rustc_hir::def_id::DefId;
-use rustc_hir::{self as hir, find_attr};
 use rustc_index::{IndexSlice, IndexVec};
 use rustc_macros::{StableHash, TyDecodable, TyEncodable};
 use rustc_session::DataTypeKind;
diff --git a/compiler/rustc_middle/src/ty/consts/lit.rs b/compiler/rustc_middle/src/ty/consts/lit.rs
index 08dadf6..9dd8c95 100644
--- a/compiler/rustc_middle/src/ty/consts/lit.rs
+++ b/compiler/rustc_middle/src/ty/consts/lit.rs
@@ -1,6 +1,5 @@
 use rustc_ast::{LitFloatType, LitIntType, LitKind};
-use rustc_hir;
-use rustc_hir::attrs::lang_items::LangItem;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_macros::StableHash;
 
 use crate::ty::{self, Ty, TyCtxt};
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index 4009191..9edb129 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -17,6 +17,8 @@
 
 use rustc_abi::{ExternAbi, FieldIdx, Layout, LayoutData, TargetDataLayout, VariantIdx};
 use rustc_ast as ast;
+use rustc_attr_ir::find_attr;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_crate_store::{CrateStoreDyn, Untracked};
 use rustc_data_structures::defer;
 use rustc_data_structures::fx::FxHashMap;
@@ -29,12 +31,11 @@
     self, DynSend, DynSync, FreezeReadGuard, Lock, RwLock, WorkerLocal,
 };
 use rustc_errors::{Applicability, Diag, DiagCtxtHandle, Diagnostic, MultiSpan};
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId};
 use rustc_hir::definitions::{DefPathData, Definitions, PerParentDisambiguatorState};
 use rustc_hir::intravisit::Visitor;
-use rustc_hir::{self as hir, CRATE_HIR_ID, HirId, Node, TraitCandidate, find_attr};
+use rustc_hir::{self as hir, CRATE_HIR_ID, HirId, Node, TraitCandidate};
 use rustc_index::IndexVec;
 use rustc_lint_defs::Lint;
 use rustc_lint_defs::builtin::UNUSED_FEATURES;
@@ -990,7 +991,7 @@ pub fn create_global_ctxt<T>(
     }
 
     /// Obtain all lang items of this crate and all dependencies (recursively)
-    pub fn lang_items(self) -> &'tcx rustc_hir::attrs::lang_items::LanguageItems {
+    pub fn lang_items(self) -> &'tcx rustc_attr_ir::lang_items::LanguageItems {
         self.get_lang_items(())
     }
 
diff --git a/compiler/rustc_middle/src/ty/context/impl_interner.rs b/compiler/rustc_middle/src/ty/context/impl_interner.rs
index f13797b..fdaf5ca 100644
--- a/compiler/rustc_middle/src/ty/context/impl_interner.rs
+++ b/compiler/rustc_middle/src/ty/context/impl_interner.rs
@@ -2,10 +2,10 @@
 
 use std::{debug_assert_matches, fmt};
 
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_data_structures::intern::Interned;
 use rustc_errors::ErrorGuaranteed;
 use rustc_hir as hir;
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::def::{CtorKind, DefKind};
 use rustc_hir::def_id::{DefId, LocalDefId};
 use rustc_span::{DUMMY_SP, Span, Symbol, bug};
diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs
index 1f2a9ac..df1daac 100644
--- a/compiler/rustc_middle/src/ty/diagnostics.rs
+++ b/compiler/rustc_middle/src/ty/diagnostics.rs
@@ -3,9 +3,9 @@
 use std::fmt::Write;
 use std::ops::ControlFlow;
 
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_data_structures::fx::FxIndexMap;
 use rustc_errors::{Applicability, Diag, DiagArgValue, IntoDiagArg, listify, pluralize};
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::def::{DefKind, Namespace};
 use rustc_hir::def_id::DefId;
 use rustc_hir::{self as hir, AmbigArg, PredicateOrigin, WherePredicateKind};
diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs
index 44e5a87..1a00293 100644
--- a/compiler/rustc_middle/src/ty/instance.rs
+++ b/compiler/rustc_middle/src/ty/instance.rs
@@ -1,9 +1,9 @@
 use std::{assert_matches, fmt};
 
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_data_structures::fx::FxHashMap;
 use rustc_errors::ErrorGuaranteed;
 use rustc_hir as hir;
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::def::{CtorKind, DefKind, Namespace};
 use rustc_hir::def_id::{CrateNum, DefId};
 use rustc_macros::{Lift, StableHash, TyDecodable, TyEncodable};
@@ -231,7 +231,7 @@ pub fn upstream_monomorphization(&self, tcx: TyCtxt<'tcx>) -> Option<CrateNum> {
         if !tcx.sess.opts.share_generics()
             // However, if the def_id is marked inline(never), then it's fine to just reuse the
             // upstream monomorphization.
-            && tcx.codegen_fn_attrs(self.def_id()).inline != rustc_hir::attrs::InlineAttr::Never
+            && tcx.codegen_fn_attrs(self.def_id()).inline != rustc_attr_ir::InlineAttr::Never
         {
             return None;
         }
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
index 1e4e96c..7952b97 100644
--- a/compiler/rustc_middle/src/ty/layout.rs
+++ b/compiler/rustc_middle/src/ty/layout.rs
@@ -6,9 +6,9 @@
     PointerKind, Primitive, ReprFlags, ReprOptions, Scalar, Size, TagEncoding, TargetDataLayout,
     TyAbiInterface, VariantIdx, Variants,
 };
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_errors::{Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, IntoDiagArg, Level};
 use rustc_hir as hir;
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::def_id::DefId;
 use rustc_macros::{StableHash, TyDecodable, TyEncodable, extension};
 use rustc_session::config::OptLevel;
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index c7de3af..1f2ffb1 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -1870,7 +1870,7 @@ pub fn instance_mir(self, instance: ty::InstanceKind<'tcx>) -> &'tcx Body<'tcx>
     }
 
     /// Gets all attributes with the given name.
-    #[deprecated = "Though there are valid usecases for this method, especially when your attribute is not a parsed attribute, usually you want to call rustc_hir::find_attr! instead."]
+    #[deprecated = "Though there are valid usecases for this method, especially when your attribute is not a parsed attribute, usually you want to use `rustc_attr_ir::find_attr!` instead."]
     pub fn get_attrs(
         self,
         did: impl Into<DefId>,
@@ -1889,7 +1889,7 @@ pub fn get_attrs(
     ///
     /// </div>
     ///
-    #[deprecated = "Though there are valid usecases for this method, especially when your attribute is not a parsed attribute, usually you want to call rustc_hir::find_attr! instead."]
+    #[deprecated = "Though there are valid usecases for this method, especially when your attribute is not a parsed attribute, usually you want to use `rustc_attr_ir::find_attr!` instead."]
     pub fn get_all_attrs(self, did: impl Into<DefId>) -> &'tcx [rustc_attr_ir::Attribute] {
         let did: DefId = did.into();
         if let Some(did) = did.as_local() {
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index 3ba7ea6..cafe93c 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -6,11 +6,11 @@
 use rustc_abi::{ExternAbi, Size};
 use rustc_apfloat::Float;
 use rustc_apfloat::ieee::{Double, Half, Quad, Single};
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_crate_store::{ExternCrate, ExternCrateSource};
 use rustc_data_structures::fx::{FxIndexMap, IndexEntry};
 use rustc_data_structures::unord::UnordMap;
 use rustc_hir as hir;
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::def::{self, CtorKind, DefKind, Namespace};
 use rustc_hir::def_id::{DefIdMap, DefIdSet, LOCAL_CRATE, ModId};
 use rustc_hir::definitions::{DefKey, DefPathDataName};
diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs
index 02107fe..3710a15 100644
--- a/compiler/rustc_middle/src/ty/structural_impls.rs
+++ b/compiler/rustc_middle/src/ty/structural_impls.rs
@@ -217,11 +217,11 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
     rustc_abi::VariantIdx,
     rustc_ast::InlineAsmOptions,
     rustc_ast::InlineAsmTemplatePiece,
+    rustc_attr_ir::AttributeKind,
     rustc_hir::CoroutineKind,
     rustc_hir::HirId,
     rustc_hir::MatchSource,
     rustc_hir::RangeEnd,
-    rustc_hir::attrs::AttributeKind,
     rustc_hir::def_id::LocalDefId,
     rustc_span::Ident,
     rustc_span::Span,
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index fe569bf..c32ddb7 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -8,9 +8,9 @@
 
 use hir::def::{CtorKind, DefKind};
 use rustc_abi::{FIRST_VARIANT, FieldIdx, NumScalableVectors, ScalableElt, VariantIdx};
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_errors::{ErrorGuaranteed, MultiSpan};
 use rustc_hir as hir;
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::def_id::DefId;
 use rustc_macros::{StableHash, TyDecodable, TyEncodable, TypeFoldable, extension};
 use rustc_span::{DUMMY_SP, Span, Symbol, bug, kw, sym};
diff --git a/compiler/rustc_middle/src/ty/trait_def.rs b/compiler/rustc_middle/src/ty/trait_def.rs
index fce9af1..114e533 100644
--- a/compiler/rustc_middle/src/ty/trait_def.rs
+++ b/compiler/rustc_middle/src/ty/trait_def.rs
@@ -1,10 +1,11 @@
 use std::iter;
 
+use rustc_attr_ir::find_attr;
 use rustc_data_structures::fx::FxIndexMap;
 use rustc_errors::ErrorGuaranteed;
+use rustc_hir as hir;
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::{DefId, LOCAL_CRATE};
-use rustc_hir::{self as hir, find_attr};
 use rustc_macros::{Decodable, Encodable, StableHash};
 use rustc_span::{Span, bug};
 use tracing::debug;
diff --git a/compiler/rustc_middle/src/ty/util.rs b/compiler/rustc_middle/src/ty/util.rs
index a66d152..ac16d9d 100644
--- a/compiler/rustc_middle/src/ty/util.rs
+++ b/compiler/rustc_middle/src/ty/util.rs
@@ -4,13 +4,14 @@
 
 use rustc_abi::{Float, Integer, IntegerType, Size};
 use rustc_apfloat::Float as _;
+use rustc_attr_ir::find_attr;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_data_structures::stable_hash::{StableHash, StableHasher};
 use rustc_errors::ErrorGuaranteed;
 use rustc_hashes::Hash128;
+use rustc_hir as hir;
 use rustc_hir::def::{CtorOf, DefKind, Res};
 use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
-use rustc_hir::{self as hir, find_attr};
 use rustc_index::bit_set::GrowableBitSet;
 use rustc_macros::{StableHash, TyDecodable, TyEncodable, extension};
 use rustc_span::{bug, span_bug, sym};
diff --git a/compiler/rustc_passes/src/abi_test.rs b/compiler/rustc_passes/src/abi_test.rs
index f2b98f1..1a2ccc7 100644
--- a/compiler/rustc_passes/src/abi_test.rs
+++ b/compiler/rustc_passes/src/abi_test.rs
@@ -1,7 +1,6 @@
-use rustc_hir::attrs::RustcAbiAttrKind;
+use rustc_attr_ir::{RustcAbiAttrKind, find_attr};
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::LocalDefId;
-use rustc_hir::find_attr;
 use rustc_middle::ty::layout::{FnAbiError, LayoutError};
 use rustc_middle::ty::{self, GenericArgs, Instance, Ty, TyCtxt};
 use rustc_span::{Span, span_bug};
diff --git a/compiler/rustc_passes/src/canonical_symbols.rs b/compiler/rustc_passes/src/canonical_symbols.rs
index 7a67a46..afecab4 100644
--- a/compiler/rustc_passes/src/canonical_symbols.rs
+++ b/compiler/rustc_passes/src/canonical_symbols.rs
@@ -1,5 +1,5 @@
-use rustc_hir::attrs::CanonicalSymbols;
-use rustc_hir::{ForeignItemId, find_attr};
+use rustc_attr_ir::{CanonicalSymbols, find_attr};
+use rustc_hir::ForeignItemId;
 use rustc_middle::query::{LocalCrate, Providers};
 use rustc_middle::ty::{Instance, List, TyCtxt};
 use rustc_span::def_id::{DefId, LOCAL_CRATE};
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index f6bd780..4926ec9 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -10,23 +10,23 @@
 
 use rustc_abi::ExternAbi;
 use rustc_ast::MetaItemKind;
+use rustc_attr_ir::diagnostic::Directive;
+use rustc_attr_ir::lang_items::LangItem;
+use rustc_attr_ir::target::{AssocCtxt, MethodKind, Target};
+use rustc_attr_ir::{
+    Attribute, AttributeKind, DocAttribute, DocInline, EiiDecl, EiiImpl, EiiImplResolution,
+    InlineAttr, OptimizeAttr, ReprAttr, find_attr,
+};
 use rustc_attr_parsing::AttributeParser;
 use rustc_data_structures::thin_vec::ThinVec;
 use rustc_errors::{DiagCtxtHandle, IntoDiagArg, MultiSpan, msg};
 use rustc_feature::BUILTIN_ATTRIBUTE_SET;
-use rustc_hir::attrs::diagnostic::Directive;
-use rustc_hir::attrs::lang_items::LangItem;
-use rustc_hir::attrs::{
-    AttributeKind, DocAttribute, DocInline, EiiDecl, EiiImpl, EiiImplResolution, InlineAttr,
-    OptimizeAttr, ReprAttr,
-};
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::LocalModId;
 use rustc_hir::intravisit::{self, Visitor};
 use rustc_hir::{
-    self as hir, AssocCtxt, Attribute, CRATE_HIR_ID, Constness, FnSig, ForeignItem, GenericParam,
-    GenericParamKind, HirId, Item, ItemKind, MethodKind, Mod, Node, ParamName, Target, TraitItem,
-    find_attr,
+    self as hir, CRATE_HIR_ID, Constness, FnSig, ForeignItem, GenericParam, GenericParamKind,
+    HirId, Item, ItemKind, Mod, Node, ParamName, TraitItem,
 };
 use rustc_lint_defs::builtin::{
     CONFLICTING_REPR_HINTS, INVALID_DOC_ATTRIBUTES, MALFORMED_DIAGNOSTIC_ATTRIBUTES,
diff --git a/compiler/rustc_passes/src/debugger_visualizer.rs b/compiler/rustc_passes/src/debugger_visualizer.rs
index 91e7c69..f5aa163 100644
--- a/compiler/rustc_passes/src/debugger_visualizer.rs
+++ b/compiler/rustc_passes/src/debugger_visualizer.rs
@@ -1,9 +1,8 @@
 //! Detecting usage of the `#[debugger_visualizer]` attribute.
 
 use rustc_ast::{ItemKind, ast};
+use rustc_attr_ir::{Attribute, AttributeKind, DebugVisualizer};
 use rustc_attr_parsing::AttributeParser;
-use rustc_hir::Attribute;
-use rustc_hir::attrs::{AttributeKind, DebugVisualizer};
 use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
 use rustc_middle::query::{LocalCrate, Providers};
 use rustc_middle::ty::TyCtxt;
diff --git a/compiler/rustc_passes/src/diagnostic_items.rs b/compiler/rustc_passes/src/diagnostic_items.rs
index 74cd942..1f17edb 100644
--- a/compiler/rustc_passes/src/diagnostic_items.rs
+++ b/compiler/rustc_passes/src/diagnostic_items.rs
@@ -9,8 +9,9 @@
 //!
 //! * Compiler internal types like `Ty` and `TyCtxt`
 
-use rustc_hir::attrs::diagnostic_items::DiagnosticItems;
-use rustc_hir::{CRATE_OWNER_ID, OwnerId, find_attr};
+use rustc_attr_ir::diagnostic_items::DiagnosticItems;
+use rustc_attr_ir::find_attr;
+use rustc_hir::{CRATE_OWNER_ID, OwnerId};
 use rustc_middle::query::{LocalCrate, Providers};
 use rustc_middle::ty::TyCtxt;
 use rustc_span::def_id::{DefId, LOCAL_CRATE};
diff --git a/compiler/rustc_passes/src/eii.rs b/compiler/rustc_passes/src/eii.rs
index 05cb10e..4daff23 100644
--- a/compiler/rustc_passes/src/eii.rs
+++ b/compiler/rustc_passes/src/eii.rs
@@ -3,8 +3,8 @@
 
 use std::iter;
 
+use rustc_attr_ir::{EiiDecl, EiiImpl};
 use rustc_data_structures::fx::FxIndexMap;
-use rustc_hir::attrs::{EiiDecl, EiiImpl};
 use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
 use rustc_middle::diagnostics::DuplicateEiiImpls;
 use rustc_middle::ty::TyCtxt;
diff --git a/compiler/rustc_passes/src/lang_items.rs b/compiler/rustc_passes/src/lang_items.rs
index 68be748..0306a0b 100644
--- a/compiler/rustc_passes/src/lang_items.rs
+++ b/compiler/rustc_passes/src/lang_items.rs
@@ -9,9 +9,9 @@
 
 use rustc_ast as ast;
 use rustc_ast::visit;
+use rustc_attr_ir::lang_items::{GenericRequirement, LangItem, LanguageItems};
+use rustc_attr_ir::target::Target;
 use rustc_crate_store::ExternCrate;
-use rustc_hir::Target;
-use rustc_hir::attrs::lang_items::{GenericRequirement, LangItem, LanguageItems};
 use rustc_hir::def_id::{DefId, LocalDefId};
 use rustc_middle::middle::resolve::ResolverAstLowering;
 use rustc_middle::query::Providers;
diff --git a/compiler/rustc_passes/src/layout_test.rs b/compiler/rustc_passes/src/layout_test.rs
index f73916d..961d39e 100644
--- a/compiler/rustc_passes/src/layout_test.rs
+++ b/compiler/rustc_passes/src/layout_test.rs
@@ -1,8 +1,7 @@
 use rustc_abi::{HasDataLayout, TargetDataLayout};
-use rustc_hir::attrs::RustcDumpLayoutKind;
+use rustc_attr_ir::{RustcDumpLayoutKind, find_attr};
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::LocalDefId;
-use rustc_hir::find_attr;
 use rustc_middle::ty::layout::{HasTyCtxt, HasTypingEnv, LayoutError, LayoutOfHelpers};
 use rustc_middle::ty::{self, Ty, TyCtxt, Unnormalized};
 use rustc_span::{Span, span_bug};
diff --git a/compiler/rustc_passes/src/lib_features.rs b/compiler/rustc_passes/src/lib_features.rs
index ceaad91..2420d55 100644
--- a/compiler/rustc_passes/src/lib_features.rs
+++ b/compiler/rustc_passes/src/lib_features.rs
@@ -4,9 +4,8 @@
 //! but are not declared in one single location (unlike lang features), which means we need to
 //! collect them instead.
 
-use rustc_hir::attrs::AttributeKind;
+use rustc_attr_ir::{Attribute, AttributeKind, StabilityLevel, StableSince};
 use rustc_hir::intravisit::Visitor;
-use rustc_hir::{Attribute, StabilityLevel, StableSince};
 use rustc_middle::hir::nested_filter;
 use rustc_middle::middle::lib_features::{FeatureStability, LibFeatures};
 use rustc_middle::query::{LocalCrate, Providers};
diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs
index b2535b4..1148aac 100644
--- a/compiler/rustc_passes/src/stability.rs
+++ b/compiler/rustc_passes/src/stability.rs
@@ -4,17 +4,19 @@
 use std::num::NonZero;
 
 use rustc_ast_lowering::stability::extern_abi_stability;
+use rustc_attr_ir::{
+    AttributeKind, ConstStability, DefaultBodyStability, DeprecatedSince, Stability,
+    StabilityLevel, StableSince, UnstableReason, VERSION_PLACEHOLDER, find_attr,
+};
 use rustc_data_structures::fx::FxIndexMap;
 use rustc_data_structures::unord::{ExtendUnord, UnordMap, UnordSet};
 use rustc_feature::{EnabledLangFeature, EnabledLibFeature, UNSTABLE_LANG_FEATURES};
-use rustc_hir::attrs::{AttributeKind, DeprecatedSince};
 use rustc_hir::def::{DefKind, Res};
 use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId, LocalModId};
 use rustc_hir::intravisit::{self, Visitor};
 use rustc_hir::{
-    self as hir, AmbigArg, ConstStability, Constness, DefaultBodyStability, FieldDef, HirId, Item,
-    ItemKind, Path, Stability, StabilityLevel, StableSince, TraitRef, Ty, TyKind, UnstableReason,
-    UsePath, VERSION_PLACEHOLDER, Variant, find_attr,
+    self as hir, AmbigArg, Constness, FieldDef, HirId, Item, ItemKind, Path, TraitRef, Ty, TyKind,
+    UsePath, Variant,
 };
 use rustc_lint_defs::builtin::{
     DEPRECATED, DUPLICATE_FEATURES, INEFFECTIVE_UNSTABLE_REEXPORTS,
diff --git a/compiler/rustc_passes/src/weak_lang_items.rs b/compiler/rustc_passes/src/weak_lang_items.rs
index e704276..42e07bc 100644
--- a/compiler/rustc_passes/src/weak_lang_items.rs
+++ b/compiler/rustc_passes/src/weak_lang_items.rs
@@ -1,8 +1,8 @@
 //! Validity checking for weak lang items
 
+use rustc_attr_ir::lang_items::{self, LangItem};
+use rustc_attr_ir::weak_lang_items::WEAK_LANG_ITEMS;
 use rustc_data_structures::fx::FxHashSet;
-use rustc_hir::attrs::lang_items::{self, LangItem};
-use rustc_hir::attrs::weak_lang_items::WEAK_LANG_ITEMS;
 use rustc_middle::middle::lang_items::required;
 use rustc_middle::ty::TyCtxt;
 use rustc_structures::CrateType;
diff --git a/compiler/rustc_resolve/Cargo.toml b/compiler/rustc_resolve/Cargo.toml
index 19a4ee5..a635f78 100644
--- a/compiler/rustc_resolve/Cargo.toml
+++ b/compiler/rustc_resolve/Cargo.toml
@@ -13,6 +13,7 @@
 rustc_arena = { path = "../rustc_arena" }
 rustc_ast = { path = "../rustc_ast" }
 rustc_ast_pretty = { path = "../rustc_ast_pretty" }
+rustc_attr_ir = { path = "../rustc_attr_ir" }
 rustc_attr_parsing = { path = "../rustc_attr_parsing" }
 rustc_data_structures = { path = "../rustc_data_structures" }
 rustc_errors = { path = "../rustc_errors" }
diff --git a/compiler/rustc_resolve/src/def_collector.rs b/compiler/rustc_resolve/src/def_collector.rs
index 89ea973..ee35d236 100644
--- a/compiler/rustc_resolve/src/def_collector.rs
+++ b/compiler/rustc_resolve/src/def_collector.rs
@@ -2,11 +2,10 @@
 
 use rustc_ast::visit::FnKind;
 use rustc_ast::*;
-use rustc_attr_parsing as attr;
+use rustc_attr_ir::target::Target;
 use rustc_attr_parsing::{AttributeParser, ShouldEmit};
 use rustc_expand::expand::AstFragment;
 use rustc_hir as hir;
-use rustc_hir::Target;
 use rustc_hir::def::DefKind;
 use rustc_hir::def::Namespace::{TypeNS, ValueNS};
 use rustc_hir::def_id::LocalDefId;
@@ -558,7 +557,7 @@ fn visit_attribute(&mut self, attr: &'a Attribute) {
         let orig_in_attr = mem::replace(&mut self.invocation_parent.in_attr, true);
         match &attr.kind {
             AttrKind::Normal(normal) => {
-                if attr::is_builtin_attr(&normal.item) {
+                if rustc_attr_parsing::is_builtin_attr(&normal.item) {
                     self.r
                         .builtin_attrs
                         .push((normal.item.path.segments[0].ident, self.parent_scope));
diff --git a/compiler/rustc_symbol_mangling/Cargo.toml b/compiler/rustc_symbol_mangling/Cargo.toml
index bb79bb3..1e07801 100644
--- a/compiler/rustc_symbol_mangling/Cargo.toml
+++ b/compiler/rustc_symbol_mangling/Cargo.toml
@@ -8,6 +8,7 @@
 punycode = "0.4.0"
 rustc-demangle = "0.1.28"
 rustc_abi = { path = "../rustc_abi" }
+rustc_attr_ir = { path = "../rustc_attr_ir" }
 rustc_data_structures = { path = "../rustc_data_structures" }
 rustc_hashes = { path = "../rustc_hashes" }
 rustc_hir = { path = "../rustc_hir" }
diff --git a/compiler/rustc_symbol_mangling/src/test.rs b/compiler/rustc_symbol_mangling/src/test.rs
index a4364cc..646a916 100644
--- a/compiler/rustc_symbol_mangling/src/test.rs
+++ b/compiler/rustc_symbol_mangling/src/test.rs
@@ -4,7 +4,8 @@
 //! def-path. This is used for unit testing the code that generates
 //! paths etc in all kinds of annoying scenarios.
 
-use rustc_hir::{CRATE_OWNER_ID, find_attr};
+use rustc_attr_ir::find_attr;
+use rustc_hir::CRATE_OWNER_ID;
 use rustc_middle::ty::print::with_no_trimmed_paths;
 use rustc_middle::ty::{GenericArgs, Instance, TyCtxt};
 
diff --git a/compiler/rustc_transmute/Cargo.toml b/compiler/rustc_transmute/Cargo.toml
index 5da9435..55e2f7e 100644
--- a/compiler/rustc_transmute/Cargo.toml
+++ b/compiler/rustc_transmute/Cargo.toml
@@ -6,8 +6,8 @@
 [dependencies]
 # tidy-alphabetical-start
 rustc_abi = { path = "../rustc_abi", optional = true }
+rustc_attr_ir = { path = "../rustc_attr_ir", optional = true }
 rustc_data_structures = { path = "../rustc_data_structures" }
-rustc_hir = { path = "../rustc_hir", optional = true }
 rustc_middle = { path = "../rustc_middle", optional = true }
 rustc_span = { path = "../rustc_span", optional = true }
 smallvec = "1.8.1"
@@ -23,7 +23,7 @@
 # tidy-alphabetical-start
 rustc = [
     "dep:rustc_abi",
-    "dep:rustc_hir",
+    "dep:rustc_attr_ir",
     "dep:rustc_middle",
     "dep:rustc_span",
 ]
diff --git a/compiler/rustc_transmute/src/lib.rs b/compiler/rustc_transmute/src/lib.rs
index 53287db..cb5a76b 100644
--- a/compiler/rustc_transmute/src/lib.rs
+++ b/compiler/rustc_transmute/src/lib.rs
@@ -103,7 +103,7 @@ pub enum Reason<T> {
 
 #[cfg(feature = "rustc")]
 mod rustc {
-    use rustc_hir::attrs::lang_items::LangItem;
+    use rustc_attr_ir::lang_items::LangItem;
     use rustc_middle::ty::consts::ConstExt;
     use rustc_middle::ty::{Const, Region, Ty, TyCtxt};
 
diff --git a/compiler/rustc_ty_utils/Cargo.toml b/compiler/rustc_ty_utils/Cargo.toml
index e6de7bd1..5ac4d72 100644
--- a/compiler/rustc_ty_utils/Cargo.toml
+++ b/compiler/rustc_ty_utils/Cargo.toml
@@ -7,6 +7,7 @@
 # tidy-alphabetical-start
 itertools = "0.15"
 rustc_abi = { path = "../rustc_abi" }
+rustc_attr_ir = { path = "../rustc_attr_ir" }
 rustc_data_structures = { path = "../rustc_data_structures" }
 rustc_errors = { path = "../rustc_errors" }
 rustc_hashes = { path = "../rustc_hashes" }
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs
index 55140d2..bcba583 100644
--- a/compiler/rustc_ty_utils/src/abi.rs
+++ b/compiler/rustc_ty_utils/src/abi.rs
@@ -2,7 +2,7 @@
 
 use rustc_abi::Primitive::Pointer;
 use rustc_abi::{Align, BackendRepr, ExternAbi, PointerKind, Scalar, Size};
-use rustc_hir::attrs::lang_items::LangItem;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_hir::{self as hir, find_attr};
 use rustc_middle::middle::deduced_param_attrs::DeducedParamAttrs;
 use rustc_middle::query::Providers;
diff --git a/compiler/rustc_ty_utils/src/common_traits.rs b/compiler/rustc_ty_utils/src/common_traits.rs
index 4d25a28..48e2a68 100644
--- a/compiler/rustc_ty_utils/src/common_traits.rs
+++ b/compiler/rustc_ty_utils/src/common_traits.rs
@@ -1,6 +1,6 @@
 //! Queries for checking whether a type implements one of a few common traits.
 
-use rustc_hir::attrs::lang_items::LangItem;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_infer::infer::TyCtxtInferExt;
 use rustc_middle::query::Providers;
 use rustc_middle::ty::{self, Ty, TyCtxt};
diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs
index f0f0a66..9a41caa 100644
--- a/compiler/rustc_ty_utils/src/instance.rs
+++ b/compiler/rustc_ty_utils/src/instance.rs
@@ -1,5 +1,5 @@
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_errors::ErrorGuaranteed;
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::DefId;
 use rustc_infer::infer::TyCtxtInferExt;
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs
index dee4b78..43af74d 100644
--- a/compiler/rustc_ty_utils/src/layout.rs
+++ b/compiler/rustc_ty_utils/src/layout.rs
@@ -9,9 +9,9 @@
     LayoutCalculatorError, LayoutData, Niche, ReprOptions, Scalar, Size, StructKind, TagEncoding,
     VariantIdx, Variants, WrappingRange,
 };
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_hashes::Hash64;
 use rustc_hir as hir;
-use rustc_hir::attrs::lang_items::LangItem;
 use rustc_hir::find_attr;
 use rustc_index::{Idx as _, IndexVec};
 use rustc_middle::query::Providers;
diff --git a/compiler/rustc_ty_utils/src/structural_match.rs b/compiler/rustc_ty_utils/src/structural_match.rs
index 85d13cfd..7dd596f 100644
--- a/compiler/rustc_ty_utils/src/structural_match.rs
+++ b/compiler/rustc_ty_utils/src/structural_match.rs
@@ -1,4 +1,4 @@
-use rustc_hir::attrs::lang_items::LangItem;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_infer::infer::TyCtxtInferExt;
 use rustc_middle::query::Providers;
 use rustc_middle::ty::{self, Ty, TyCtxt, TypingMode};
diff --git a/src/tools/clippy/clippy_lints/src/attrs/deprecated_semver.rs b/src/tools/clippy/clippy_lints/src/attrs/deprecated_semver.rs
index e3b1a05..ff929df 100644
--- a/src/tools/clippy/clippy_lints/src/attrs/deprecated_semver.rs
+++ b/src/tools/clippy/clippy_lints/src/attrs/deprecated_semver.rs
@@ -2,7 +2,7 @@
 use clippy_utils::diagnostics::span_lint;
 use clippy_utils::sym;
 use rustc_ast::{LitKind, MetaItemLit};
-use rustc_hir::VERSION_PLACEHOLDER;
+use rustc_attr_ir::VERSION_PLACEHOLDER;
 use rustc_lint::EarlyContext;
 use rustc_span::Span;
 use semver::Version;
diff --git a/src/tools/clippy/clippy_lints/src/missing_doc.rs b/src/tools/clippy/clippy_lints/src/missing_doc.rs
index af2c847..2ef893e 100644
--- a/src/tools/clippy/clippy_lints/src/missing_doc.rs
+++ b/src/tools/clippy/clippy_lints/src/missing_doc.rs
@@ -1,11 +1,9 @@
 use clippy_config::Conf;
 use clippy_utils::diagnostics::span_lint;
 use clippy_utils::{is_doc_hidden, is_from_proc_macro};
-use rustc_attr_ir::AttributeKind;
+use rustc_attr_ir::{AttrArgs, Attribute, AttributeKind};
 use rustc_hir::def_id::LocalDefId;
-use rustc_hir::{
-    AttrArgs, Attribute, Body, BodyId, FieldDef, HirId, ImplItem, Item, ItemKind, Node, TraitItem, Variant,
-};
+use rustc_hir::{Body, BodyId, FieldDef, HirId, ImplItem, Item, ItemKind, Node, TraitItem, Variant};
 use rustc_lint::{LateContext, LateLintPass, impl_lint_pass};
 use rustc_middle::middle::privacy::Level;
 use rustc_middle::ty::Visibility;
diff --git a/tests/ui-fulldeps/internal-lints/find_attr.rs b/tests/ui-fulldeps/internal-lints/find_attr.rs
index 90b9b96..f2ee921 100644
--- a/tests/ui-fulldeps/internal-lints/find_attr.rs
+++ b/tests/ui-fulldeps/internal-lints/find_attr.rs
@@ -4,9 +4,9 @@
 #![feature(rustc_private)]
 #![deny(rustc::bad_use_of_find_attr)]
 
-extern crate rustc_hir;
+extern crate rustc_attr_ir;
 
-use rustc_hir::{attrs::AttributeKind, find_attr};
+use rustc_attr_ir::{AttributeKind, find_attr};
 
 fn main() {
     let attrs = &[];
diff --git a/tests/ui-fulldeps/polymorphic-drop-glue.rs b/tests/ui-fulldeps/polymorphic-drop-glue.rs
index 861c7c7..4d85d34 100644
--- a/tests/ui-fulldeps/polymorphic-drop-glue.rs
+++ b/tests/ui-fulldeps/polymorphic-drop-glue.rs
@@ -6,6 +6,7 @@
 //@ ignore-backends: gcc
 #![feature(rustc_private)]
 
+extern crate rustc_attr_ir;
 extern crate rustc_driver;
 extern crate rustc_hir;
 extern crate rustc_interface;
@@ -16,7 +17,7 @@
 use std::process::ExitCode;
 
 use rustc_driver::Compilation;
-use rustc_hir::attrs::lang_items::LangItem;
+use rustc_attr_ir::lang_items::LangItem;
 use rustc_hir::def::DefKind;
 use rustc_interface::interface::Compiler;
 use rustc_middle::ty::{self, TyCtxt};