Skip to content

Commit aea4c0c

Browse files
authored
Rollup merge of #104391 - nnethercote:deriving-cleanups, r=jackh726
Deriving cleanups Fixing some minor problems `@RalfJung` found in #99046. r? `@RalfJung`
2 parents 2c29b05 + 111db7d commit aea4c0c

File tree

13 files changed

+38
-59
lines changed

13 files changed

+38
-59
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,7 @@ pub struct Generics {
392392
impl Default for Generics {
393393
/// Creates an instance of `Generics`.
394394
fn default() -> Generics {
395-
Generics {
396-
params: Vec::new(),
397-
where_clause: WhereClause {
398-
has_where_token: false,
399-
predicates: Vec::new(),
400-
span: DUMMY_SP,
401-
},
402-
span: DUMMY_SP,
403-
}
395+
Generics { params: Vec::new(), where_clause: Default::default(), span: DUMMY_SP }
404396
}
405397
}
406398

@@ -415,6 +407,12 @@ pub struct WhereClause {
415407
pub span: Span,
416408
}
417409

410+
impl Default for WhereClause {
411+
fn default() -> WhereClause {
412+
WhereClause { has_where_token: false, predicates: Vec::new(), span: DUMMY_SP }
413+
}
414+
}
415+
418416
/// A single predicate in a where-clause.
419417
#[derive(Clone, Encodable, Decodable, Debug)]
420418
pub enum WherePredicate {

compiler/rustc_builtin_macros/src/deriving/bounds.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use crate::deriving::generic::ty::*;
21
use crate::deriving::generic::*;
32
use crate::deriving::path_std;
43

@@ -19,7 +18,6 @@ pub fn expand_deriving_copy(
1918
path: path_std!(marker::Copy),
2019
skip_path_as_bound: false,
2120
additional_bounds: Vec::new(),
22-
generics: Bounds::empty(),
2321
supports_unions: true,
2422
methods: Vec::new(),
2523
associated_types: Vec::new(),

compiler/rustc_builtin_macros/src/deriving/clone.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ pub fn expand_deriving_clone(
7575
path: path_std!(clone::Clone),
7676
skip_path_as_bound: false,
7777
additional_bounds: bounds,
78-
generics: Bounds::empty(),
7978
supports_unions: true,
8079
methods: vec![MethodDef {
8180
name: sym::clone,

compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pub fn expand_deriving_eq(
2828
path: path_std!(cmp::Eq),
2929
skip_path_as_bound: false,
3030
additional_bounds: Vec::new(),
31-
generics: Bounds::empty(),
3231
supports_unions: true,
3332
methods: vec![MethodDef {
3433
name: sym::assert_receiver_is_total_eq,

compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ pub fn expand_deriving_ord(
2222
path: path_std!(cmp::Ord),
2323
skip_path_as_bound: false,
2424
additional_bounds: Vec::new(),
25-
generics: Bounds::empty(),
2625
supports_unions: false,
2726
methods: vec![MethodDef {
2827
name: sym::cmp,

compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ pub fn expand_deriving_partial_eq(
8686
path: path_std!(cmp::PartialEq),
8787
skip_path_as_bound: false,
8888
additional_bounds: Vec::new(),
89-
generics: Bounds::empty(),
9089
supports_unions: false,
9190
methods,
9291
associated_types: Vec::new(),

compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ pub fn expand_deriving_partial_ord(
4040
path: path_std!(cmp::PartialOrd),
4141
skip_path_as_bound: false,
4242
additional_bounds: vec![],
43-
generics: Bounds::empty(),
4443
supports_unions: false,
4544
methods: vec![partial_cmp_def],
4645
associated_types: Vec::new(),

compiler/rustc_builtin_macros/src/deriving/debug.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ pub fn expand_deriving_debug(
2323
path: path_std!(fmt::Debug),
2424
skip_path_as_bound: false,
2525
additional_bounds: Vec::new(),
26-
generics: Bounds::empty(),
2726
supports_unions: false,
2827
methods: vec![MethodDef {
2928
name: sym::fmt,

compiler/rustc_builtin_macros/src/deriving/decodable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub fn expand_deriving_rustc_decodable(
2626
path: Path::new_(vec![krate, sym::Decodable], vec![], PathKind::Global),
2727
skip_path_as_bound: false,
2828
additional_bounds: Vec::new(),
29-
generics: Bounds::empty(),
3029
supports_unions: false,
3130
methods: vec![MethodDef {
3231
name: sym::decode,

compiler/rustc_builtin_macros/src/deriving/default.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub fn expand_deriving_default(
2727
path: Path::new(vec![kw::Default, sym::Default]),
2828
skip_path_as_bound: has_a_default_variant(item),
2929
additional_bounds: Vec::new(),
30-
generics: Bounds::empty(),
3130
supports_unions: false,
3231
methods: vec![MethodDef {
3332
name: kw::Default,

0 commit comments

Comments
 (0)