Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 599b08a

Browse files
authored
Rollup merge of rust-lang#140874 - mejrs:rads, r=WaffleLapkin
make `rustc_attr_parsing` less dominant in the rustc crate graph It has/had a glob re-export of `rustc_attr_data_structures`, which is a crate much lower in the graph, and a lot of crates were using it *just* (or *mostly*) for that re-export, while they can rely on `rustc_attr_data_structures` directly. Previous graph: ![graph_1](https://github.com/user-attachments/assets/f4a5f13c-4222-4903-b56d-28c83511fcbd) Graph with this PR: ![graph_2](https://github.com/user-attachments/assets/1e053d9c-75cc-402b-84df-86229c98277a) The first commit keeps the re-export, and just changes the dependency if possible. The second commit is the "breaking change" which removes the re-export, and "explicitly" adds the `rustc_attr_data_structures` dependency where needed. It also switches over some src/tools/*. The second commit is actually a lot more involved than I expected. Please let me know if it's a better idea to back it out and just keep the first commit.
2 parents 0513e3b + 178e09e commit 599b08a

File tree

72 files changed

+142
-125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+142
-125
lines changed

Cargo.lock

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3390,6 +3390,7 @@ version = "0.0.0"
33903390
dependencies = [
33913391
"rustc_ast",
33923392
"rustc_ast_pretty",
3393+
"rustc_attr_data_structures",
33933394
"rustc_attr_parsing",
33943395
"rustc_data_structures",
33953396
"rustc_errors",
@@ -3424,7 +3425,7 @@ dependencies = [
34243425
"rustc-demangle",
34253426
"rustc_abi",
34263427
"rustc_ast",
3427-
"rustc_attr_parsing",
3428+
"rustc_attr_data_structures",
34283429
"rustc_codegen_ssa",
34293430
"rustc_data_structures",
34303431
"rustc_errors",
@@ -3467,6 +3468,7 @@ dependencies = [
34673468
"rustc_abi",
34683469
"rustc_arena",
34693470
"rustc_ast",
3471+
"rustc_attr_data_structures",
34703472
"rustc_attr_parsing",
34713473
"rustc_data_structures",
34723474
"rustc_errors",
@@ -3504,7 +3506,7 @@ dependencies = [
35043506
"rustc_abi",
35053507
"rustc_apfloat",
35063508
"rustc_ast",
3507-
"rustc_attr_parsing",
3509+
"rustc_attr_data_structures",
35083510
"rustc_data_structures",
35093511
"rustc_errors",
35103512
"rustc_fluent_macro",
@@ -3680,6 +3682,7 @@ dependencies = [
36803682
"rustc_ast",
36813683
"rustc_ast_passes",
36823684
"rustc_ast_pretty",
3685+
"rustc_attr_data_structures",
36833686
"rustc_attr_parsing",
36843687
"rustc_data_structures",
36853688
"rustc_errors",
@@ -3768,7 +3771,7 @@ dependencies = [
37683771
"rustc_abi",
37693772
"rustc_arena",
37703773
"rustc_ast",
3771-
"rustc_attr_parsing",
3774+
"rustc_attr_data_structures",
37723775
"rustc_data_structures",
37733776
"rustc_errors",
37743777
"rustc_feature",
@@ -3805,7 +3808,7 @@ dependencies = [
38053808
"itertools",
38063809
"rustc_abi",
38073810
"rustc_ast",
3808-
"rustc_attr_parsing",
3811+
"rustc_attr_data_structures",
38093812
"rustc_data_structures",
38103813
"rustc_errors",
38113814
"rustc_fluent_macro",
@@ -3950,6 +3953,7 @@ dependencies = [
39503953
"rustc_abi",
39513954
"rustc_ast",
39523955
"rustc_ast_pretty",
3956+
"rustc_attr_data_structures",
39533957
"rustc_attr_parsing",
39543958
"rustc_data_structures",
39553959
"rustc_errors",
@@ -4023,6 +4027,7 @@ dependencies = [
40234027
"odht",
40244028
"rustc_abi",
40254029
"rustc_ast",
4030+
"rustc_attr_data_structures",
40264031
"rustc_attr_parsing",
40274032
"rustc_data_structures",
40284033
"rustc_errors",
@@ -4136,7 +4141,7 @@ dependencies = [
41364141
"rustc_abi",
41374142
"rustc_arena",
41384143
"rustc_ast",
4139-
"rustc_attr_parsing",
4144+
"rustc_attr_data_structures",
41404145
"rustc_const_eval",
41414146
"rustc_data_structures",
41424147
"rustc_errors",
@@ -4162,7 +4167,7 @@ version = "0.0.0"
41624167
dependencies = [
41634168
"rustc_abi",
41644169
"rustc_ast",
4165-
"rustc_attr_parsing",
4170+
"rustc_attr_data_structures",
41664171
"rustc_data_structures",
41674172
"rustc_errors",
41684173
"rustc_fluent_macro",
@@ -4232,7 +4237,7 @@ dependencies = [
42324237
"rustc_ast",
42334238
"rustc_ast_lowering",
42344239
"rustc_ast_pretty",
4235-
"rustc_attr_parsing",
4240+
"rustc_attr_data_structures",
42364241
"rustc_data_structures",
42374242
"rustc_errors",
42384243
"rustc_expand",
@@ -4278,7 +4283,7 @@ name = "rustc_privacy"
42784283
version = "0.0.0"
42794284
dependencies = [
42804285
"rustc_ast",
4281-
"rustc_attr_parsing",
4286+
"rustc_attr_data_structures",
42824287
"rustc_data_structures",
42834288
"rustc_errors",
42844289
"rustc_fluent_macro",

compiler/rustc_attr_parsing/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
//! `#[stable(...)]` and `#[unstable()]` cannot occur together, and both semantically define
6161
//! a "stability" of an item. So, the stability attribute has an
6262
//! [`AttributeParser`](attributes::AttributeParser) that recognizes both the `#[stable()]`
63-
//! and `#[unstable()]` syntactic attributes, and at the end produce a single [`AttributeKind::Stability`].
63+
//! and `#[unstable()]` syntactic attributes, and at the end produce a single
64+
//! [`AttributeKind::Stability`](rustc_attr_data_structures::AttributeKind::Stability).
6465
//!
6566
//! As a rule of thumb, when a syntactical attribute can be applied more than once, they should be
6667
//! combined into a single semantic attribute. For example:
@@ -91,6 +92,5 @@ mod session_diagnostics;
9192
pub use attributes::cfg::*;
9293
pub use attributes::util::{find_crate_name, is_builtin_attr, parse_version};
9394
pub use context::{AttributeParser, OmitDoc};
94-
pub use rustc_attr_data_structures::*;
9595

9696
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }

compiler/rustc_builtin_macros/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ doctest = false
1010
# tidy-alphabetical-start
1111
rustc_ast = { path = "../rustc_ast" }
1212
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
13+
rustc_attr_data_structures = { path = "../rustc_attr_data_structures" }
1314
rustc_attr_parsing = { path = "../rustc_attr_parsing" }
1415
rustc_data_structures = { path = "../rustc_data_structures" }
1516
rustc_errors = { path = "../rustc_errors" }

compiler/rustc_builtin_macros/src/deriving/generic/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ use rustc_ast::{
185185
self as ast, AnonConst, BindingMode, ByRef, EnumDef, Expr, GenericArg, GenericParamKind,
186186
Generics, Mutability, PatKind, VariantData,
187187
};
188-
use rustc_attr_parsing::{AttributeKind, AttributeParser, ReprPacked};
188+
use rustc_attr_data_structures::{AttributeKind, ReprPacked};
189+
use rustc_attr_parsing::AttributeParser;
189190
use rustc_expand::base::{Annotatable, ExtCtxt};
190191
use rustc_hir::Attribute;
191192
use rustc_span::{DUMMY_SP, Ident, Span, Symbol, kw, sym};

compiler/rustc_codegen_gcc/src/attributes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
use gccjit::FnAttribute;
33
use gccjit::Function;
44
#[cfg(feature = "master")]
5-
use rustc_attr_parsing::InlineAttr;
6-
use rustc_attr_parsing::InstructionSetAttr;
5+
use rustc_attr_data_structures::InlineAttr;
6+
use rustc_attr_data_structures::InstructionSetAttr;
77
#[cfg(feature = "master")]
88
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
99
#[cfg(feature = "master")]

compiler/rustc_codegen_gcc/src/callee.rs

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

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern crate tracing;
3737
extern crate rustc_abi;
3838
extern crate rustc_apfloat;
3939
extern crate rustc_ast;
40-
extern crate rustc_attr_parsing;
40+
extern crate rustc_attr_data_structures;
4141
extern crate rustc_codegen_ssa;
4242
extern crate rustc_data_structures;
4343
extern crate rustc_errors;

compiler/rustc_codegen_llvm/Cargo.toml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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.

0 commit comments

Comments
 (0)