Skip to content

Commit 27511b2

Browse files
committed
hir::MethodSig -> hir::FnSig
1 parent 30d7279 commit 27511b2

File tree

10 files changed

+26
-25
lines changed

10 files changed

+26
-25
lines changed

src/librustc/hir/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub enum FnKind<'a> {
4545
ItemFn(Ident, &'a Generics, FnHeader, &'a Visibility, &'a [Attribute]),
4646

4747
/// `fn foo(&self)`
48-
Method(Ident, &'a MethodSig, Option<&'a Visibility>, &'a [Attribute]),
48+
Method(Ident, &'a FnSig, Option<&'a Visibility>, &'a [Attribute]),
4949

5050
/// `|x, y| {}`
5151
Closure(&'a [Attribute]),

src/librustc/hir/lowering/item.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ impl LoweringContext<'_> {
328328
header.asyncness.node.opt_return_id()
329329
),
330330
);
331-
let sig = hir::MethodSig { decl, header: this.lower_fn_header(header) };
331+
let sig = hir::FnSig { decl, header: this.lower_fn_header(header) };
332332
hir::ItemKind::Fn(sig, generics, body_id)
333333
})
334334
}
@@ -1259,7 +1259,7 @@ impl LoweringContext<'_> {
12591259
fn_def_id: DefId,
12601260
impl_trait_return_allow: bool,
12611261
is_async: Option<NodeId>,
1262-
) -> (hir::Generics, hir::MethodSig) {
1262+
) -> (hir::Generics, hir::FnSig) {
12631263
let header = self.lower_fn_header(sig.header);
12641264
let (generics, decl) = self.add_in_band_defs(
12651265
generics,
@@ -1272,7 +1272,7 @@ impl LoweringContext<'_> {
12721272
is_async,
12731273
),
12741274
);
1275-
(generics, hir::MethodSig { header, decl })
1275+
(generics, hir::FnSig { header, decl })
12761276
}
12771277

