fix: adjust span derivation for const generics

This commit is contained in:
Caleb Cartwright 2023-10-08 17:24:25 -05:00 committed by Yacin Tmimi
parent 268716b85e
commit 2707103154
3 changed files with 18 additions and 1 deletions

View file

@ -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,

View file

@ -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,
}

View file

@ -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,
}