mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Rename Ty::Literal
as Ty::Path
.
Because a `Literal` is a type of expression, and is simply the wrong name for this.
This commit is contained in:
parent
18fef6bbd7
commit
00307a5b6f
@ -55,7 +55,7 @@ pub fn expand_deriving_clone(
|
||||
}
|
||||
}
|
||||
ItemKind::Union(..) => {
|
||||
bounds = vec![Literal(path_std!(marker::Copy))];
|
||||
bounds = vec![Path(path_std!(marker::Copy))];
|
||||
is_simple = true;
|
||||
substructure = combine_substructure(Box::new(|c, s, sub| {
|
||||
cs_clone_simple("Clone", c, s, sub, true)
|
||||
|
@ -29,7 +29,7 @@ pub fn expand_deriving_ord(
|
||||
generics: Bounds::empty(),
|
||||
explicit_self: true,
|
||||
args: vec![(self_ref(), sym::other)],
|
||||
ret_ty: Literal(path_std!(cmp::Ordering)),
|
||||
ret_ty: Path(path_std!(cmp::Ordering)),
|
||||
attributes: attrs,
|
||||
unify_fieldless_variants: true,
|
||||
combine_substructure: combine_substructure(Box::new(|a, b, c| cs_cmp(a, b, c))),
|
||||
|
@ -71,7 +71,7 @@ pub fn expand_deriving_partial_eq(
|
||||
generics: Bounds::empty(),
|
||||
explicit_self: true,
|
||||
args: vec![(self_ref(), sym::other)],
|
||||
ret_ty: Literal(path_local!(bool)),
|
||||
ret_ty: Path(path_local!(bool)),
|
||||
attributes: attrs,
|
||||
unify_fieldless_variants: true,
|
||||
combine_substructure: combine_substructure(Box::new(|a, b, c| $f(a, b, c))),
|
||||
|
@ -15,12 +15,9 @@ pub fn expand_deriving_partial_ord(
|
||||
item: &Annotatable,
|
||||
push: &mut dyn FnMut(Annotatable),
|
||||
) {
|
||||
let ordering_ty = Literal(path_std!(cmp::Ordering));
|
||||
let ret_ty = Literal(Path::new_(
|
||||
pathvec_std!(option::Option),
|
||||
vec![Box::new(ordering_ty)],
|
||||
PathKind::Std,
|
||||
));
|
||||
let ordering_ty = Path(path_std!(cmp::Ordering));
|
||||
let ret_ty =
|
||||
Path(Path::new_(pathvec_std!(option::Option), vec![Box::new(ordering_ty)], PathKind::Std));
|
||||
|
||||
let inline = cx.meta_word(span, sym::inline);
|
||||
let attrs = vec![cx.attribute(inline)];
|
||||
|
@ -16,7 +16,7 @@ pub fn expand_deriving_debug(
|
||||
push: &mut dyn FnMut(Annotatable),
|
||||
) {
|
||||
// &mut ::std::fmt::Formatter
|
||||
let fmtr = Ref(Box::new(Literal(path_std!(fmt::Formatter))), ast::Mutability::Mut);
|
||||
let fmtr = Ref(Box::new(Path(path_std!(fmt::Formatter))), ast::Mutability::Mut);
|
||||
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
@ -30,7 +30,7 @@ pub fn expand_deriving_debug(
|
||||
generics: Bounds::empty(),
|
||||
explicit_self: true,
|
||||
args: vec![(fmtr, sym::f)],
|
||||
ret_ty: Literal(path_std!(fmt::Result)),
|
||||
ret_ty: Path(path_std!(fmt::Result)),
|
||||
attributes: Vec::new(),
|
||||
unify_fieldless_variants: false,
|
||||
combine_substructure: combine_substructure(Box::new(|a, b, c| {
|
||||
|
@ -36,16 +36,12 @@ pub fn expand_deriving_rustc_decodable(
|
||||
)],
|
||||
},
|
||||
explicit_self: false,
|
||||
args: vec![(Ref(Box::new(Literal(Path::new_local(typaram))), Mutability::Mut), sym::d)],
|
||||
ret_ty: Literal(Path::new_(
|
||||
args: vec![(Ref(Box::new(Path(Path::new_local(typaram))), Mutability::Mut), sym::d)],
|
||||
ret_ty: Path(Path::new_(
|
||||
pathvec_std!(result::Result),
|
||||
vec![
|
||||
Box::new(Self_),
|
||||
Box::new(Literal(Path::new_(
|
||||
vec![typaram, sym::Error],
|
||||
vec![],
|
||||
PathKind::Local,
|
||||
))),
|
||||
Box::new(Path(Path::new_(vec![typaram, sym::Error], vec![], PathKind::Local))),
|
||||
],
|
||||
PathKind::Std,
|
||||
)),
|
||||
|
@ -121,16 +121,12 @@ pub fn expand_deriving_rustc_encodable(
|
||||
)],
|
||||
},
|
||||
explicit_self: true,
|
||||
args: vec![(Ref(Box::new(Literal(Path::new_local(typaram))), Mutability::Mut), sym::s)],
|
||||
ret_ty: Literal(Path::new_(
|
||||
args: vec![(Ref(Box::new(Path(Path::new_local(typaram))), Mutability::Mut), sym::s)],
|
||||
ret_ty: Path(Path::new_(
|
||||
pathvec_std!(result::Result),
|
||||
vec![
|
||||
Box::new(Tuple(Vec::new())),
|
||||
Box::new(Literal(Path::new_(
|
||||
vec![typaram, sym::Error],
|
||||
vec![],
|
||||
PathKind::Local,
|
||||
))),
|
||||
Box::new(Path(Path::new_(vec![typaram, sym::Error], vec![], PathKind::Local))),
|
||||
],
|
||||
PathKind::Std,
|
||||
)),
|
||||
|
@ -77,7 +77,7 @@ pub enum Ty {
|
||||
Ref(Box<Ty>, ast::Mutability),
|
||||
/// `mod::mod::Type<[lifetime], [Params...]>`, including a plain type
|
||||
/// parameter, and things like `i32`
|
||||
Literal(Path),
|
||||
Path(Path),
|
||||
/// includes unit
|
||||
Tuple(Vec<Ty>),
|
||||
}
|
||||
@ -103,7 +103,7 @@ impl Ty {
|
||||
let raw_ty = ty.to_ty(cx, span, self_ty, self_generics);
|
||||
cx.ty_rptr(span, raw_ty, None, *mutbl)
|
||||
}
|
||||
Literal(p) => p.to_ty(cx, span, self_ty, self_generics),
|
||||
Path(p) => p.to_ty(cx, span, self_ty, self_generics),
|
||||
Self_ => cx.ty_path(self.to_path(cx, span, self_ty, self_generics)),
|
||||
Tuple(fields) => {
|
||||
let ty = ast::TyKind::Tup(
|
||||
@ -141,7 +141,7 @@ impl Ty {
|
||||
|
||||
cx.path_all(span, false, vec![self_ty], params)
|
||||
}
|
||||
Literal(ref p) => p.to_path(cx, span, self_ty, generics),
|
||||
Path(ref p) => p.to_path(cx, span, self_ty, generics),
|
||||
Ref(..) => cx.span_bug(span, "ref in a path in generic `derive`"),
|
||||
Tuple(..) => cx.span_bug(span, "tuple in a path in generic `derive`"),
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ pub fn expand_deriving_hash(
|
||||
name: sym::hash,
|
||||
generics: Bounds { bounds: vec![(typaram, vec![path_std!(hash::Hasher)])] },
|
||||
explicit_self: true,
|
||||
args: vec![(Ref(Box::new(Literal(arg)), Mutability::Mut), sym::state)],
|
||||
args: vec![(Ref(Box::new(Path(arg)), Mutability::Mut), sym::state)],
|
||||
ret_ty: nil_ty(),
|
||||
attributes: vec![],
|
||||
unify_fieldless_variants: true,
|
||||
|
Loading…
Reference in New Issue
Block a user