diff options
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_typeck/src/check/method/suggest.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_typeck/src/check/method/suggest.rs b/compiler/rustc_typeck/src/check/method/suggest.rs index ecc29965937..e6560ca4d9b 100644 --- a/compiler/rustc_typeck/src/check/method/suggest.rs +++ b/compiler/rustc_typeck/src/check/method/suggest.rs @@ -1880,9 +1880,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; let sp = hir.span(id); let sp = if let Some(first_bound) = has_bounds { - // `sp` only covers `T`, change it so that it covers - // `T:` when appropriate sp.until(first_bound.span()) + } else if let Some(colon_sp) = + // If the generic param is declared with a colon but without bounds: + // fn foo<T:>(t: T) { ... } + param.colon_span_for_suggestions( + self.inh.tcx.sess.source_map(), + ) + { + sp.to(colon_sp) } else { sp }; |
