File tree 2 files changed +16
-5
lines changed
2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -700,8 +700,8 @@ pub(crate) fn format_impl(
700
700
option. allow_single_line ( ) ;
701
701
}
702
702
703
- let misssing_span = mk_sp ( self_ty. span . hi ( ) , item. span . hi ( ) ) ;
704
- let where_span_end = context. snippet_provider . opt_span_before ( misssing_span , "{" ) ;
703
+ let missing_span = mk_sp ( self_ty. span . hi ( ) , item. span . hi ( ) ) ;
704
+ let where_span_end = context. snippet_provider . opt_span_before ( missing_span , "{" ) ;
705
705
let where_clause_str = rewrite_where_clause (
706
706
context,
707
707
& generics. where_clause ,
@@ -765,15 +765,15 @@ pub(crate) fn format_impl(
765
765
}
766
766
767
767
result. push ( '{' ) ;
768
-
769
- let snippet = context. snippet ( item. span ) ;
768
+ // this is an impl body snippet(impl SampleImple { /* here */ })
769
+ let snippet = context. snippet ( mk_sp ( item. span . hi ( ) , self_ty . span . hi ( ) ) ) ;
770
770
let open_pos = snippet. find_uncommented ( "{" ) ? + 1 ;
771
771
772
772
if !items. is_empty ( ) || contains_comment ( & snippet[ open_pos..] ) {
773
773
let mut visitor = FmtVisitor :: from_context ( context) ;
774
774
let item_indent = offset. block_only ( ) . block_indent ( context. config ) ;
775
775
visitor. block_indent = item_indent;
776
- visitor. last_pos = item . span . lo ( ) + BytePos ( open_pos as u32 ) ;
776
+ visitor. last_pos = self_ty . span . hi ( ) + BytePos ( open_pos as u32 ) ;
777
777
778
778
visitor. visit_attrs ( & item. attrs , ast:: AttrStyle :: Inner ) ;
779
779
visitor. visit_impl_items ( items) ;
Original file line number Diff line number Diff line change
1
+ #![ feature( const_generics) ]
2
+
3
+ trait A {
4
+ fn foo ( & self ) ;
5
+ }
6
+
7
+ pub struct B < const N : usize > ( [ usize ; N ] ) ;
8
+
9
+ impl < const N : usize > A for B < { N } > {
10
+ fn foo ( & self ) { }
11
+ }
You can’t perform that action at this time.
0 commit comments