Skip to content

Commit

Permalink
ast::MethodSig -> ast::FnSig
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Nov 8, 2019
1 parent 27511b2 commit 2cd48e8
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/librustc/hir/lowering/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,7 @@ impl LoweringContext<'_> {
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>,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/def_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {

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() => {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_interface/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> {
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,
};
Expand All @@ -812,7 +812,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> {
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,
};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_save_analysis/dump_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> {

fn process_method(
&mut self,
sig: &'l ast::MethodSig,
sig: &'l ast::FnSig,
body: Option<&'l ast::Block>,
id: ast::NodeId,
ident: ast::Ident,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_save_analysis/sig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
}
Expand All @@ -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),
}
Expand All @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/mut_visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions src/libsyntax/parse/parser/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::ast::{ItemKind, ImplItem, ImplItemKind, TraitItem, TraitItemKind, Use
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};
Expand Down Expand Up @@ -1897,14 +1897,14 @@ impl<'a> Parser<'a> {
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
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ impl<'a> State<'a> {
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,
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax_ext/deriving/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 2cd48e8

Please sign in to comment.