Skip to content

Commit

Permalink
fix: adjust span derivation for const generics
Browse files Browse the repository at this point in the history
  • Loading branch information
calebcartwright authored and ytmimi committed Oct 8, 2023
1 parent 268716b commit 27da212
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3244,7 +3244,7 @@ fn format_generics(
if brace_pos == BracePos::None {
span.hi()
} else {
context.snippet_provider.span_before(span, "{")
context.snippet_provider.span_before_last(span, "{")
},
),
shape,
Expand Down
9 changes: 9 additions & 0 deletions tests/source/issue-5935.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
struct Regs<
const BEGIN: u64,
const END: u64,
const DIM: usize,
const N: usize = { (END - BEGIN) as usize / (8 * DIM) + 1 },
>
{
_foo: u64,
}
8 changes: 8 additions & 0 deletions tests/target/issue-5935.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
struct Regs<
const BEGIN: u64,
const END: u64,
const DIM: usize,
const N: usize = { (END - BEGIN) as usize / (8 * DIM) + 1 },
> {
_foo: u64,
}

0 comments on commit 27da212

Please sign in to comment.