Skip to content

Commit f94dac7

Browse files
committed
Remove span from hir::FieldPat.
1 parent 71c2c92 commit f94dac7

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/librustc_ast_lowering/pat.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
5858
ident: f.ident,
5959
pat: self.lower_pat(&f.pat),
6060
is_shorthand: f.is_shorthand,
61-
span: f.span,
6261
}));
6362
hir::PatKind::Struct(qpath, fs, etc)
6463
}

src/librustc_hir/hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,6 @@ pub struct FieldPat<'hir> {
827827
/// The pattern the field is destructured to.
828828
pub pat: &'hir Pat<'hir>,
829829
pub is_shorthand: bool,
830-
pub span: Span,
831830
}
832831

833832
/// Explicit binding annotations given in the HIR for a binding. Note

src/librustc_lint/builtin.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
171171
if fieldpat.is_shorthand {
172172
continue;
173173
}
174-
if fieldpat.span.from_expansion() {
174+
let fieldpat_span = cx.tcx.hir().span(fieldpat.hir_id);
175+
if fieldpat_span.from_expansion() {
175176
// Don't lint if this is a macro expansion: macro authors
176177
// shouldn't have to worry about this kind of style issue
177178
// (Issue #49588)
@@ -181,7 +182,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
181182
if cx.tcx.find_field_index(ident, &variant)
182183
== Some(cx.tcx.field_index(fieldpat.hir_id, cx.tables))
183184
{
184-
cx.struct_span_lint(NON_SHORTHAND_FIELD_PATTERNS, fieldpat.span, |lint| {
185+
cx.struct_span_lint(NON_SHORTHAND_FIELD_PATTERNS, fieldpat_span, |lint| {
185186
let mut err = lint
186187
.build(&format!("the `{}:` in this pattern is redundant", ident));
187188
let binding = match binding_annot {
@@ -196,7 +197,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonShorthandFieldPatterns {
196197
ident.to_string()
197198
};
198199
err.span_suggestion(
199-
fieldpat.span,
200+
fieldpat_span,
200201
"use shorthand field pattern",
201202
ident,
202203
Applicability::MachineApplicable,

src/librustc_privacy/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,8 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> {
11561156
for field in fields {
11571157
let use_ctxt = field.ident.span;
11581158
let index = self.tcx.field_index(field.hir_id, self.tables);
1159-
self.check_field(use_ctxt, field.span, adt, &variant.fields[index], false);
1159+
let field_span = self.tcx.hir().span(field.hir_id);
1160+
self.check_field(use_ctxt, field_span, adt, &variant.fields[index], false);
11601161
}
11611162
}
11621163

src/librustc_typeck/check/pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10481048
let mut inexistent_fields = vec![];
10491049
// Typecheck each field.
10501050
for field in fields {
1051-
let span = field.span;
1051+
let span = tcx.hir().span(field.hir_id);
10521052
let ident = tcx.adjust_ident(field.ident, variant.def_id);
10531053
let field_ty = match used_fields.entry(ident) {
10541054
Occupied(occupied) => {

0 commit comments

Comments
 (0)