File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,7 @@ impl<'a> SpanUtils<'a> {
238
238
let mut toks = self . retokenise_span ( span) ;
239
239
// We keep track of how many brackets we're nested in
240
240
let mut bracket_count = 0 ;
241
+ let mut found_ufcs_sep = false ;
241
242
loop {
242
243
let ts = toks. real_token ( ) ;
243
244
if ts. tok == token:: Eof {
@@ -254,13 +255,20 @@ impl<'a> SpanUtils<'a> {
254
255
}
255
256
bracket_count += match ts. tok {
256
257
token:: Lt => 1 ,
257
- token:: Gt => -1 ,
258
+ token:: Gt => {
259
+ // Ignore the `>::` in `<Type as Trait>::AssocTy`.
260
+ if !found_ufcs_sep && bracket_count == 0 {
261
+ found_ufcs_sep = true ;
262
+ 0
263
+ } else {
264
+ -1
265
+ }
266
+ }
258
267
token:: BinOp ( token:: Shl ) => 2 ,
259
268
token:: BinOp ( token:: Shr ) => -2 ,
260
269
_ => 0
261
270
} ;
262
- if ts. tok . is_ident ( ) &&
263
- bracket_count == nesting {
271
+ if ts. tok . is_ident ( ) && bracket_count == nesting {
264
272
result. push ( self . make_sub_span ( span, Some ( ts. sp ) ) . unwrap ( ) ) ;
265
273
}
266
274
}
You can’t perform that action at this time.
0 commit comments