Skip to content

Commit f2a6894

Browse files
ayazhafizytmimi
authored andcommitted
Backport 4220
Handle const generic bounds in structs
1 parent 7d6ca7c commit f2a6894

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/items.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,8 +1274,8 @@ pub(crate) fn format_struct_struct(
12741274

12751275
let header_hi = struct_parts.ident.span.hi();
12761276
let body_lo = if let Some(generics) = struct_parts.generics {
1277-
// Adjust the span to start at the end of the generic arguments before searching for the '{'
1278-
let span = span.with_lo(generics.span.hi());
1277+
// Adjust the span to start at the end of the where clause before searching for the '{'
1278+
let span = span.with_lo(generics.where_clause.span.hi());
12791279
context.snippet_provider.span_after(span, "{")
12801280
} else {
12811281
context.snippet_provider.span_after(span, "{")

tests/target/issue-4218.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub struct Arr
2+
where
3+
[u8; { 10 / 2 }]: Send, {}

0 commit comments

Comments
 (0)