diff options
| author | Matthias Einwag <matthias.einwag@live.com> | 2019-02-12 22:46:14 -0800 |
|---|---|---|
| committer | Matthias Einwag <matthias.einwag@live.com> | 2019-02-12 22:46:14 -0800 |
| commit | 871338c3aed87cb84f02ebd7fd9b447966d5b05d (patch) | |
| tree | a2e1315d7d17d0b9f3463686ed2fbf36f3238ec4 /src/libsyntax_ext/deriving/cmp | |
| parent | 1ef34a5a39641846e824b6450a705d6031002beb (diff) | |
| parent | 0f949c2fcc696d0260a99196d5e5400c59a26a54 (diff) | |
| download | rust-871338c3aed87cb84f02ebd7fd9b447966d5b05d.tar.gz rust-871338c3aed87cb84f02ebd7fd9b447966d5b05d.zip | |
Merging master
Diffstat (limited to 'src/libsyntax_ext/deriving/cmp')
| -rw-r--r-- | src/libsyntax_ext/deriving/cmp/eq.rs | 19 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/cmp/ord.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/cmp/partial_eq.rs | 18 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/cmp/partial_ord.rs | 22 |
4 files changed, 38 insertions, 33 deletions
diff --git a/src/libsyntax_ext/deriving/cmp/eq.rs b/src/libsyntax_ext/deriving/cmp/eq.rs index dbba8c3b7a0..a1035ff641f 100644 --- a/src/libsyntax_ext/deriving/cmp/eq.rs +++ b/src/libsyntax_ext/deriving/cmp/eq.rs @@ -1,6 +1,6 @@ -use deriving::path_std; -use deriving::generic::*; -use deriving::generic::ty::*; +use crate::deriving::path_std; +use crate::deriving::generic::*; +use crate::deriving::generic::ty::*; use syntax::ast::{self, Expr, MetaItem, GenericArg}; use syntax::ext::base::{Annotatable, ExtCtxt}; @@ -9,7 +9,7 @@ use syntax::ptr::P; use syntax::symbol::Symbol; use syntax_pos::Span; -pub fn expand_deriving_eq(cx: &mut ExtCtxt, +pub fn expand_deriving_eq(cx: &mut ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, @@ -44,8 +44,11 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt, trait_def.expand_ext(cx, mitem, item, push, true) } -fn cs_total_eq_assert(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) -> P<Expr> { - fn assert_ty_bounds(cx: &mut ExtCtxt, stmts: &mut Vec<ast::Stmt>, +fn cs_total_eq_assert(cx: &mut ExtCtxt<'_>, + trait_span: Span, + substr: &Substructure<'_>) + -> P<Expr> { + fn assert_ty_bounds(cx: &mut ExtCtxt<'_>, stmts: &mut Vec<ast::Stmt>, ty: P<ast::Ty>, span: Span, helper_name: &str) { // Generate statement `let _: helper_name<ty>;`, // set the expn ID so we can use the unstable struct. @@ -55,7 +58,9 @@ fn cs_total_eq_assert(cx: &mut ExtCtxt, trait_span: Span, substr: &Substructure) vec![GenericArg::Type(ty)], vec![]); stmts.push(cx.stmt_let_type_only(span, cx.ty_path(assert_path))); } - fn process_variant(cx: &mut ExtCtxt, stmts: &mut Vec<ast::Stmt>, variant: &ast::VariantData) { + fn process_variant(cx: &mut ExtCtxt<'_>, + stmts: &mut Vec<ast::Stmt>, + variant: &ast::VariantData) { for field in variant.fields() { // let _: AssertParamIsEq<FieldTy>; assert_ty_bounds(cx, stmts, field.ty.clone(), field.span, "AssertParamIsEq"); diff --git a/src/libsyntax_ext/deriving/cmp/ord.rs b/src/libsyntax_ext/deriving/cmp/ord.rs index 21bd56710ac..e4f939c151f 100644 --- a/src/libsyntax_ext/deriving/cmp/ord.rs +++ b/src/libsyntax_ext/deriving/cmp/ord.rs @@ -1,6 +1,6 @@ -use deriving::path_std; -use deriving::generic::*; -use deriving::generic::ty::*; +use crate::deriving::path_std; +use crate::deriving::generic::*; +use crate::deriving::generic::ty::*; use syntax::ast::{self, Expr, MetaItem}; use syntax::ext::base::{Annotatable, ExtCtxt}; @@ -9,7 +9,7 @@ use syntax::ptr::P; use syntax::symbol::Symbol; use syntax_pos::Span; -pub fn expand_deriving_ord(cx: &mut ExtCtxt, +pub fn expand_deriving_ord(cx: &mut ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, @@ -44,7 +44,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt, } -pub fn ordering_collapsed(cx: &mut ExtCtxt, +pub fn ordering_collapsed(cx: &mut ExtCtxt<'_>, span: Span, self_arg_tags: &[ast::Ident]) -> P<ast::Expr> { @@ -53,7 +53,7 @@ pub fn ordering_collapsed(cx: &mut ExtCtxt, cx.expr_method_call(span, lft, cx.ident_of("cmp"), vec![rgt]) } -pub fn cs_cmp(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P<Expr> { +pub fn cs_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> P<Expr> { let test_id = cx.ident_of("cmp").gensym(); let equals_path = cx.path_global(span, cx.std_path(&["cmp", "Ordering", "Equal"])); diff --git a/src/libsyntax_ext/deriving/cmp/partial_eq.rs b/src/libsyntax_ext/deriving/cmp/partial_eq.rs index 4ec24bce4cd..07026ae3739 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_eq.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_eq.rs @@ -1,6 +1,6 @@ -use deriving::{path_local, path_std}; -use deriving::generic::*; -use deriving::generic::ty::*; +use crate::deriving::{path_local, path_std}; +use crate::deriving::generic::*; +use crate::deriving::generic::ty::*; use syntax::ast::{BinOpKind, Expr, MetaItem}; use syntax::ext::base::{Annotatable, ExtCtxt}; @@ -9,22 +9,22 @@ use syntax::ptr::P; use syntax::symbol::Symbol; use syntax_pos::Span; -pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt, +pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, push: &mut dyn FnMut(Annotatable)) { // structures are equal if all fields are equal, and non equal, if // any fields are not equal or if the enum variants are different - fn cs_op(cx: &mut ExtCtxt, + fn cs_op(cx: &mut ExtCtxt<'_>, span: Span, - substr: &Substructure, + substr: &Substructure<'_>, op: BinOpKind, combiner: BinOpKind, base: bool) -> P<Expr> { - let op = |cx: &mut ExtCtxt, span: Span, self_f: P<Expr>, other_fs: &[P<Expr>]| { + let op = |cx: &mut ExtCtxt<'_>, span: Span, self_f: P<Expr>, other_fs: &[P<Expr>]| { let other_f = match (other_fs.len(), other_fs.get(0)) { (1, Some(o_f)) => o_f, _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialEq)`"), @@ -53,10 +53,10 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt, substr) } - fn cs_eq(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P<Expr> { + fn cs_eq(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> P<Expr> { cs_op(cx, span, substr, BinOpKind::Eq, BinOpKind::And, true) } - fn cs_ne(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P<Expr> { + fn cs_ne(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> P<Expr> { cs_op(cx, span, substr, BinOpKind::Ne, BinOpKind::Or, false) } diff --git a/src/libsyntax_ext/deriving/cmp/partial_ord.rs b/src/libsyntax_ext/deriving/cmp/partial_ord.rs index 9ef481edf51..e99abeb118e 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_ord.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_ord.rs @@ -1,8 +1,8 @@ -pub use self::OrderingOp::*; +pub use OrderingOp::*; -use deriving::{path_local, pathvec_std, path_std}; -use deriving::generic::*; -use deriving::generic::ty::*; +use crate::deriving::{path_local, pathvec_std, path_std}; +use crate::deriving::generic::*; +use crate::deriving::generic::ty::*; use syntax::ast::{self, BinOpKind, Expr, MetaItem}; use syntax::ext::base::{Annotatable, ExtCtxt}; @@ -11,7 +11,7 @@ use syntax::ptr::P; use syntax::symbol::Symbol; use syntax_pos::Span; -pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt, +pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt<'_>, span: Span, mitem: &MetaItem, item: &Annotatable, @@ -95,7 +95,7 @@ pub enum OrderingOp { GeOp, } -pub fn some_ordering_collapsed(cx: &mut ExtCtxt, +pub fn some_ordering_collapsed(cx: &mut ExtCtxt<'_>, span: Span, op: OrderingOp, self_arg_tags: &[ast::Ident]) @@ -112,7 +112,7 @@ pub fn some_ordering_collapsed(cx: &mut ExtCtxt, cx.expr_method_call(span, lft, cx.ident_of(op_str), vec![rgt]) } -pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P<Expr> { +pub fn cs_partial_cmp(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>) -> P<Expr> { let test_id = cx.ident_of("cmp").gensym(); let ordering = cx.path_global(span, cx.std_path(&["cmp", "Ordering", "Equal"])); let ordering_expr = cx.expr_path(ordering.clone()); @@ -184,14 +184,14 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span, substr: &Substructure) -> P< /// Strict inequality. fn cs_op(less: bool, inclusive: bool, - cx: &mut ExtCtxt, + cx: &mut ExtCtxt<'_>, span: Span, - substr: &Substructure) -> P<Expr> { - let ordering_path = |cx: &mut ExtCtxt, name: &str| { + substr: &Substructure<'_>) -> P<Expr> { + let ordering_path = |cx: &mut ExtCtxt<'_>, name: &str| { cx.expr_path(cx.path_global(span, cx.std_path(&["cmp", "Ordering", name]))) }; - let par_cmp = |cx: &mut ExtCtxt, span, self_f: P<Expr>, other_fs: &[P<Expr>], default| { + let par_cmp = |cx: &mut ExtCtxt<'_>, span, self_f: P<Expr>, other_fs: &[P<Expr>], default| { let other_f = match (other_fs.len(), other_fs.get(0)) { (1, Some(o_f)) => o_f, _ => cx.span_bug(span, "not exactly 2 arguments in `derive(PartialOrd)`"), |
