Skip to content

Commit 1b9ccbf

Browse files
committed
Don't pass spans in hir::map::blocks.
1 parent 3640fb3 commit 1b9ccbf

File tree

1 file changed

+9
-28
lines changed

1 file changed

+9
-28
lines changed

src/librustc_middle/hir/map/blocks.rs

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use rustc_hir as hir;
1717
use rustc_hir::intravisit::FnKind;
1818
use rustc_hir::{Expr, FnDecl, Node};
1919
use rustc_span::symbol::Ident;
20-
use rustc_span::Span;
2120

2221
/// An FnLikeNode is a Node that is like a fn, in that it has a decl
2322
/// and a body (as well as a NodeId, a span, etc).
@@ -116,7 +115,6 @@ struct ItemFnParts<'a> {
116115
generics: &'a hir::Generics<'a>,
117116
body: hir::BodyId,
118117
id: hir::HirId,
119-
span: Span,
120118
attrs: &'a [Attribute],
121119
}
122120

@@ -126,19 +124,12 @@ struct ClosureParts<'a> {
126124
decl: &'a FnDecl<'a>,
127125
body: hir::BodyId,
128126
id: hir::HirId,
129-
span: Span,
130127
attrs: &'a [Attribute],
131128
}
132129

133130
impl<'a> ClosureParts<'a> {
134-
fn new(
135-
d: &'a FnDecl<'a>,
136-
b: hir::BodyId,
137-
id: hir::HirId,
138-
s: Span,
139-
attrs: &'a [Attribute],
140-
) -> Self {
141-
ClosureParts { decl: d, body: b, id, span: s, attrs }
131+
fn new(d: &'a FnDecl<'a>, b: hir::BodyId, id: hir::HirId, attrs: &'a [Attribute]) -> Self {
132+
ClosureParts { decl: d, body: b, id, attrs }
142133
}
143134
}
144135

@@ -158,31 +149,23 @@ impl<'a> FnLikeNode<'a> {
158149
pub fn body(self) -> hir::BodyId {
159150
self.handle(
160151
|i: ItemFnParts<'a>| i.body,
161-
|_, _, _: &'a hir::FnSig<'a>, _, body: hir::BodyId, _, _| body,
152+
|_, _, _: &'a hir::FnSig<'a>, _, body: hir::BodyId, _| body,
162153
|c: ClosureParts<'a>| c.body,
163154
)
164155
}
165156

166157
pub fn decl(self) -> &'a FnDecl<'a> {
167158
self.handle(
168159
|i: ItemFnParts<'a>| &*i.decl,
169-
|_, _, sig: &'a hir::FnSig<'a>, _, _, _, _| &sig.decl,
160+
|_, _, sig: &'a hir::FnSig<'a>, _, _, _| &sig.decl,
170161
|c: ClosureParts<'a>| c.decl,
171162
)
172163
}
173164

174-
pub fn span(self) -> Span {
175-
self.handle(
176-
|i: ItemFnParts<'_>| i.span,
177-
|_, _, _: &'a hir::FnSig<'a>, _, _, span, _| span,
178-
|c: ClosureParts<'_>| c.span,
179-
)
180-
}
181-
182165
pub fn id(self) -> hir::HirId {
183166
self.handle(
184167
|i: ItemFnParts<'_>| i.id,
185-
|id, _, _: &'a hir::FnSig<'a>, _, _, _, _| id,
168+
|id, _, _: &'a hir::FnSig<'a>, _, _, _| id,
186169
|c: ClosureParts<'_>| c.id,
187170
)
188171
}
@@ -204,7 +187,7 @@ impl<'a> FnLikeNode<'a> {
204187
FnKind::ItemFn(p.ident, p.generics, p.header, p.vis, p.attrs)
205188
};
206189
let closure = |c: ClosureParts<'a>| FnKind::Closure(c.attrs);
207-
let method = |_, ident: Ident, sig: &'a hir::FnSig<'a>, vis, _, _, attrs| {
190+
let method = |_, ident: Ident, sig: &'a hir::FnSig<'a>, vis, _, attrs| {
208191
FnKind::Method(ident, sig, vis, attrs)
209192
};
210193
self.handle(item, method, closure)
@@ -219,7 +202,6 @@ impl<'a> FnLikeNode<'a> {
219202
&'a hir::FnSig<'a>,
220203
Option<&'a hir::Visibility<'a>>,
221204
hir::BodyId,
222-
Span,
223205
&'a [Attribute],
224206
) -> A,
225207
C: FnOnce(ClosureParts<'a>) -> A,
@@ -232,7 +214,6 @@ impl<'a> FnLikeNode<'a> {
232214
decl: &sig.decl,
233215
body: block,
234216
vis: &i.vis,
235-
span: i.span,
236217
attrs: &i.attrs,
237218
header: sig.header,
238219
generics,
@@ -241,19 +222,19 @@ impl<'a> FnLikeNode<'a> {
241222
},
242223
Node::TraitItem(ti) => match ti.kind {
243224
hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Provided(body)) => {
244-
method(ti.hir_id, ti.ident, sig, None, body, ti.span, &ti.attrs)
225+
method(ti.hir_id, ti.ident, sig, None, body, &ti.attrs)
245226
}
246227
_ => bug!("trait method FnLikeNode that is not fn-like"),
247228
},
248229
Node::ImplItem(ii) => match ii.kind {
249230
hir::ImplItemKind::Fn(ref sig, body) => {
250-
method(ii.hir_id, ii.ident, sig, Some(&ii.vis), body, ii.span, &ii.attrs)
231+
method(ii.hir_id, ii.ident, sig, Some(&ii.vis), body, &ii.attrs)
251232
}
252233
_ => bug!("impl method FnLikeNode that is not fn-like"),
253234
},
254235
Node::Expr(e) => match e.kind {
255236
hir::ExprKind::Closure(_, ref decl, block, _fn_decl_span, _gen) => {
256-
closure(ClosureParts::new(&decl, block, e.hir_id, e.span, &e.attrs))
237+
closure(ClosureParts::new(&decl, block, e.hir_id, &e.attrs))
257238
}
258239
_ => bug!("expr FnLikeNode that is not fn-like"),
259240
},

0 commit comments

Comments
 (0)