]> git.lizzy.rs Git - rust.git/commitdiff
ast::MethodSig -> ast::FnSig
authorMazdak Farrokhzad <twingoow@gmail.com>
Thu, 7 Nov 2019 12:11:59 +0000 (13:11 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Fri, 8 Nov 2019 08:32:20 +0000 (09:32 +0100)
src/librustc/hir/lowering/item.rs
src/librustc/hir/map/def_collector.rs
src/librustc_interface/util.rs
src/librustc_save_analysis/dump_visitor.rs
src/librustc_save_analysis/sig.rs
src/libsyntax/ast.rs
src/libsyntax/mut_visit.rs
src/libsyntax/parse/parser/item.rs
src/libsyntax/print/pprust.rs
src/libsyntax/visit.rs
src/libsyntax_ext/deriving/generic/mod.rs

index a01f59eea0b32474ac2b84f364df1efb4b01f545..861130f0c69b2d8faabb4479ef8576709b1b60cf 100644 (file)
@@ -1255,7 +1255,7 @@ fn lower_maybe_async_body(
     fn lower_method_sig(
         &mut self,
         generics: &Generics,
-        sig: &MethodSig,
+        sig: &FnSig,
         fn_def_id: DefId,
         impl_trait_return_allow: bool,
         is_async: Option<NodeId>,
index 57c1421bde6cd23ccb7e5a1f9c1fcc3af69d4d55..d705737cc93d4912e405eddfa75ed5abc154b640 100644 (file)
@@ -228,7 +228,7 @@ fn visit_trait_item(&mut self, ti: &'a TraitItem) {
 
     fn visit_impl_item(&mut self, ii: &'a ImplItem) {
         let def_data = match ii.kind {
-            ImplItemKind::Method(MethodSig {
+            ImplItemKind::Method(FnSig {
                 ref header,
                 ref decl,
             }, ref body) if header.asyncness.node.is_async() => {
index d0c15073f1640ae2f33f5d768bc32003d557a083..cd7af3be9b5ee2687c09476920d8844e38db139e 100644 (file)
@@ -802,7 +802,7 @@ fn visit_item_kind(&mut self, i: &mut ast::ItemKind) {
     fn flat_map_trait_item(&mut self, i: ast::TraitItem) -> SmallVec<[ast::TraitItem; 1]> {
         let is_const = match i.kind {
             ast::TraitItemKind::Const(..) => true,
-            ast::TraitItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) =>
+            ast::TraitItemKind::Method(ast::FnSig { ref decl, ref header, .. }, _) =>
                 header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl),
             _ => false,
         };
@@ -812,7 +812,7 @@ fn visit_item_kind(&mut self, i: &mut ast::ItemKind) {
     fn flat_map_impl_item(&mut self, i: ast::ImplItem) -> SmallVec<[ast::ImplItem; 1]> {
         let is_const = match i.kind {
             ast::ImplItemKind::Const(..) => true,
-            ast::ImplItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) =>
+            ast::ImplItemKind::Method(ast::FnSig { ref decl, ref header, .. }, _) =>
                 header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl),
             _ => false,
         };
index 5c5fbcc07de4c9db39ca1c0c651f4e55ee5d5292..883d896456421b001145b21cfdac7041e086ec4a 100644 (file)
@@ -272,7 +272,7 @@ fn process_formals(&mut self, formals: &'l [ast::Param], qualname: &str) {
 
     fn process_method(
         &mut self,
-        sig: &'l ast::MethodSig,
+        sig: &'l ast::FnSig,
         body: Option<&'l ast::Block>,
         id: ast::NodeId,
         ident: ast::Ident,
index 019e92717b5d67e8b91970a4f7e4b353a92b22c1..887aeb03b8957de6e7530bc83c4401d7a303f3f9 100644 (file)
@@ -72,7 +72,7 @@ pub fn method_signature(
     id: NodeId,
     ident: ast::Ident,
     generics: &ast::Generics,
-    m: &ast::MethodSig,
+    m: &ast::FnSig,
     scx: &SaveContext<'_, '_>,
 ) -> Option<Signature> {
     if !scx.config.signatures {
@@ -932,7 +932,7 @@ fn make_method_signature(
     id: NodeId,
     ident: ast::Ident,
     generics: &ast::Generics,
-    m: &ast::MethodSig,
+    m: &ast::FnSig,
     scx: &SaveContext<'_, '_>,
 ) -> Result {
     // FIXME code dup with function signature
index 18151a1586c932eefd3ec57bdbf18f42b5733e2e..86a353cdfd2f60afb15dc8e9d4bdb21d62c7a0f7 100644 (file)
@@ -1501,10 +1501,10 @@ pub struct MutTy {
     pub mutbl: Mutability,
 }
 
-/// Represents a method's signature in a trait declaration,
-/// or in an implementation.
+/// Represents a function's signature in a trait declaration,
+/// trait implementation, or free function.
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
-pub struct MethodSig {
+pub struct FnSig {
     pub header: FnHeader,
     pub decl: P<FnDecl>,
 }
@@ -1528,7 +1528,7 @@ pub struct TraitItem {
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum TraitItemKind {
     Const(P<Ty>, Option<P<Expr>>),
-    Method(MethodSig, Option<P<Block>>),
+    Method(FnSig, Option<P<Block>>),
     Type(GenericBounds, Option<P<Ty>>),
     Macro(Mac),
 }
@@ -1552,7 +1552,7 @@ pub struct ImplItem {
 #[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
 pub enum ImplItemKind {
     Const(P<Ty>, P<Expr>),
-    Method(MethodSig, P<Block>),
+    Method(FnSig, P<Block>),
     TyAlias(P<Ty>),
     OpaqueTy(GenericBounds),
     Macro(Mac),
index 0c90652526d8078131aa3f3f06382b59cf234c52..f2ad7dea73b2b3a671b466c594917f466d29f60e 100644 (file)
@@ -357,7 +357,7 @@ pub fn visit_bounds<T: MutVisitor>(bounds: &mut GenericBounds, vis: &mut T) {
 }
 
 // No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
-pub fn visit_method_sig<T: MutVisitor>(MethodSig { header, decl }: &mut MethodSig, vis: &mut T) {
+pub fn visit_method_sig<T: MutVisitor>(FnSig { header, decl }: &mut FnSig, vis: &mut T) {
     vis.visit_fn_header(header);
     vis.visit_fn_decl(decl);
 }
index 3c618d75d348fdcf67bd06f21b65cb7d543fc7c0..500e70ae8e5c8eab51e30f041a5c36459e2a2eab 100644 (file)
@@ -8,7 +8,7 @@
 use crate::ast::{PathSegment, IsAuto, Constness, IsAsync, Unsafety, Defaultness};
 use crate::ast::{Visibility, VisibilityKind, Mutability, FnHeader, ForeignItem, ForeignItemKind};
 use crate::ast::{Ty, TyKind, Generics, GenericBounds, TraitRef, EnumDef, VariantData, StructField};
-use crate::ast::{Mac, MacDelimiter, Block, BindingMode, FnDecl, MethodSig, SelfKind, Param};
+use crate::ast::{Mac, MacDelimiter, Block, BindingMode, FnDecl, FnSig, SelfKind, Param};
 use crate::parse::token;
 use crate::tokenstream::{TokenTree, TokenStream};
 use crate::symbol::{kw, sym};
@@ -1897,14 +1897,14 @@ fn parse_trait_method_body(
     fn parse_method_sig(
         &mut self,
         is_name_required: fn(&token::Token) -> bool,
-    ) -> PResult<'a, (Ident, MethodSig, Generics)> {
+    ) -> PResult<'a, (Ident, FnSig, Generics)> {
         let header = self.parse_fn_front_matter()?;
         let (ident, decl, generics) = self.parse_fn_sig(ParamCfg {
             is_self_allowed: true,
             allow_c_variadic: false,
             is_name_required,
         })?;
-        Ok((ident, MethodSig { header, decl }, generics))
+        Ok((ident, FnSig { header, decl }, generics))
     }
 
     /// Parses all the "front matter" for a `fn` declaration, up to
index 4ca4bdeb046546353afddcbfd9bff098325b733d..e7335a00cb088fb7d30ee91688fdb0fa95c06396 100644 (file)
@@ -1541,7 +1541,7 @@ fn print_poly_trait_ref(&mut self, t: &ast::PolyTraitRef) {
     crate fn print_method_sig(&mut self,
                             ident: ast::Ident,
                             generics: &ast::Generics,
-                            m: &ast::MethodSig,
+                            m: &ast::FnSig,
                             vis: &ast::Visibility)
                             {
         self.print_fn(&m.decl,
index cfd160fd57751d01b3a4080e88730bec14066b62..e2983db4318e4ccf42654856a9901385fa4e3c40 100644 (file)
@@ -25,7 +25,7 @@ pub enum FnKind<'a> {
     ItemFn(Ident, &'a FnHeader, &'a Visibility, &'a Block),
 
     /// E.g., `fn foo(&self)`.
-    Method(Ident, &'a MethodSig, Option<&'a Visibility>, &'a Block),
+    Method(Ident, &'a FnSig, Option<&'a Visibility>, &'a Block),
 
     /// E.g., `|x, y| body`.
     Closure(&'a Expr),
index b18fd50ae7605288ba6f959e1e5972bb7a295131..b24306def7482941591fbdbd6692aeb15dc35c11 100644 (file)
@@ -950,7 +950,7 @@ fn create_method(&self,
 
         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),