Skip to content

Commit 2cd48e8

Browse files
committed
ast::MethodSig -> ast::FnSig
1 parent 27511b2 commit 2cd48e8

File tree

11 files changed

+19
-19
lines changed

11 files changed

+19
-19
lines changed

src/librustc/hir/lowering/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ impl LoweringContext<'_> {
12551255
fn lower_method_sig(
12561256
&mut self,
12571257
generics: &Generics,
1258-
sig: &MethodSig,
1258+
sig: &FnSig,
12591259
fn_def_id: DefId,
12601260
impl_trait_return_allow: bool,
12611261
is_async: Option<NodeId>,

src/librustc/hir/map/def_collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
228228

229229
fn visit_impl_item(&mut self, ii: &'a ImplItem) {
230230
let def_data = match ii.kind {
231-
ImplItemKind::Method(MethodSig {
231+
ImplItemKind::Method(FnSig {
232232
ref header,
233233
ref decl,
234234
}, ref body) if header.asyncness.node.is_async() => {

src/librustc_interface/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> {
802802
fn flat_map_trait_item(&mut self, i: ast::TraitItem) -> SmallVec<[ast::TraitItem; 1]> {
803803
let is_const = match i.kind {
804804
ast::TraitItemKind::Const(..) => true,
805-
ast::TraitItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) =>
805+
ast::TraitItemKind::Method(ast::FnSig { ref decl, ref header, .. }, _) =>
806806
header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl),
807807
_ => false,
808808
};
@@ -812,7 +812,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> {
812812
fn flat_map_impl_item(&mut self, i: ast::ImplItem) -> SmallVec<[ast::ImplItem; 1]> {
813813
let is_const = match i.kind {
814814
ast::ImplItemKind::Const(..) => true,
815-
ast::ImplItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) =>
815+
ast::ImplItemKind::Method(ast::FnSig { ref decl, ref header, .. }, _) =>
816816
header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl),
817817
_ => false,
818818
};

src/librustc_save_analysis/dump_visitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> {
272272

273273
fn process_method(
274274
&mut self,
275-
sig: &'l ast::MethodSig,
275+
sig: &'l ast::FnSig,
276276
body: Option<&'l ast::Block>,
277277
id: ast::NodeId,
278278
ident: ast::Ident,

src/librustc_save_analysis/sig.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub fn method_signature(
7272
id: NodeId,
7373
ident: ast::Ident,
7474
generics: &ast::Generics,
75-
m: &ast::MethodSig,
75+
m: &ast::FnSig,
7676
scx: &SaveContext<'_, '_>,
7777
) -> Option<Signature> {
7878
if !scx.config.signatures {
@@ -932,7 +932,7 @@ fn make_method_signature(
932932
id: NodeId,
933933
ident: ast::Ident,
934934
generics: &ast::Generics,
935-
m: &ast::MethodSig,
935+
m: &ast::FnSig,
936936
scx: &SaveContext<'_, '_>,
937937
) -> Result {
938938
// FIXME code dup with function signature

src/libsyntax/ast.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1501,10 +1501,10 @@ pub struct MutTy {
15011501
pub mutbl: Mutability,
15021502
}
15031503

1504-
/// Represents a method's signature in a trait declaration,
1505-
/// or in an implementation.
1504+
/// Represents a function's signature in a trait declaration,
1505+
/// trait implementation, or free function.
15061506
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
1507-
pub struct MethodSig {
1507+
pub struct FnSig {
15081508
pub header: FnHeader,
15091509
pub decl: P<FnDecl>,
15101510
}
@@ -1528,7 +1528,7 @@ pub struct TraitItem {
15281528
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
15291529
pub enum TraitItemKind {
15301530
Const(P<Ty>, Option<P<Expr>>),
1531-
Method(MethodSig, Option<P<Block>>),
1531+
Method(FnSig, Option<P<Block>>),
15321532
Type(GenericBounds, Option<P<Ty>>),
15331533
Macro(Mac),
15341534
}
@@ -1552,7 +1552,7 @@ pub struct ImplItem {
15521552
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
15531553
pub enum ImplItemKind {
15541554
Const(P<Ty>, P<Expr>),
1555-
Method(MethodSig, P<Block>),
1555+
Method(FnSig, P<Block>),
15561556
TyAlias(P<Ty>),
15571557
OpaqueTy(GenericBounds),
15581558
Macro(Mac),

src/libsyntax/mut_visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ pub fn visit_bounds<T: MutVisitor>(bounds: &mut GenericBounds, vis: &mut T) {
357357
}
358358

359359
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
360-
pub fn visit_method_sig<T: MutVisitor>(MethodSig { header, decl }: &mut MethodSig, vis: &mut T) {
360+
pub fn visit_method_sig<T: MutVisitor>(FnSig { header, decl }: &mut FnSig, vis: &mut T) {
361361
vis.visit_fn_header(header);
362362
vis.visit_fn_decl(decl);
363363
}

src/libsyntax/parse/parser/item.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::ast::{ItemKind, ImplItem, ImplItemKind, TraitItem, TraitItemKind, Use
88
use crate::ast::{PathSegment, IsAuto, Constness, IsAsync, Unsafety, Defaultness};
99
use crate::ast::{Visibility, VisibilityKind, Mutability, FnHeader, ForeignItem, ForeignItemKind};
1010
use crate::ast::{Ty, TyKind, Generics, GenericBounds, TraitRef, EnumDef, VariantData, StructField};
11-
use crate::ast::{Mac, MacDelimiter, Block, BindingMode, FnDecl, MethodSig, SelfKind, Param};
11+
use crate::ast::{Mac, MacDelimiter, Block, BindingMode, FnDecl, FnSig, SelfKind, Param};
1212
use crate::parse::token;
1313
use crate::tokenstream::{TokenTree, TokenStream};
1414
use crate::symbol::{kw, sym};
@@ -1897,14 +1897,14 @@ impl<'a> Parser<'a> {
18971897
fn parse_method_sig(
18981898
&mut self,
18991899
is_name_required: fn(&token::Token) -> bool,
1900-
) -> PResult<'a, (Ident, MethodSig, Generics)> {
1900+
) -> PResult<'a, (Ident, FnSig, Generics)> {
19011901
let header = self.parse_fn_front_matter()?;
19021902
let (ident, decl, generics) = self.parse_fn_sig(ParamCfg {
19031903
is_self_allowed: true,
19041904
allow_c_variadic: false,
19051905
is_name_required,
19061906
})?;
1907-
Ok((ident, MethodSig { header, decl }, generics))
1907+
Ok((ident, FnSig { header, decl }, generics))
19081908
}
19091909

19101910
/// Parses all the "front matter" for a `fn` declaration, up to

src/libsyntax/print/pprust.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1541,7 +1541,7 @@ impl<'a> State<'a> {
15411541
crate fn print_method_sig(&mut self,
15421542
ident: ast::Ident,
15431543
generics: &ast::Generics,
1544-
m: &ast::MethodSig,
1544+
m: &ast::FnSig,
15451545
vis: &ast::Visibility)
15461546
{
15471547
self.print_fn(&m.decl,

src/libsyntax/visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub enum FnKind<'a> {
2525
ItemFn(Ident, &'a FnHeader, &'a Visibility, &'a Block),
2626

2727
/// E.g., `fn foo(&self)`.
28-
Method(Ident, &'a MethodSig, Option<&'a Visibility>, &'a Block),
28+
Method(Ident, &'a FnSig, Option<&'a Visibility>, &'a Block),
2929

3030
/// E.g., `|x, y| body`.
3131
Closure(&'a Expr),

src/libsyntax_ext/deriving/generic/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ impl<'a> MethodDef<'a> {
950950

951951
let trait_lo_sp = trait_.span.shrink_to_lo();
952952

953-
let sig = ast::MethodSig {
953+
let sig = ast::FnSig {
954954
header: ast::FnHeader {
955955
unsafety,
956956
abi: Abi::new(abi, trait_lo_sp),

0 commit comments

Comments
 (0)