Skip to content

Commit 684b7b7

Browse files
committed
don't depend on rustc_attr_parsing if rustc_data_structures will do
1 parent dcecb99 commit 684b7b7

File tree

26 files changed

+61
-62
lines changed

26 files changed

+61
-62
lines changed

Cargo.lock

+8-8
Original file line numberDiff line numberDiff line change
@@ -3410,7 +3410,7 @@ dependencies = [
34103410
"rustc-demangle",
34113411
"rustc_abi",
34123412
"rustc_ast",
3413-
"rustc_attr_parsing",
3413+
"rustc_attr_data_structures",
34143414
"rustc_codegen_ssa",
34153415
"rustc_data_structures",
34163416
"rustc_errors",
@@ -3490,7 +3490,7 @@ dependencies = [
34903490
"rustc_abi",
34913491
"rustc_apfloat",
34923492
"rustc_ast",
3493-
"rustc_attr_parsing",
3493+
"rustc_attr_data_structures",
34943494
"rustc_data_structures",
34953495
"rustc_errors",
34963496
"rustc_fluent_macro",
@@ -3754,7 +3754,7 @@ dependencies = [
37543754
"rustc_abi",
37553755
"rustc_arena",
37563756
"rustc_ast",
3757-
"rustc_attr_parsing",
3757+
"rustc_attr_data_structures",
37583758
"rustc_data_structures",
37593759
"rustc_errors",
37603760
"rustc_feature",
@@ -3791,7 +3791,7 @@ dependencies = [
37913791
"itertools",
37923792
"rustc_abi",
37933793
"rustc_ast",
3794-
"rustc_attr_parsing",
3794+
"rustc_attr_data_structures",
37953795
"rustc_data_structures",
37963796
"rustc_errors",
37973797
"rustc_fluent_macro",
@@ -4122,7 +4122,7 @@ dependencies = [
41224122
"rustc_abi",
41234123
"rustc_arena",
41244124
"rustc_ast",
4125-
"rustc_attr_parsing",
4125+
"rustc_attr_data_structures",
41264126
"rustc_const_eval",
41274127
"rustc_data_structures",
41284128
"rustc_errors",
@@ -4148,7 +4148,7 @@ version = "0.0.0"
41484148
dependencies = [
41494149
"rustc_abi",
41504150
"rustc_ast",
4151-
"rustc_attr_parsing",
4151+
"rustc_attr_data_structures",
41524152
"rustc_data_structures",
41534153
"rustc_errors",
41544154
"rustc_fluent_macro",
@@ -4218,7 +4218,7 @@ dependencies = [
42184218
"rustc_ast",
42194219
"rustc_ast_lowering",
42204220
"rustc_ast_pretty",
4221-
"rustc_attr_parsing",
4221+
"rustc_attr_data_structures",
42224222
"rustc_data_structures",
42234223
"rustc_errors",
42244224
"rustc_expand",
@@ -4264,7 +4264,7 @@ name = "rustc_privacy"
42644264
version = "0.0.0"
42654265
dependencies = [
42664266
"rustc_ast",
4267-
"rustc_attr_parsing",
4267+
"rustc_attr_data_structures",
42684268
"rustc_data_structures",
42694269
"rustc_errors",
42704270
"rustc_fluent_macro",

compiler/rustc_codegen_llvm/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object = { version = "0.36.3", default-features = false, features = ["std", "rea
1919
rustc-demangle = "0.1.21"
2020
rustc_abi = { path = "../rustc_abi" }
2121
rustc_ast = { path = "../rustc_ast" }
22-
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
22+
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
2323
rustc_codegen_ssa = { path = "../rustc_codegen_ssa" }
2424
rustc_data_structures = { path = "../rustc_data_structures" }
2525
rustc_errors = { path = "../rustc_errors" }

compiler/rustc_codegen_llvm/src/attributes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//! Set and unset common attributes on LLVM values.
2-
use rustc_attr_parsing::{InlineAttr, InstructionSetAttr, OptimizeAttr};
2+
use rustc_attr_data_structures::{InlineAttr, InstructionSetAttr, OptimizeAttr};
33
use rustc_codegen_ssa::traits::*;
44
use rustc_hir::def_id::DefId;
55
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, PatchableFunctionEntry};

compiler/rustc_codegen_llvm/src/callee.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub(crate) fn get_fn<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'t
103103
// This is a monomorphization of a generic function.
104104
if !(cx.tcx.sess.opts.share_generics()
105105
|| tcx.codegen_fn_attrs(instance_def_id).inline
106-
== rustc_attr_parsing::InlineAttr::Never)
106+
== rustc_attr_data_structures::InlineAttr::Never)
107107
{
108108
// When not sharing generics, all instances are in the same
109109
// crate and have hidden visibility.

compiler/rustc_const_eval/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ either = "1"
99
rustc_abi = { path = "../rustc_abi" }
1010
rustc_apfloat = "0.2.0"
1111
rustc_ast = { path = "../rustc_ast" }
12-
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
12+
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
1313
rustc_data_structures = { path = "../rustc_data_structures" }
1414
rustc_errors = { path = "../rustc_errors" }
1515
rustc_fluent_macro = { path = "../rustc_fluent_macro" }

compiler/rustc_const_eval/src/check_consts/check.rs

+10-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::mem;
66
use std::num::NonZero;
77
use std::ops::Deref;
88

9-
use rustc_attr_parsing::{ConstStability, StabilityLevel};
9+
use rustc_attr_data_structures as attrs;
1010
use rustc_errors::{Diag, ErrorGuaranteed};
1111
use rustc_hir::def::DefKind;
1212
use rustc_hir::def_id::DefId;
@@ -475,7 +475,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
475475
/// Check the const stability of the given item (fn or trait).
476476
fn check_callee_stability(&mut self, def_id: DefId) {
477477
match self.tcx.lookup_const_stability(def_id) {
478-
Some(ConstStability { level: StabilityLevel::Stable { .. }, .. }) => {
478+
Some(attrs::ConstStability { level: attrs::StabilityLevel::Stable { .. }, .. }) => {
479479
// All good.
480480
}
481481
None => {
@@ -491,8 +491,8 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
491491
});
492492
}
493493
}
494-
Some(ConstStability {
495-
level: StabilityLevel::Unstable { implied_by: implied_feature, issue, .. },
494+
Some(attrs::ConstStability {
495+
level: attrs::StabilityLevel::Unstable { implied_by: implied_feature, issue, .. },
496496
feature,
497497
..
498498
}) => {
@@ -918,8 +918,8 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
918918
});
919919
}
920920
}
921-
Some(ConstStability {
922-
level: StabilityLevel::Unstable { .. },
921+
Some(attrs::ConstStability {
922+
level: attrs::StabilityLevel::Unstable { .. },
923923
feature,
924924
..
925925
}) => {
@@ -930,7 +930,10 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
930930
suggestion: self.crate_inject_span(),
931931
});
932932
}
933-
Some(ConstStability { level: StabilityLevel::Stable { .. }, .. }) => {
933+
Some(attrs::ConstStability {
934+
level: attrs::StabilityLevel::Stable { .. },
935+
..
936+
}) => {
934937
// All good. Note that a `#[rustc_const_stable]` intrinsic (meaning it
935938
// can be *directly* invoked from stable const code) does not always
936939
// have the `#[rustc_intrinsic_const_stable_indirect]` attribute (which controls

compiler/rustc_const_eval/src/check_consts/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
//! has interior mutability or needs to be dropped, as well as the visitor that emits errors when
55
//! it finds operations that are invalid in a certain context.
66
7-
use rustc_attr_parsing::{AttributeKind, find_attr};
87
use rustc_errors::DiagCtxtHandle;
9-
use rustc_hir as hir;
108
use rustc_hir::def_id::{DefId, LocalDefId};
119
use rustc_middle::ty::{self, PolyFnSig, TyCtxt};
1210
use rustc_middle::{bug, mir};
1311
use rustc_span::Symbol;
12+
use {rustc_attr_data_structures as attrs, rustc_hir as hir};
1413

1514
pub use self::qualifs::Qualif;
1615

@@ -83,7 +82,7 @@ pub fn rustc_allow_const_fn_unstable(
8382
) -> bool {
8483
let attrs = tcx.hir_attrs(tcx.local_def_id_to_hir_id(def_id));
8584

86-
find_attr!(attrs, AttributeKind::AllowConstFnUnstable(syms) if syms.contains(&feature_gate))
85+
attrs::find_attr!(attrs, attrs::AttributeKind::AllowConstFnUnstable(syms) if syms.contains(&feature_gate))
8786
}
8887

8988
/// Returns `true` if the given `def_id` (trait or function) is "safe to expose on stable".

compiler/rustc_hir_analysis/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ itertools = "0.12"
1313
rustc_abi = { path = "../rustc_abi" }
1414
rustc_arena = { path = "../rustc_arena" }
1515
rustc_ast = { path = "../rustc_ast" }
16-
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
16+
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
1717
rustc_data_structures = { path = "../rustc_data_structures" }
1818
rustc_errors = { path = "../rustc_errors" }
1919
rustc_feature = { path = "../rustc_feature" }

compiler/rustc_hir_analysis/src/check/check.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ use std::cell::LazyCell;
22
use std::ops::ControlFlow;
33

44
use rustc_abi::FieldIdx;
5-
use rustc_attr_parsing::AttributeKind;
6-
use rustc_attr_parsing::ReprAttr::ReprPacked;
5+
use rustc_attr_data_structures::ReprAttr::ReprPacked;
76
use rustc_data_structures::unord::{UnordMap, UnordSet};
87
use rustc_errors::MultiSpan;
98
use rustc_errors::codes::*;
@@ -31,7 +30,7 @@ use rustc_trait_selection::traits;
3130
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
3231
use tracing::{debug, instrument};
3332
use ty::TypingMode;
34-
use {rustc_attr_parsing as attr, rustc_hir as hir};
33+
use {rustc_attr_data_structures as attrs, rustc_hir as hir};
3534

3635
use super::compare_impl_item::check_type_bounds;
3736
use super::*;
@@ -1154,7 +1153,7 @@ pub(super) fn check_packed(tcx: TyCtxt<'_>, sp: Span, def: ty::AdtDef<'_>) {
11541153
let repr = def.repr();
11551154
if repr.packed() {
11561155
if let Some(reprs) =
1157-
attr::find_attr!(tcx.get_all_attrs(def.did()), AttributeKind::Repr(r) => r)
1156+
attrs::find_attr!(tcx.get_all_attrs(def.did()), attrs::AttributeKind::Repr(r) => r)
11581157
{
11591158
for (r, _) in reprs {
11601159
if let ReprPacked(pack) = r
@@ -1371,9 +1370,9 @@ fn check_enum(tcx: TyCtxt<'_>, def_id: LocalDefId) {
13711370
def.destructor(tcx); // force the destructor to be evaluated
13721371

13731372
if def.variants().is_empty() {
1374-
attr::find_attr!(
1373+
attrs::find_attr!(
13751374
tcx.get_all_attrs(def_id),
1376-
AttributeKind::Repr(rs) => {
1375+
attrs::AttributeKind::Repr(rs) => {
13771376
struct_span_code_err!(
13781377
tcx.dcx(),
13791378
rs.first().unwrap().1,

compiler/rustc_hir_typeck/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ edition = "2024"
88
itertools = "0.12"
99
rustc_abi = { path = "../rustc_abi" }
1010
rustc_ast = { path = "../rustc_ast" }
11-
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
11+
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
1212
rustc_data_structures = { path = "../rustc_data_structures" }
1313
rustc_errors = { path = "../rustc_errors" }
1414
rustc_fluent_macro = { path = "../rustc_fluent_macro" }

compiler/rustc_hir_typeck/src/coercion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
3838
use std::ops::Deref;
3939

40-
use rustc_attr_parsing::InlineAttr;
40+
use rustc_attr_data_structures::InlineAttr;
4141
use rustc_errors::codes::*;
4242
use rustc_errors::{Applicability, Diag, struct_span_code_err};
4343
use rustc_hir as hir;

compiler/rustc_hir_typeck/src/method/suggest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::path::PathBuf;
99

1010
use hir::Expr;
1111
use rustc_ast::ast::Mutability;
12-
use rustc_attr_parsing::{AttributeKind, find_attr};
12+
use rustc_attr_data_structures::{AttributeKind, find_attr};
1313
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
1414
use rustc_data_structures::sorted_map::SortedMap;
1515
use rustc_data_structures::unord::UnordSet;

compiler/rustc_mir_transform/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ itertools = "0.12"
1010
rustc_abi = { path = "../rustc_abi" }
1111
rustc_arena = { path = "../rustc_arena" }
1212
rustc_ast = { path = "../rustc_ast" }
13-
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
13+
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
1414
rustc_const_eval = { path = "../rustc_const_eval" }
1515
rustc_data_structures = { path = "../rustc_data_structures" }
1616
rustc_errors = { path = "../rustc_errors" }

compiler/rustc_mir_transform/src/check_inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Check that a body annotated with `#[rustc_force_inline]` will not fail to inline based on its
22
//! definition alone (irrespective of any specific caller).
33
4-
use rustc_attr_parsing::InlineAttr;
4+
use rustc_attr_data_structures::InlineAttr;
55
use rustc_hir::def_id::DefId;
66
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
77
use rustc_middle::mir::{Body, TerminatorKind};

compiler/rustc_mir_transform/src/cross_crate_inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_attr_parsing::InlineAttr;
1+
use rustc_attr_data_structures::InlineAttr;
22
use rustc_hir::def::DefKind;
33
use rustc_hir::def_id::LocalDefId;
44
use rustc_middle::mir::visit::Visitor;

compiler/rustc_mir_transform/src/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::iter;
55
use std::ops::{Range, RangeFrom};
66

77
use rustc_abi::{ExternAbi, FieldIdx};
8-
use rustc_attr_parsing::{InlineAttr, OptimizeAttr};
8+
use rustc_attr_data_structures::{InlineAttr, OptimizeAttr};
99
use rustc_hir::def::DefKind;
1010
use rustc_hir::def_id::DefId;
1111
use rustc_index::Idx;

compiler/rustc_mir_transform/src/validate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Validates the MIR to ensure that invariants are upheld.
22
33
use rustc_abi::{ExternAbi, FIRST_VARIANT, Size};
4-
use rustc_attr_parsing::InlineAttr;
4+
use rustc_attr_data_structures::InlineAttr;
55
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
66
use rustc_hir::LangItem;
77
use rustc_index::IndexVec;

compiler/rustc_monomorphize/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ edition = "2024"
77
# tidy-alphabetical-start
88
rustc_abi = { path = "../rustc_abi" }
99
rustc_ast = { path = "../rustc_ast" }
10-
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
10+
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
1111
rustc_data_structures = { path = "../rustc_data_structures" }
1212
rustc_errors = { path = "../rustc_errors" }
1313
rustc_fluent_macro = { path = "../rustc_fluent_macro" }

compiler/rustc_monomorphize/src/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
use std::cell::OnceCell;
209209
use std::path::PathBuf;
210210

211-
use rustc_attr_parsing::InlineAttr;
211+
use rustc_attr_data_structures::InlineAttr;
212212
use rustc_data_structures::fx::FxIndexMap;
213213
use rustc_data_structures::sync::{MTLock, par_for_each_in};
214214
use rustc_data_structures::unord::{UnordMap, UnordSet};

compiler/rustc_monomorphize/src/partitioning.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ use std::fs::{self, File};
100100
use std::io::Write;
101101
use std::path::{Path, PathBuf};
102102

103+
use rustc_attr_data_structures::InlineAttr;
103104
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
104105
use rustc_data_structures::sync;
105106
use rustc_data_structures::unord::{UnordMap, UnordSet};
@@ -845,8 +846,7 @@ fn mono_item_visibility<'tcx>(
845846
return if is_generic
846847
&& (always_export_generics
847848
|| (can_export_generics
848-
&& tcx.codegen_fn_attrs(def_id).inline
849-
== rustc_attr_parsing::InlineAttr::Never))
849+
&& tcx.codegen_fn_attrs(def_id).inline == InlineAttr::Never))
850850
{
851851
// If it is an upstream monomorphization and we export generics, we must make
852852
// it available to downstream crates.
@@ -859,8 +859,7 @@ fn mono_item_visibility<'tcx>(
859859

860860
if is_generic {
861861
if always_export_generics
862-
|| (can_export_generics
863-
&& tcx.codegen_fn_attrs(def_id).inline == rustc_attr_parsing::InlineAttr::Never)
862+
|| (can_export_generics && tcx.codegen_fn_attrs(def_id).inline == InlineAttr::Never)
864863
{
865864
if tcx.is_unreachable_local_definition(def_id) {
866865
// This instance cannot be used from another crate.

compiler/rustc_passes/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ rustc_abi = { path = "../rustc_abi" }
99
rustc_ast = { path = "../rustc_ast" }
1010
rustc_ast_lowering = { path = "../rustc_ast_lowering" }
1111
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
12-
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
12+
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
1313
rustc_data_structures = { path = "../rustc_data_structures" }
1414
rustc_errors = { path = "../rustc_errors" }
1515
rustc_expand = { path = "../rustc_expand" }

compiler/rustc_passes/src/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::collections::hash_map::Entry;
1010

1111
use rustc_abi::{Align, ExternAbi, Size};
1212
use rustc_ast::{AttrStyle, LitKind, MetaItemInner, MetaItemKind, MetaItemLit, ast};
13-
use rustc_attr_parsing::{AttributeKind, ReprAttr, find_attr};
13+
use rustc_attr_data_structures::{AttributeKind, ReprAttr, find_attr};
1414
use rustc_data_structures::fx::FxHashMap;
1515
use rustc_errors::{Applicability, DiagCtxtHandle, IntoDiagArg, MultiSpan, StashKey};
1616
use rustc_feature::{AttributeDuplicates, AttributeType, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute};

compiler/rustc_passes/src/lib_features.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! but are not declared in one single location (unlike lang features), which means we need to
55
//! collect them instead.
66
7-
use rustc_attr_parsing::{AttributeKind, StabilityLevel, StableSince};
7+
use rustc_attr_data_structures::{AttributeKind, StabilityLevel, StableSince};
88
use rustc_hir::Attribute;
99
use rustc_hir::intravisit::Visitor;
1010
use rustc_middle::hir::nested_filter;

0 commit comments

Comments
 (0)