Skip to content

Commit 0d98c91

Browse files
committed
Don't pass spans in hir::map::blocks.
1 parent e69a8df commit 0d98c91

File tree

1 file changed

+9
-28
lines changed

1 file changed

+9
-28
lines changed

compiler/rustc_middle/src/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).
@@ -104,7 +103,6 @@ struct ItemFnParts<'a> {
104103
generics: &'a hir::Generics<'a>,
105104
body: hir::BodyId,
106105
id: hir::HirId,
107-
span: Span,
108106
attrs: &'a [Attribute],
109107
}
110108

@@ -114,19 +112,12 @@ struct ClosureParts<'a> {
114112
decl: &'a FnDecl<'a>,
115113
body: hir::BodyId,
116114
id: hir::HirId,
117-
span: Span,
118115
attrs: &'a [Attribute],
119116
}
120117

121118
impl<'a> ClosureParts<'a> {
122-
fn new(
123-
d: &'a FnDecl<'a>,
124-
b: hir::BodyId,
125-
id: hir::HirId,
126-
s: Span,
127-
attrs: &'a [Attribute],
128-
) -> Self {
129-
ClosureParts { decl: d, body: b, id, span: s, attrs }
119+
fn new(d: &'a FnDecl<'a>, b: hir::BodyId, id: hir::HirId, attrs: &'a [Attribute]) -> Self {
120+
ClosureParts { decl: d, body: b, id, attrs }
130121
}
131122
}
132123

@@ -146,31 +137,23 @@ impl<'a> FnLikeNode<'a> {
146137
pub fn body(self) -> hir::BodyId {
147138
self.handle(
148139
|i: ItemFnParts<'a>| i.body,
149-
|_, _, _: &'a hir::FnSig<'a>, _, body: hir::BodyId, _, _| body,
140+
|_, _, _: &'a hir::FnSig<'a>, _, body: hir::BodyId, _| body,
150141
|c: ClosureParts<'a>| c.body,
151142
)
152143
}
153144

154145
pub fn decl(self) -> &'a FnDecl<'a> {
155146
self.handle(
156147
|i: ItemFnParts<'a>| &*i.decl,
157-
|_, _, sig: &'a hir::FnSig<'a>, _, _, _, _| &sig.decl,
148+
|_, _, sig: &'a hir::FnSig<'a>, _, _, _| &sig.decl,
158149
|c: ClosureParts<'a>| c.decl,
159150
)
160151
}
161152

162-
pub fn span(self) -> Span {
163-
self.handle(
164-
|i: ItemFnParts<'_>| i.span,
165-
|_, _, _: &'a hir::FnSig<'a>, _, _, span, _| span,
166-
|c: ClosureParts<'_>| c.span,
167-
)
168-
}
169-
170153
pub fn id(self) -> hir::HirId {
171154
self.handle(
172155
|i: ItemFnParts<'_>| i.id,
173-
|id, _, _: &'a hir::FnSig<'a>, _, _, _, _| id,
156+
|id, _, _: &'a hir::FnSig<'a>, _, _, _| id,
174157
|c: ClosureParts<'_>| c.id,
175158
)
176159
}
@@ -192,7 +175,7 @@ impl<'a> FnLikeNode<'a> {
192175
FnKind::ItemFn(p.ident, p.generics, p.header, p.vis, p.attrs)
193176
};
194177
let closure = |c: ClosureParts<'a>| FnKind::Closure(c.attrs);
195-
let method = |_, ident: Ident, sig: &'a hir::FnSig<'a>, vis, _, _, attrs| {
178+
let method = |_, ident: Ident, sig: &'a hir::FnSig<'a>, vis, _, attrs| {
196179
FnKind::Method(ident, sig, vis, attrs)
197180
};
198181
self.handle(item, method, closure)
@@ -207,7 +190,6 @@ impl<'a> FnLikeNode<'a> {
207190
&'a hir::FnSig<'a>,
208191
Option<&'a hir::Visibility<'a>>,
209192
hir::BodyId,
210-
Span,
211193
&'a [Attribute],
212194
) -> A,
213195
C: FnOnce(ClosureParts<'a>) -> A,
@@ -220,7 +202,6 @@ impl<'a> FnLikeNode<'a> {
220202
decl: &sig.decl,
221203
body: block,
222204
vis: &i.vis,
223-
span: i.span,
224205
attrs: &i.attrs,
225206
header: sig.header,
226207
generics,
@@ -229,19 +210,19 @@ impl<'a> FnLikeNode<'a> {
229210
},
230211
Node::TraitItem(ti) => match ti.kind {
231212
hir::TraitItemKind::Fn(ref sig, hir::TraitFn::Provided(body)) => {
232-
method(ti.hir_id, ti.ident, sig, None, body, ti.span, &ti.attrs)
213+
method(ti.hir_id, ti.ident, sig, None, body, &ti.attrs)
233214
}
234215
_ => bug!("trait method FnLikeNode that is not fn-like"),
235216
},
236217
Node::ImplItem(ii) => match ii.kind {
237218
hir::ImplItemKind::Fn(ref sig, body) => {
238-
method(ii.hir_id, ii.ident, sig, Some(&ii.vis), body, ii.span, &ii.attrs)
219+
method(ii.hir_id, ii.ident, sig, Some(&ii.vis), body, &ii.attrs)
239220
}
240221
_ => bug!("impl method FnLikeNode that is not fn-like"),
241222
},
242223
Node::Expr(e) => match e.kind {
243224
hir::ExprKind::Closure(_, ref decl, block, _fn_decl_span, _gen) => {
244-
closure(ClosureParts::new(&decl, block, e.hir_id, e.span, &e.attrs))
225+
closure(ClosureParts::new(&decl, block, e.hir_id, &e.attrs))
245226
}
246227
_ => bug!("expr FnLikeNode that is not fn-like"),
247228
},

0 commit comments

Comments
 (0)