File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1141,14 +1141,15 @@ pub(crate) fn format_trait(
11411141 }
11421142 result. push ( '{' ) ;
11431143
1144- let snippet = context. snippet ( item. span ) ;
1144+ let block_span = mk_sp ( generics. where_clause . span . hi ( ) , item. span . hi ( ) ) ;
1145+ let snippet = context. snippet ( block_span) ;
11451146 let open_pos = snippet. find_uncommented ( "{" ) ? + 1 ;
11461147 let outer_indent_str = offset. block_only ( ) . to_string_with_newline ( context. config ) ;
11471148
11481149 if !trait_items. is_empty ( ) || contains_comment ( & snippet[ open_pos..] ) {
11491150 let mut visitor = FmtVisitor :: from_context ( context) ;
11501151 visitor. block_indent = offset. block_only ( ) . block_indent ( context. config ) ;
1151- visitor. last_pos = item . span . lo ( ) + BytePos ( open_pos as u32 ) ;
1152+ visitor. last_pos = block_span . lo ( ) + BytePos ( open_pos as u32 ) ;
11521153
11531154 for item in trait_items {
11541155 visitor. visit_trait_item ( item) ;
Original file line number Diff line number Diff line change @@ -30,3 +30,7 @@ fn foo<const X: usize>() {
3030}
3131
3232type Foo < const N : usize > = [ i32 ; N + 1 ] ;
33+
34+ pub trait Foo : Bar < { Baz :: COUNT } > {
35+ const ASD : usize ;
36+ }
Original file line number Diff line number Diff line change @@ -22,3 +22,7 @@ fn foo<const X: usize>() {
2222}
2323
2424type Foo < const N : usize > = [ i32 ; N + 1 ] ;
25+
26+ pub trait Foo : Bar < { Baz :: COUNT } > {
27+ const ASD : usize ;
28+ }
You can’t perform that action at this time.
0 commit comments