Remove lifetime support in deriving code.
It's unused.
This commit is contained in:
parent
b94246693a
commit
18fef6bbd7
@ -18,7 +18,6 @@ pub fn expand_deriving_partial_ord(
|
||||
let ordering_ty = Literal(path_std!(cmp::Ordering));
|
||||
let ret_ty = Literal(Path::new_(
|
||||
pathvec_std!(option::Option),
|
||||
None,
|
||||
vec![Box::new(ordering_ty)],
|
||||
PathKind::Std,
|
||||
));
|
||||
|
@ -23,7 +23,7 @@ pub fn expand_deriving_rustc_decodable(
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path: Path::new_(vec![krate, sym::Decodable], None, vec![], PathKind::Global),
|
||||
path: Path::new_(vec![krate, sym::Decodable], vec![], PathKind::Global),
|
||||
additional_bounds: Vec::new(),
|
||||
generics: Bounds::empty(),
|
||||
supports_unions: false,
|
||||
@ -32,19 +32,17 @@ pub fn expand_deriving_rustc_decodable(
|
||||
generics: Bounds {
|
||||
bounds: vec![(
|
||||
typaram,
|
||||
vec![Path::new_(vec![krate, sym::Decoder], None, vec![], PathKind::Global)],
|
||||
vec![Path::new_(vec![krate, sym::Decoder], vec![], PathKind::Global)],
|
||||
)],
|
||||
},
|
||||
explicit_self: false,
|
||||
args: vec![(Ref(Box::new(Literal(Path::new_local(typaram))), Mutability::Mut), sym::d)],
|
||||
ret_ty: Literal(Path::new_(
|
||||
pathvec_std!(result::Result),
|
||||
None,
|
||||
vec![
|
||||
Box::new(Self_),
|
||||
Box::new(Literal(Path::new_(
|
||||
vec![typaram, sym::Error],
|
||||
None,
|
||||
vec![],
|
||||
PathKind::Local,
|
||||
))),
|
||||
|
@ -108,7 +108,7 @@ pub fn expand_deriving_rustc_encodable(
|
||||
let trait_def = TraitDef {
|
||||
span,
|
||||
attributes: Vec::new(),
|
||||
path: Path::new_(vec![krate, sym::Encodable], None, vec![], PathKind::Global),
|
||||
path: Path::new_(vec![krate, sym::Encodable], vec![], PathKind::Global),
|
||||
additional_bounds: Vec::new(),
|
||||
generics: Bounds::empty(),
|
||||
supports_unions: false,
|
||||
@ -117,19 +117,17 @@ pub fn expand_deriving_rustc_encodable(
|
||||
generics: Bounds {
|
||||
bounds: vec![(
|
||||
typaram,
|
||||
vec![Path::new_(vec![krate, sym::Encoder], None, vec![], PathKind::Global)],
|
||||
vec![Path::new_(vec![krate, sym::Encoder], vec![], PathKind::Global)],
|
||||
)],
|
||||
},
|
||||
explicit_self: true,
|
||||
args: vec![(Ref(Box::new(Literal(Path::new_local(typaram))), Mutability::Mut), sym::s)],
|
||||
ret_ty: Literal(Path::new_(
|
||||
pathvec_std!(result::Result),
|
||||
None,
|
||||
vec![
|
||||
Box::new(Tuple(Vec::new())),
|
||||
Box::new(Literal(Path::new_(
|
||||
vec![typaram, sym::Error],
|
||||
None,
|
||||
vec![],
|
||||
PathKind::Local,
|
||||
))),
|
||||
|
@ -11,11 +11,10 @@ use rustc_span::symbol::{kw, Ident, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
/// A path, e.g., `::std::option::Option::<i32>` (global). Has support
|
||||
/// for type parameters and a lifetime.
|
||||
/// for type parameters.
|
||||
#[derive(Clone)]
|
||||
pub struct Path {
|
||||
path: Vec<Symbol>,
|
||||
lifetime: Option<Ident>,
|
||||
params: Vec<Box<Ty>>,
|
||||
kind: PathKind,
|
||||
}
|
||||
@ -29,18 +28,13 @@ pub enum PathKind {
|
||||
|
||||
impl Path {
|
||||
pub fn new(path: Vec<Symbol>) -> Path {
|
||||
Path::new_(path, None, Vec::new(), PathKind::Std)
|
||||
Path::new_(path, Vec::new(), PathKind::Std)
|
||||
}
|
||||
pub fn new_local(path: Symbol) -> Path {
|
||||
Path::new_(vec![path], None, Vec::new(), PathKind::Local)
|
||||
Path::new_(vec![path], Vec::new(), PathKind::Local)
|
||||
}
|
||||
pub fn new_(
|
||||
path: Vec<Symbol>,
|
||||
lifetime: Option<Ident>,
|
||||
params: Vec<Box<Ty>>,
|
||||
kind: PathKind,
|
||||
) -> Path {
|
||||
Path { path, lifetime, params, kind }
|
||||
pub fn new_(path: Vec<Symbol>, params: Vec<Box<Ty>>, kind: PathKind) -> Path {
|
||||
Path { path, params, kind }
|
||||
}
|
||||
|
||||
pub fn to_ty(
|
||||
@ -60,10 +54,8 @@ impl Path {
|
||||
self_generics: &Generics,
|
||||
) -> ast::Path {
|
||||
let mut idents = self.path.iter().map(|s| Ident::new(*s, span)).collect();
|
||||
let lt = mk_lifetimes(cx, span, &self.lifetime);
|
||||
let tys = self.params.iter().map(|t| t.to_ty(cx, span, self_ty, self_generics));
|
||||
let params =
|
||||
lt.into_iter().map(GenericArg::Lifetime).chain(tys.map(GenericArg::Type)).collect();
|
||||
let params = tys.map(GenericArg::Type).collect();
|
||||
|
||||
match self.kind {
|
||||
PathKind::Global => cx.path_all(span, true, idents, params),
|
||||
@ -98,14 +90,6 @@ pub fn nil_ty() -> Ty {
|
||||
Tuple(Vec::new())
|
||||
}
|
||||
|
||||
fn mk_lifetime(cx: &ExtCtxt<'_>, span: Span, lt: &Option<Ident>) -> Option<ast::Lifetime> {
|
||||
lt.map(|ident| cx.lifetime(span, ident))
|
||||
}
|
||||
|
||||
fn mk_lifetimes(cx: &ExtCtxt<'_>, span: Span, lt: &Option<Ident>) -> Vec<ast::Lifetime> {
|
||||
mk_lifetime(cx, span, lt).into_iter().collect()
|
||||
}
|
||||
|
||||
impl Ty {
|
||||
pub fn to_ty(
|
||||
&self,
|
||||
|
@ -15,7 +15,7 @@ pub fn expand_deriving_hash(
|
||||
item: &Annotatable,
|
||||
push: &mut dyn FnMut(Annotatable),
|
||||
) {
|
||||
let path = Path::new_(pathvec_std!(hash::Hash), None, vec![], PathKind::Std);
|
||||
let path = Path::new_(pathvec_std!(hash::Hash), vec![], PathKind::Std);
|
||||
|
||||
let typaram = sym::__H;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user