Skip to content

Commit a1b12d8

Browse files
committed
Remove span from hir::Param.
1 parent 61402a5 commit a1b12d8

File tree

8 files changed

+9
-10
lines changed

8 files changed

+9
-10
lines changed

src/librustc_ast_lowering/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
527527
Ident::with_dummy_span(sym::_task_context),
528528
hir::BindingAnnotation::Mutable,
529529
);
530-
let param = hir::Param { attrs: &[], hir_id: self.next_id(span), pat, span };
530+
let param = hir::Param { attrs: &[], hir_id: self.next_id(span), pat };
531531
let params = arena_vec![self; param];
532532

533533
let body_id = self.lower_body(move |this| {

src/librustc_ast_lowering/item.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
979979
attrs: self.lower_attrs(&param.attrs),
980980
hir_id: self.lower_node_id(param.id, param.span),
981981
pat: self.lower_pat(&param.pat),
982-
span: param.span,
983982
}
984983
}
985984

@@ -1105,7 +1104,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
11051104
attrs: parameter.attrs,
11061105
hir_id: parameter.hir_id,
11071106
pat: new_parameter_pat,
1108-
span: parameter.span,
11091107
};
11101108

11111109
if is_simple_parameter {

src/librustc_hir/hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2158,7 +2158,6 @@ pub struct Param<'hir> {
21582158
pub attrs: &'hir [Attribute],
21592159
pub hir_id: HirId,
21602160
pub pat: &'hir Pat<'hir>,
2161-
pub span: Span,
21622161
}
21632162

21642163
/// Represents the header (not the body) of a function declaration.

src/librustc_middle/hir/map/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
336336

337337
fn visit_param(&mut self, param: &'hir Param<'hir>) {
338338
let node = Node::Param(param);
339-
self.insert(param.span, param.hir_id, node);
339+
self.insert(DUMMY_SP, param.hir_id, node);
340340
self.with_parent(param.hir_id, |this| {
341341
intravisit::walk_param(this, param);
342342
});

src/librustc_mir_build/build/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,9 @@ fn mir_build(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Body<'_> {
127127
// C-variadic fns also have a `VaList` input that's not listed in `fn_sig`
128128
// (as it's created inside the body itself, not passed in from outside).
129129
let ty = if fn_sig.c_variadic && index == fn_sig.inputs().len() {
130+
let span = tcx.hir().span(arg.hir_id);
130131
let va_list_did =
131-
tcx.require_lang_item(lang_items::VaListTypeLangItem, Some(arg.span));
132+
tcx.require_lang_item(lang_items::VaListTypeLangItem, Some(span));
132133

133134
tcx.type_of(va_list_did).subst(tcx, &[tcx.lifetimes.re_erased.into()])
134135
} else {

src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@ fn check_fn<'a, 'tcx>(
13271327
// C-variadic fns also have a `VaList` input that's not listed in `fn_sig`
13281328
// (as it's created inside the body itself, not passed in from outside).
13291329
let maybe_va_list = if fn_sig.c_variadic {
1330-
let span = body.params.last().unwrap().span;
1330+
let span = tcx.hir().span(body.params.last().unwrap().hir_id);
13311331
let va_list_did = tcx.require_lang_item(VaListTypeLangItem, Some(span));
13321332
let region = fcx.next_region_var(RegionVariableOrigin::MiscVariable(span));
13331333

src/librustc_typeck/check/pat.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,10 +606,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
606606
let binding_parent = tcx.hir().get(binding_parent_id);
607607
debug!("inner {:?} pat {:?} parent {:?}", inner, pat, binding_parent);
608608
match binding_parent {
609-
hir::Node::Param(hir::Param { span, .. }) => {
609+
hir::Node::Param(hir::Param { hir_id, .. }) => {
610+
let span = tcx.hir().span(*hir_id);
610611
if let Ok(snippet) = tcx.sess.source_map().span_to_snippet(inner.span) {
611612
err.span_suggestion(
612-
*span,
613+
span,
613614
&format!("did you mean `{}`", snippet),
614615
format!(" &{}", expected),
615616
Applicability::MachineApplicable,

src/tools/clippy/clippy_lints/src/unused_self.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedSelf {
6767
span_lint_and_help(
6868
cx,
6969
UNUSED_SELF,
70-
self_param.span,
70+
cx.tcx.hir().span(self_param.hir_id),
7171
"unused `self` argument",
7272
None,
7373
"consider refactoring to a associated function",

0 commit comments

Comments
 (0)