diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-09-02 17:08:52 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-02 17:08:52 +0200 | 
| commit | af315b0725a00e52b74fddfd709b1bb7be7bebbd (patch) | |
| tree | 9af951545407c52b6ecfa012a64de587dc236bf2 /compiler/rustc_hir_pretty/src/lib.rs | |
| parent | ae0e7b97e0c3fa13def0bc60e70d1907c501662e (diff) | |
| parent | 75d8687f2b6ac1e73071450cb57c4157fcba53b4 (diff) | |
| download | rust-af315b0725a00e52b74fddfd709b1bb7be7bebbd.tar.gz rust-af315b0725a00e52b74fddfd709b1bb7be7bebbd.zip  | |
Rollup merge of #145783 - Erk-:et-cetera-span, r=compiler-errors
add span to struct pattern rest (..) Struct pattern rest (`..`) did not retain span information compared to normal fields. This patch adds span information for it. The motivation of this patch comes from when I implemented this PR for Clippy: https://github.com/rust-lang/rust-clippy/pull/15000#discussion_r2134145163 It is possible to get the span of the Et cetera in a bit roundabout way, but I thought this would be nicer.
Diffstat (limited to 'compiler/rustc_hir_pretty/src/lib.rs')
| -rw-r--r-- | compiler/rustc_hir_pretty/src/lib.rs | 4 | 
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index be5859b57c5..52b29e05dcb 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -1958,12 +1958,12 @@ impl<'a> State<'a> { self.print_qpath(qpath, true); self.nbsp(); self.word("{"); - let empty = fields.is_empty() && !etc; + let empty = fields.is_empty() && etc.is_none(); if !empty { self.space(); } self.commasep_cmnt(Consistent, fields, |s, f| s.print_patfield(f), |f| f.pat.span); - if etc { + if etc.is_some() { if !fields.is_empty() { self.word_space(","); }  | 
