Skip to content

Commit 5a9e0e8

Browse files
committed
Auto merge of rust-lang#118125 - nnethercote:custom_encodable, r=compiler-errors
Make some `newtype_index!` derived impls opt-in instead of opt-out Opt-in is the standard Rust way of doing things, and avoids some unnecessary dependencies on the `rustc_serialize` crate. r? `@lcnr`
2 parents 855c683 + 0991374 commit 5a9e0e8

File tree

43 files changed

+83
-34
lines changed

Some content is hidden

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

43 files changed

+83
-34
lines changed

Cargo.lock

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3524,7 +3524,6 @@ dependencies = [
35243524
"rustc_macros",
35253525
"rustc_middle",
35263526
"rustc_mir_dataflow",
3527-
"rustc_serialize",
35283527
"rustc_session",
35293528
"rustc_span",
35303529
"rustc_target",
@@ -3935,7 +3934,6 @@ dependencies = [
39353934
"rustc_lint",
39363935
"rustc_macros",
39373936
"rustc_middle",
3938-
"rustc_serialize",
39393937
"rustc_session",
39403938
"rustc_span",
39413939
"rustc_target",
@@ -3998,7 +3996,6 @@ dependencies = [
39983996
"rustc_index",
39993997
"rustc_macros",
40003998
"rustc_middle",
4001-
"rustc_serialize",
40023999
"rustc_span",
40034000
"rustc_target",
40044001
"smallvec",
@@ -4216,7 +4213,6 @@ dependencies = [
42164213
"rustc_infer",
42174214
"rustc_macros",
42184215
"rustc_middle",
4219-
"rustc_serialize",
42204216
"rustc_session",
42214217
"rustc_span",
42224218
"rustc_target",
@@ -4240,7 +4236,6 @@ dependencies = [
42404236
"rustc_index",
42414237
"rustc_macros",
42424238
"rustc_middle",
4243-
"rustc_serialize",
42444239
"rustc_span",
42454240
"rustc_target",
42464241
"smallvec",
@@ -4267,7 +4262,6 @@ dependencies = [
42674262
"rustc_middle",
42684263
"rustc_mir_build",
42694264
"rustc_mir_dataflow",
4270-
"rustc_serialize",
42714265
"rustc_session",
42724266
"rustc_span",
42734267
"rustc_target",
@@ -4341,7 +4335,6 @@ dependencies = [
43414335
"rustc_lexer",
43424336
"rustc_macros",
43434337
"rustc_middle",
4344-
"rustc_serialize",
43454338
"rustc_session",
43464339
"rustc_span",
43474340
"rustc_target",
@@ -4565,7 +4558,6 @@ dependencies = [
45654558
"rustc_middle",
45664559
"rustc_parse_format",
45674560
"rustc_query_system",
4568-
"rustc_serialize",
45694561
"rustc_session",
45704562
"rustc_span",
45714563
"rustc_target",

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2574,7 +2574,7 @@ pub enum AttrStyle {
25742574
}
25752575

25762576
rustc_index::newtype_index! {
2577-
#[custom_encodable]
2577+
#[orderable]
25782578
#[debug_format = "AttrId({})"]
25792579
pub struct AttrId {}
25802580
}

compiler/rustc_ast/src/node_id.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ rustc_index::newtype_index! {
88
/// This is later turned into [`DefId`] and `HirId` for the HIR.
99
///
1010
/// [`DefId`]: rustc_span::def_id::DefId
11+
#[encodable]
12+
#[orderable]
1113
#[debug_format = "NodeId({})"]
1214
pub struct NodeId {
1315
/// The [`NodeId`] used to represent the root of the crate.

compiler/rustc_borrowck/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ rustc_lexer = { path = "../rustc_lexer" }
1919
rustc_macros = { path = "../rustc_macros" }
2020
rustc_middle = { path = "../rustc_middle" }
2121
rustc_mir_dataflow = { path = "../rustc_mir_dataflow" }
22-
rustc_serialize = { path = "../rustc_serialize" }
2322
rustc_session = { path = "../rustc_session" }
2423
rustc_span = { path = "../rustc_span" }
2524
rustc_target = { path = "../rustc_target" }

compiler/rustc_borrowck/src/constraints/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ rustc_index::newtype_index! {
122122
}
123123

124124
rustc_index::newtype_index! {
125+
#[orderable]
125126
#[debug_format = "ConstraintSccIndex({})"]
126127
pub struct ConstraintSccIndex {}
127128
}

compiler/rustc_borrowck/src/dataflow.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ impl_visitable! {
109109
}
110110

111111
rustc_index::newtype_index! {
112+
#[orderable]
112113
#[debug_format = "bw{}"]
113114
pub struct BorrowIndex {}
114115
}

compiler/rustc_borrowck/src/location.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub struct LocationTable {
2020
}
2121

2222
rustc_index::newtype_index! {
23+
#[orderable]
2324
#[debug_format = "LocationIndex({})"]
2425
pub struct LocationIndex {}
2526
}

compiler/rustc_borrowck/src/region_infer/values.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ impl RegionValueElements {
9090
rustc_index::newtype_index! {
9191
/// A single integer representing a `Location` in the MIR control-flow
9292
/// graph. Constructed efficiently from `RegionValueElements`.
93+
#[orderable]
9394
#[debug_format = "PointIndex({})"]
9495
pub struct PointIndex {}
9596
}

compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,6 @@ impl GlobalFileTable {
189189
}
190190

191191
rustc_index::newtype_index! {
192-
// Tell the newtype macro to not generate `Encode`/`Decode` impls.
193-
#[custom_encodable]
194192
struct LocalFileId {}
195193
}
196194

compiler/rustc_data_structures/src/graph/dominators/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct PreOrderFrame<Iter> {
2323
}
2424

2525
rustc_index::newtype_index! {
26+
#[orderable]
2627
struct PreorderIndex {}
2728
}
2829

0 commit comments

Comments
 (0)