Skip to content

Commit aae0707

Browse files
committed
add span to struct pattern rest (..)
1 parent 8df154b commit aae0707

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

compiler/rustc_ast/src/ast.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ pub enum PatKind {
937937
#[derive(Clone, Copy, Encodable, Decodable, Debug, PartialEq, Walkable)]
938938
pub enum PatFieldsRest {
939939
/// `module::StructName { field, ..}`
940-
Rest,
940+
Rest(Span),
941941
/// `module::StructName { field, syntax error }`
942942
Recovered(ErrorGuaranteed),
943943
/// `module::StructName { field }`
@@ -4051,8 +4051,8 @@ mod size_asserts {
40514051
static_assert_size!(Local, 96);
40524052
static_assert_size!(MetaItemLit, 40);
40534053
static_assert_size!(Param, 40);
4054-
static_assert_size!(Pat, 72);
4055-
static_assert_size!(PatKind, 48);
4054+
static_assert_size!(Pat, 80);
4055+
static_assert_size!(PatKind, 56);
40564056
static_assert_size!(Path, 24);
40574057
static_assert_size!(PathSegment, 24);
40584058
static_assert_size!(Stmt, 32);

compiler/rustc_ast_lowering/src/pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
108108
fs,
109109
matches!(
110110
etc,
111-
ast::PatFieldsRest::Rest | ast::PatFieldsRest::Recovered(_)
111+
ast::PatFieldsRest::Rest(_) | ast::PatFieldsRest::Recovered(_)
112112
),
113113
);
114114
}

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1769,7 +1769,7 @@ impl<'a> State<'a> {
17691769
},
17701770
|f| f.pat.span,
17711771
);
1772-
if let ast::PatFieldsRest::Rest | ast::PatFieldsRest::Recovered(_) = etc {
1772+
if let ast::PatFieldsRest::Rest(_) | ast::PatFieldsRest::Recovered(_) = etc {
17731773
if !fields.is_empty() {
17741774
self.word_space(",");
17751775
}

compiler/rustc_parse/src/parser/pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ impl<'a> Parser<'a> {
15161516
|| self.check_noexpect(&token::DotDotDot)
15171517
|| self.check_keyword(exp!(Underscore))
15181518
{
1519-
etc = PatFieldsRest::Rest;
1519+
etc = PatFieldsRest::Rest(self.token.span);
15201520
let mut etc_sp = self.token.span;
15211521
if first_etc_and_maybe_comma_span.is_none() {
15221522
if let Some(comma_tok) =

compiler/rustc_resolve/src/late.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3922,7 +3922,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
39223922

39233923
fn record_patterns_with_skipped_bindings(&mut self, pat: &Pat, rest: &ast::PatFieldsRest) {
39243924
match rest {
3925-
ast::PatFieldsRest::Rest | ast::PatFieldsRest::Recovered(_) => {
3925+
ast::PatFieldsRest::Rest(_) | ast::PatFieldsRest::Recovered(_) => {
39263926
// Record that the pattern doesn't introduce all the bindings it could.
39273927
if let Some(partial_res) = self.r.partial_res_map.get(&pat.id)
39283928
&& let Some(res) = partial_res.full_res()

src/tools/rustfmt/src/patterns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl Rewrite for Pat {
303303
qself,
304304
path,
305305
fields,
306-
rest == ast::PatFieldsRest::Rest,
306+
matches!(rest, ast::PatFieldsRest::Rest(_)),
307307
self.span,
308308
context,
309309
shape,

0 commit comments

Comments
 (0)