about summary refs log tree commit diff
path: root/src/libsyntax_ext
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-11-08 15:52:14 +0000
committerbors <bors@rust-lang.org>2019-11-08 15:52:14 +0000
commit9e346646e93cc243567e27bb0f4e8716d56ad1f1 (patch)
tree32241bdad56a558bbfa93093ba4cc65797df3498 /src/libsyntax_ext
parent76ade3e8ac42cd7a7b7c3c5ef54818ab68e3ebdc (diff)
parent65c77bc09ab38b3d9377168d673ed7b0a2c1e0c3 (diff)
downloadrust-9e346646e93cc243567e27bb0f4e8716d56ad1f1.tar.gz
rust-9e346646e93cc243567e27bb0f4e8716d56ad1f1.zip
Auto merge of #66225 - Centril:rollup-it0t5tk, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #65785 (Transition future compat lints to {ERROR, DENY} - Take 2)
 - #66007 (Remove "here" from "expected one of X here")
 - #66043 (rename Memory::get methods to get_raw to indicate their unchecked nature)
 - #66154 (miri: Rename to_{u,i}size to to_machine_{u,i}size)
 - #66188 (`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax_ext')
-rw-r--r--src/libsyntax_ext/deriving/generic/mod.rs2
-rw-r--r--src/libsyntax_ext/global_allocator.rs15
-rw-r--r--src/libsyntax_ext/test.rs14
-rw-r--r--src/libsyntax_ext/test_harness.rs7
4 files changed, 16 insertions, 22 deletions
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs
index b18fd50ae76..b24306def74 100644
--- a/src/libsyntax_ext/deriving/generic/mod.rs
+++ b/src/libsyntax_ext/deriving/generic/mod.rs
@@ -950,7 +950,7 @@ impl<'a> MethodDef<'a> {
 
         let trait_lo_sp = trait_.span.shrink_to_lo();
 
-        let sig = ast::MethodSig {
+        let sig = ast::FnSig {
             header: ast::FnHeader {
                 unsafety,
                 abi: Abi::new(abi, trait_lo_sp),
diff --git a/src/libsyntax_ext/global_allocator.rs b/src/libsyntax_ext/global_allocator.rs
index 90d2ea38bc3..dc29e057455 100644
--- a/src/libsyntax_ext/global_allocator.rs
+++ b/src/libsyntax_ext/global_allocator.rs
@@ -1,7 +1,7 @@
 use crate::util::check_builtin_macro_attribute;
 
 use syntax::ast::{ItemKind, Mutability, Stmt, Ty, TyKind, Unsafety};
-use syntax::ast::{self, Param, Attribute, Expr, FnHeader, Generics, Ident};
+use syntax::ast::{self, Param, Attribute, Expr, FnSig, FnHeader, Generics, Ident};
 use syntax::expand::allocator::{AllocatorKind, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS};
 use syntax::ptr::P;
 use syntax::symbol::{kw, sym, Symbol};
@@ -73,15 +73,10 @@ impl AllocFnFactory<'_, '_> {
             .collect();
         let result = self.call_allocator(method.name, args);
         let (output_ty, output_expr) = self.ret_ty(&method.output, result);
-        let kind = ItemKind::Fn(
-            self.cx.fn_decl(abi_args, ast::FunctionRetTy::Ty(output_ty)),
-            FnHeader {
-                unsafety: Unsafety::Unsafe,
-                ..FnHeader::default()
-            },
-            Generics::default(),
-            self.cx.block_expr(output_expr),
-        );
+        let decl = self.cx.fn_decl(abi_args, ast::FunctionRetTy::Ty(output_ty));
+        let header = FnHeader { unsafety: Unsafety::Unsafe, ..FnHeader::default() };
+        let sig = FnSig { decl, header };
+        let kind = ItemKind::Fn(sig, Generics::default(), self.cx.block_expr(output_expr));
         let item = self.cx.item(
             self.span,
             self.cx.ident_of(&self.kind.fn_name(method.name), self.span),
diff --git a/src/libsyntax_ext/test.rs b/src/libsyntax_ext/test.rs
index b0da413d63a..8656100c921 100644
--- a/src/libsyntax_ext/test.rs
+++ b/src/libsyntax_ext/test.rs
@@ -310,15 +310,15 @@ fn test_type(cx: &ExtCtxt<'_>) -> TestType {
 fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool {
     let has_should_panic_attr = attr::contains_name(&i.attrs, sym::should_panic);
     let ref sd = cx.parse_sess.span_diagnostic;
-    if let ast::ItemKind::Fn(ref decl, ref header, ref generics, _) = i.kind {
-        if header.unsafety == ast::Unsafety::Unsafe {
+    if let ast::ItemKind::Fn(ref sig, ref generics, _) = i.kind {
+        if sig.header.unsafety == ast::Unsafety::Unsafe {
             sd.span_err(
                 i.span,
                 "unsafe functions cannot be used for tests"
             );
             return false
         }
-        if header.asyncness.node.is_async() {
+        if sig.header.asyncness.node.is_async() {
             sd.span_err(
                 i.span,
                 "async functions cannot be used for tests"
@@ -329,13 +329,13 @@ fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool {
 
         // If the termination trait is active, the compiler will check that the output
         // type implements the `Termination` trait as `libtest` enforces that.
-        let has_output = match decl.output {
+        let has_output = match sig.decl.output {
             ast::FunctionRetTy::Default(..) => false,
             ast::FunctionRetTy::Ty(ref t) if t.kind.is_unit() => false,
             _ => true
         };
 
-        if !decl.inputs.is_empty() {
+        if !sig.decl.inputs.is_empty() {
             sd.span_err(i.span, "functions used as tests can not have any arguments");
             return false;
         }
@@ -361,10 +361,10 @@ fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool {
 }
 
 fn has_bench_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool {
-    let has_sig = if let ast::ItemKind::Fn(ref decl, _, _, _) = i.kind {
+    let has_sig = if let ast::ItemKind::Fn(ref sig, _, _) = i.kind {
         // N.B., inadequate check, but we're running
         // well before resolve, can't get too deep.
-        decl.inputs.len() == 1
+        sig.decl.inputs.len() == 1
     } else {
         false
     };
diff --git a/src/libsyntax_ext/test_harness.rs b/src/libsyntax_ext/test_harness.rs
index 33d41a7f53e..1492f6f575f 100644
--- a/src/libsyntax_ext/test_harness.rs
+++ b/src/libsyntax_ext/test_harness.rs
@@ -306,10 +306,9 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
         ecx.block(sp, vec![call_test_main])
     };
 
-    let main = ast::ItemKind::Fn(ecx.fn_decl(vec![], ast::FunctionRetTy::Ty(main_ret_ty)),
-                           ast::FnHeader::default(),
-                           ast::Generics::default(),
-                           main_body);
+    let decl = ecx.fn_decl(vec![], ast::FunctionRetTy::Ty(main_ret_ty));
+    let sig = ast::FnSig { decl, header: ast::FnHeader::default() };
+    let main = ast::ItemKind::Fn(sig, ast::Generics::default(), main_body);
 
     // Honor the reexport_test_harness_main attribute
     let main_id = match cx.reexport_test_harness_main {