12781278
fn lower_is_auto(&mut self, a: IsAuto) -> hir::IsAuto {

src/librustc/hir/map/blocks.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -158,25 +158,25 @@ impl<'a> FnLikeNode<'a> {
158158

159159
pub fn body(self) -> ast::BodyId {
160160
self.handle(|i: ItemFnParts<'a>| i.body,
161-
|_, _, _: &'a ast::MethodSig, _, body: ast::BodyId, _, _| body,
161+
|_, _, _: &'a ast::FnSig, _, body: ast::BodyId, _, _| body,
162162
|c: ClosureParts<'a>| c.body)
163163
}
164164

165165
pub fn decl(self) -> &'a FnDecl {
166166
self.handle(|i: ItemFnParts<'a>| &*i.decl,
167-
|_, _, sig: &'a ast::MethodSig, _, _, _, _| &sig.decl,
167+
|_, _, sig: &'a ast::FnSig, _, _, _, _| &sig.decl,
168168
|c: ClosureParts<'a>| c.decl)
169169
}
170170

171171
pub fn span(self) -> Span {
172172
self.handle(|i: ItemFnParts<'_>| i.span,
173-
|_, _, _: &'a ast::MethodSig, _, _, span, _| span,
173+
|_, _, _: &'a ast::FnSig, _, _, span, _| span,
174174
|c: ClosureParts<'_>| c.span)
175175
}
176176

177177
pub fn id(self) -> ast::HirId {
178178
self.handle(|i: ItemFnParts<'_>| i.id,
179-
|id, _, _: &'a ast::MethodSig, _, _, _, _| id,
179+
|id, _, _: &'a ast::FnSig, _, _, _, _| id,
180180
|c: ClosureParts<'_>| c.id)
181181
}
182182

@@ -199,7 +199,7 @@ impl<'a> FnLikeNode<'a> {
199199
let closure = |c: ClosureParts<'a>| {
200200
FnKind::Closure(c.attrs)
201201
};
202-
let method = |_, ident: Ident, sig: &'a ast::MethodSig, vis, _, _, attrs| {
202+
let method = |_, ident: Ident, sig: &'a ast::FnSig, vis, _, _, attrs| {
203203
FnKind::Method(ident, sig, vis, attrs)
204204
};
205205
self.handle(item, method, closure)
@@ -209,7 +209,7 @@ impl<'a> FnLikeNode<'a> {
209209
I: FnOnce(ItemFnParts<'a>) -> A,
210210
M: FnOnce(ast::HirId,
211211
Ident,
212-
&'a ast::MethodSig,
212+
&'a ast::FnSig,
213213
Option<&'a ast::Visibility>,
214214
ast::BodyId,
215215
Span,

src/librustc/hir/mod.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -1876,9 +1876,10 @@ pub struct MutTy {
18761876
pub mutbl: Mutability,
18771877
}
18781878

1879-
/// Represents a method's signature in a trait declaration or implementation.
1879+
/// Represents a function's signature in a trait declaration,
1880+
/// trait implementation, or a free function.
18801881
#[derive(RustcEncodable, RustcDecodable, Debug, HashStable)]
1881-
pub struct MethodSig {
1882+
pub struct FnSig {
18821883
pub header: FnHeader,
18831884
pub decl: P<FnDecl>,
18841885
}
@@ -1921,7 +1922,7 @@ pub enum TraitItemKind {
19211922
/// An associated constant with an optional value (otherwise `impl`s must contain a value).
19221923
Const(P<Ty>, Option<BodyId>),
19231924
/// A method with an optional body.
1924-
Method(MethodSig, TraitMethod),
1925+
Method(FnSig, TraitMethod),
19251926
/// An associated type with (possibly empty) bounds and optional concrete
19261927
/// type.
19271928
Type(GenericBounds, Option<P<Ty>>),
@@ -1955,7 +1956,7 @@ pub enum ImplItemKind {
19551956
/// of the expression.
19561957
Const(P<Ty>, BodyId),
19571958
/// A method implementation with the given signature and body.
1958-
Method(MethodSig, BodyId),
1959+
Method(FnSig, BodyId),
19591960
/// An associated type.
19601961
TyAlias(P<Ty>),
19611962
/// An associated `type = impl Trait`.
@@ -2534,7 +2535,7 @@ pub enum ItemKind {
25342535
/// A `const` item.
25352536
Const(P<Ty>, BodyId),
25362537
/// A function declaration.
2537-
Fn(MethodSig, Generics, BodyId),
2538+
Fn(FnSig, Generics, BodyId),
25382539
/// A module.
25392540
Mod(Mod),
25402541
/// An external module, e.g. `extern { .. }`.

src/librustc/hir/print.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ impl<'a> State<'a> {
835835
}
836836
pub fn print_method_sig(&mut self,
837837
ident: ast::Ident,
838-
m: &hir::MethodSig,
838+
m: &hir::FnSig,
839839
generics: &hir::Generics,
840840
vis: &hir::Visibility,
841841
arg_names: &[ast::Ident],

src/librustc_mir/build/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ pub fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> Body<'_> {
3232
Node::Expr(hir::Expr { kind: hir::ExprKind::Closure(_, decl, body_id, _, _), .. })
3333
| Node::Item(
3434
hir::Item {
35-
kind: hir::ItemKind::Fn(hir::MethodSig { decl, .. }, _, body_id),
35+
kind: hir::ItemKind::Fn(hir::FnSig { decl, .. }, _, body_id),
3636
..
3737
}
3838
)
3939
| Node::ImplItem(
4040
hir::ImplItem {
41-
kind: hir::ImplItemKind::Method(hir::MethodSig { decl, .. }, body_id),
41+
kind: hir::ImplItemKind::Method(hir::FnSig { decl, .. }, body_id),
4242
..
4343
}
4444
)
4545
| Node::TraitItem(
4646
hir::TraitItem {
4747
kind: hir::TraitItemKind::Method(
48-
hir::MethodSig { decl, .. },
48+
hir::FnSig { decl, .. },
4949
hir::TraitMethod::Provided(body_id),
5050
),
5151
..

src/librustc_mir/monomorphize/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ impl ItemLikeVisitor<'v> for RootCollector<'_, 'v> {
10711071

10721072
fn visit_impl_item(&mut self, ii: &'v hir::ImplItem) {
10731073
match ii.kind {
1074-
hir::ImplItemKind::Method(hir::MethodSig { .. }, _) => {
1074+
hir::ImplItemKind::Method(hir::FnSig { .. }, _) => {
10751075
let def_id = self.tcx.hir().local_def_id(ii.hir_id);
10761076
self.push_if_root(def_id);
10771077
}

src/librustc_typeck/check/wfcheck.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ fn check_associated_item(
190190
tcx: TyCtxt<'_>,
191191
item_id: hir::HirId,
192192
span: Span,
193-
sig_if_method: Option<&hir::MethodSig>,
193+
sig_if_method: Option<&hir::FnSig>,
194194
) {
195195
debug!("check_associated_item: {:?}", item_id);
196196

@@ -783,7 +783,7 @@ const HELP_FOR_SELF_TYPE: &str =
783783

784784
fn check_method_receiver<'fcx, 'tcx>(
785785
fcx: &FnCtxt<'fcx, 'tcx>,
786-
method_sig: &hir::MethodSig,
786+
fn_sig: &hir::FnSig,
787787
method: &ty::AssocItem,
788788
self_ty: Ty<'tcx>,
789789
) {
@@ -794,7 +794,7 @@ fn check_method_receiver<'fcx, 'tcx>(
794794
return;
795795
}
796796

797-
let span = method_sig.decl.inputs[0].span;
797+
let span = fn_sig.decl.inputs[0].span;
798798

799799
let sig = fcx.tcx.fn_sig(method.def_id);
800800
let sig = fcx.normalize_associated_types_in(span, &sig);

src/librustc_typeck/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1809,7 +1809,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
18091809
},
18101810

18111811
TraitItem(hir::TraitItem {
1812-
kind: TraitItemKind::Method(MethodSig { header, decl }, _),
1812+
kind: TraitItemKind::Method(FnSig { header, decl }, _),
18131813
..
18141814
}) => {
18151815
AstConv::ty_of_fn(&icx, header.unsafety, header.abi, decl)

src/librustdoc/clean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1984,7 +1984,7 @@ pub struct Method {
19841984
pub ret_types: Vec<Type>,
19851985
}
19861986

1987-
impl<'a> Clean<Method> for (&'a hir::MethodSig, &'a hir::Generics, hir::BodyId,
1987+
impl<'a> Clean<Method> for (&'a hir::FnSig, &'a hir::Generics, hir::BodyId,
19881988
Option<hir::Defaultness>) {
19891989
fn clean(&self, cx: &DocContext<'_>) -> Method {
19901990
let (generics, decl) = enter_impl_trait(cx, || {

0 commit comments

Comments
 (0)