diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs index 3c674f318af..dfc3e8c6ef2 100644 --- a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs +++ b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs @@ -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, )); diff --git a/compiler/rustc_builtin_macros/src/deriving/decodable.rs b/compiler/rustc_builtin_macros/src/deriving/decodable.rs index d649ae7c25e..4bd8340e099 100644 --- a/compiler/rustc_builtin_macros/src/deriving/decodable.rs +++ b/compiler/rustc_builtin_macros/src/deriving/decodable.rs @@ -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, ))), diff --git a/compiler/rustc_builtin_macros/src/deriving/encodable.rs b/compiler/rustc_builtin_macros/src/deriving/encodable.rs index f8bc2f5bb85..829e258c36b 100644 --- a/compiler/rustc_builtin_macros/src/deriving/encodable.rs +++ b/compiler/rustc_builtin_macros/src/deriving/encodable.rs @@ -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, ))), diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs b/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs index ed911ff0be9..6b2f31c64e1 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs @@ -11,11 +11,10 @@ use rustc_span::symbol::{kw, Ident, Symbol}; use rustc_span::Span; /// A path, e.g., `::std::option::Option::` (global). Has support -/// for type parameters and a lifetime. +/// for type parameters. #[derive(Clone)] pub struct Path { path: Vec, - lifetime: Option, params: Vec>, kind: PathKind, } @@ -29,18 +28,13 @@ pub enum PathKind { impl Path { pub fn new(path: Vec) -> 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, - lifetime: Option, - params: Vec>, - kind: PathKind, - ) -> Path { - Path { path, lifetime, params, kind } + pub fn new_(path: Vec, params: Vec>, 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) -> Option { - lt.map(|ident| cx.lifetime(span, ident)) -} - -fn mk_lifetimes(cx: &ExtCtxt<'_>, span: Span, lt: &Option) -> Vec { - mk_lifetime(cx, span, lt).into_iter().collect() -} - impl Ty { pub fn to_ty( &self, diff --git a/compiler/rustc_builtin_macros/src/deriving/hash.rs b/compiler/rustc_builtin_macros/src/deriving/hash.rs index c01e68ad358..906eef32f79 100644 --- a/compiler/rustc_builtin_macros/src/deriving/hash.rs +++ b/compiler/rustc_builtin_macros/src/deriving/hash.rs @@ -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;