fix: correct span for structs with const generics

This commit is contained in:
Caleb Cartwright 2023-01-23 10:54:05 -06:00 committed by Yacin Tmimi
parent ee2bed96d6
commit aae222c974
2 changed files with 9 additions and 1 deletions

View File

@ -1245,7 +1245,7 @@ fn format_unit_struct(
) -> Option<String> {
let header_str = format_header(context, p.prefix, p.ident, p.vis, offset);
let generics_str = if let Some(generics) = p.generics {
let hi = context.snippet_provider.span_before(p.span, ";");
let hi = context.snippet_provider.span_before_last(p.span, ";");
format_generics(
context,
generics,

View File

@ -0,0 +1,8 @@
type Foo = impl Send;
struct Struct<
const C: usize = {
let _: Foo = ();
//~^ ERROR: mismatched types
0
},
>;