Skip to content

Commit 00307a5

Browse files
committed
Rename Ty::Literal as Ty::Path.
Because a `Literal` is a type of expression, and is simply the wrong name for this.
1 parent 18fef6b commit 00307a5

File tree

9 files changed

+18
-29
lines changed

9 files changed

+18
-29
lines changed

compiler/rustc_builtin_macros/src/deriving/clone.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn expand_deriving_clone(
5555
}
5656
}
5757
ItemKind::Union(..) => {
58-
bounds = vec![Literal(path_std!(marker::Copy))];
58+
bounds = vec![Path(path_std!(marker::Copy))];
5959
is_simple = true;
6060
substructure = combine_substructure(Box::new(|c, s, sub| {
6161
cs_clone_simple("Clone", c, s, sub, true)

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub fn expand_deriving_ord(
2929
generics: Bounds::empty(),
3030
explicit_self: true,
3131
args: vec![(self_ref(), sym::other)],
32-
ret_ty: Literal(path_std!(cmp::Ordering)),
32+
ret_ty: Path(path_std!(cmp::Ordering)),
3333
attributes: attrs,
3434
unify_fieldless_variants: true,
3535
combine_substructure: combine_substructure(Box::new(|a, b, c| cs_cmp(a, b, c))),

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn expand_deriving_partial_eq(
7171
generics: Bounds::empty(),
7272
explicit_self: true,
7373
args: vec![(self_ref(), sym::other)],
74-
ret_ty: Literal(path_local!(bool)),
74+
ret_ty: Path(path_local!(bool)),
7575
attributes: attrs,
7676
unify_fieldless_variants: true,
7777
combine_substructure: combine_substructure(Box::new(|a, b, c| $f(a, b, c))),

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ pub fn expand_deriving_partial_ord(
1515
item: &Annotatable,
1616
push: &mut dyn FnMut(Annotatable),
1717
) {
18-
let ordering_ty = Literal(path_std!(cmp::Ordering));
19-
let ret_ty = Literal(Path::new_(
20-
pathvec_std!(option::Option),
21-
vec![Box::new(ordering_ty)],
22-
PathKind::Std,
23-
));
18+
let ordering_ty = Path(path_std!(cmp::Ordering));
19+
let ret_ty =
20+
Path(Path::new_(pathvec_std!(option::Option), vec![Box::new(ordering_ty)], PathKind::Std));
2421

2522
let inline = cx.meta_word(span, sym::inline);
2623
let attrs = vec![cx.attribute(inline)];

compiler/rustc_builtin_macros/src/deriving/debug.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn expand_deriving_debug(
1616
push: &mut dyn FnMut(Annotatable),
1717
) {
1818
// &mut ::std::fmt::Formatter
19-
let fmtr = Ref(Box::new(Literal(path_std!(fmt::Formatter))), ast::Mutability::Mut);
19+
let fmtr = Ref(Box::new(Path(path_std!(fmt::Formatter))), ast::Mutability::Mut);
2020

2121
let trait_def = TraitDef {
2222
span,
@@ -30,7 +30,7 @@ pub fn expand_deriving_debug(
3030
generics: Bounds::empty(),
3131
explicit_self: true,
3232
args: vec![(fmtr, sym::f)],
33-
ret_ty: Literal(path_std!(fmt::Result)),
33+
ret_ty: Path(path_std!(fmt::Result)),
3434
attributes: Vec::new(),
3535
unify_fieldless_variants: false,
3636
combine_substructure: combine_substructure(Box::new(|a, b, c| {

compiler/rustc_builtin_macros/src/deriving/decodable.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,12 @@ pub fn expand_deriving_rustc_decodable(
3636
)],
3737
},
3838
explicit_self: false,
39-
args: vec![(Ref(Box::new(Literal(Path::new_local(typaram))), Mutability::Mut), sym::d)],
40-
ret_ty: Literal(Path::new_(
39+
args: vec![(Ref(Box::new(Path(Path::new_local(typaram))), Mutability::Mut), sym::d)],
40+
ret_ty: Path(Path::new_(
4141
pathvec_std!(result::Result),
4242
vec![
4343
Box::new(Self_),
44-
Box::new(Literal(Path::new_(
45-
vec![typaram, sym::Error],
46-
vec![],
47-
PathKind::Local,
48-
))),
44+
Box::new(Path(Path::new_(vec![typaram, sym::Error], vec![], PathKind::Local))),
4945
],
5046
PathKind::Std,
5147
)),

compiler/rustc_builtin_macros/src/deriving/encodable.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,12 @@ pub fn expand_deriving_rustc_encodable(
121121
)],
122122
},
123123
explicit_self: true,
124-
args: vec![(Ref(Box::new(Literal(Path::new_local(typaram))), Mutability::Mut), sym::s)],
125-
ret_ty: Literal(Path::new_(
124+
args: vec![(Ref(Box::new(Path(Path::new_local(typaram))), Mutability::Mut), sym::s)],
125+
ret_ty: Path(Path::new_(
126126
pathvec_std!(result::Result),
127127
vec![
128128
Box::new(Tuple(Vec::new())),
129-
Box::new(Literal(Path::new_(
130-
vec![typaram, sym::Error],
131-
vec![],
132-
PathKind::Local,
133-
))),
129+
Box::new(Path(Path::new_(vec![typaram, sym::Error], vec![], PathKind::Local))),
134130
],
135131
PathKind::Std,
136132
)),

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub enum Ty {
7777
Ref(Box<Ty>, ast::Mutability),
7878
/// `mod::mod::Type<[lifetime], [Params...]>`, including a plain type
7979
/// parameter, and things like `i32`
80-
Literal(Path),
80+
Path(Path),
8181
/// includes unit
8282
Tuple(Vec<Ty>),
8383
}
@@ -103,7 +103,7 @@ impl Ty {
103103
let raw_ty = ty.to_ty(cx, span, self_ty, self_generics);
104104
cx.ty_rptr(span, raw_ty, None, *mutbl)
105105
}
106-
Literal(p) => p.to_ty(cx, span, self_ty, self_generics),
106+
Path(p) => p.to_ty(cx, span, self_ty, self_generics),
107107
Self_ => cx.ty_path(self.to_path(cx, span, self_ty, self_generics)),
108108
Tuple(fields) => {
109109
let ty = ast::TyKind::Tup(
@@ -141,7 +141,7 @@ impl Ty {
141141

142142
cx.path_all(span, false, vec![self_ty], params)
143143
}
144-
Literal(ref p) => p.to_path(cx, span, self_ty, generics),
144+
Path(ref p) => p.to_path(cx, span, self_ty, generics),
145145
Ref(..) => cx.span_bug(span, "ref in a path in generic `derive`"),
146146
Tuple(..) => cx.span_bug(span, "tuple in a path in generic `derive`"),
147147
}

compiler/rustc_builtin_macros/src/deriving/hash.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn expand_deriving_hash(
3131
name: sym::hash,
3232
generics: Bounds { bounds: vec![(typaram, vec![path_std!(hash::Hasher)])] },
3333
explicit_self: true,
34-
args: vec![(Ref(Box::new(Literal(arg)), Mutability::Mut), sym::state)],
34+
args: vec![(Ref(Box::new(Path(arg)), Mutability::Mut), sym::state)],
3535
ret_ty: nil_ty(),
3636
attributes: vec![],
3737
unify_fieldless_variants: true,

0 commit comments

Comments
 (0)