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.
This commit is contained in:
Roland Xu
2026-09-23 09:55:44 +08:00
committed by GitHub
66 changed files with 200 additions and 177 deletions

View File

@@ -4168,6 +4168,7 @@ dependencies = [
"rustc_abi",
"rustc_ast",
"rustc_ast_pretty",
"rustc_attr_ir",
"rustc_hir",
"rustc_span",
]
@@ -4732,6 +4733,7 @@ dependencies = [
"rustc_arena",
"rustc_ast",
"rustc_ast_pretty",
"rustc_attr_ir",
"rustc_attr_parsing",
"rustc_data_structures",
"rustc_errors",
@@ -4848,6 +4850,7 @@ dependencies = [
"punycode",
"rustc-demangle",
"rustc_abi",
"rustc_attr_ir",
"rustc_data_structures",
"rustc_hashes",
"rustc_hir",
@@ -4947,8 +4950,8 @@ version = "0.0.0"
dependencies = [
"itertools",
"rustc_abi",
"rustc_attr_ir",
"rustc_data_structures",
"rustc_hir",
"rustc_middle",
"rustc_span",
"smallvec",
@@ -4961,6 +4964,7 @@ version = "0.0.0"
dependencies = [
"itertools",
"rustc_abi",
"rustc_attr_ir",
"rustc_data_structures",
"rustc_errors",
"rustc_hashes",

View File

@@ -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;

View File

@@ -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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
));
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)))

View File

@@ -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::LoweringContext;
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
&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| {

View File

@@ -45,7 +45,7 @@ use hir::def::Res;
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;

View File

@@ -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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
// 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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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);

View File

@@ -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};

View File

@@ -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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
)
};
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
&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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
&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 @@ impl<'hir> LoweringContext<'_, 'hir> {
/// 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,

View File

@@ -45,6 +45,9 @@ use rustc_ast::mut_visit::{self, MutVisitor};
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::tagged_ptr::TaggedRef;
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, 'hir> {
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 @@ impl<'hir> LoweringContext<'_, '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>,

View File

@@ -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::{

View File

@@ -24,20 +24,18 @@ pub mod pat_util;
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;

View File

@@ -8,6 +8,7 @@ edition = "2024"
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

View File

@@ -16,8 +16,8 @@ use rustc_ast_pretty::pp::Breaks::{Consistent, Inconsistent};
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 @@ impl PpAnn for &dyn rustc_hir::intravisit::HirTyCtxt<'_> {
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 @@ impl<'a> State<'a> {
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 @@ impl<'a> State<'a> {
/// 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 @@ impl<'a> State<'a> {
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 @@ impl<'a> State<'a> {
}
}
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 @@ impl<'a> State<'a> {
};
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 @@ where
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))
}

View File

@@ -107,9 +107,9 @@ rustc_arena::declare_arena! {
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 @@ rustc_arena::declare_arena! {
>,
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 @@ impl_ref_decodable_into_arena! {
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>,

View File

@@ -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;

View File

@@ -6,12 +6,13 @@ pub mod map;
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;

View File

@@ -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.

View File

@@ -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;

View File

@@ -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,

View File

@@ -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};

View File

@@ -2,6 +2,7 @@ use std::borrow::Cow;
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::stable_hash::{
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;

View File

@@ -53,6 +53,7 @@ use rustc_arena::TypedArena;
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 @@ rustc_queries! {
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 @@ rustc_queries! {
}
/// 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 @@ rustc_queries! {
}
/// 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

View File

@@ -185,11 +185,11 @@ impl_erasable_for_types_with_no_type_params! {
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>,

View File

@@ -15,10 +15,10 @@ use std::sync::Arc;
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};

View File

@@ -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;

View File

@@ -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;

View File

@@ -4,6 +4,8 @@ use std::ops::Range;
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 @@ use rustc_data_structures::stable_hash::{
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;

View File

@@ -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};

View File

@@ -17,6 +17,8 @@ use std::{debug_assert_matches, fmt, iter, mem};
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 @@ use rustc_data_structures::sync::{
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 @@ impl<'tcx> TyCtxt<'tcx> {
}
/// 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(())
}

View File

@@ -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};

View File

@@ -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};

View File

@@ -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 @@ impl<'tcx> Instance<'tcx> {
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;
}

View File

@@ -6,9 +6,9 @@ use rustc_abi::{
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;

View File

@@ -1870,7 +1870,7 @@ impl<'tcx> TyCtxt<'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 @@ impl<'tcx> TyCtxt<'tcx> {
///
/// </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() {

View File

@@ -6,11 +6,11 @@ use std::ops::{Deref, DerefMut};
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};

View File

@@ -217,11 +217,11 @@ TrivialTypeTraversalImpls! {
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,

View File

@@ -8,9 +8,9 @@ use std::ops::{ControlFlow, Range};
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};

View File

@@ -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;

View File

@@ -4,13 +4,14 @@ use std::{fmt, iter};
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};

View File

@@ -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};

View File

@@ -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};

View File

@@ -10,23 +10,23 @@ use std::slice;
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,

View File

@@ -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;

View File

@@ -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};

View File

@@ -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;

View File

@@ -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;

View File

@@ -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};

View File

@@ -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};

View File

@@ -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,

View File

@@ -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;

View File

@@ -13,6 +13,7 @@ pulldown-cmark = { version = "0.11", features = [
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" }

View File

@@ -2,11 +2,10 @@ use std::mem;
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 @@ impl<'a, 'ra, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'ra, 'tcx> {
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));

View File

@@ -8,6 +8,7 @@ edition = "2024"
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" }

View File

@@ -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};

View File

@@ -6,8 +6,8 @@ edition = "2024"
[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 @@ itertools = "0.15"
# tidy-alphabetical-start
rustc = [
"dep:rustc_abi",
"dep:rustc_hir",
"dep:rustc_attr_ir",
"dep:rustc_middle",
"dep:rustc_span",
]

View File

@@ -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};

View File

@@ -7,6 +7,7 @@ edition = "2024"
# 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" }

View File

@@ -2,7 +2,7 @@ use std::{assert_matches, iter};
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;

View File

@@ -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};

View File

@@ -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;

View File

@@ -9,9 +9,9 @@ use rustc_abi::{
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;

View File

@@ -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};

View File

@@ -2,7 +2,7 @@ use super::DEPRECATED_SEMVER;
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;

View File

@@ -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;

View File

@@ -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 = &[];

View File

@@ -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 @@ extern crate rustc_span;
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};