fix: wrong trait import suggestion for T:
This commit is contained in:
parent
e3c43e64ec
commit
9b9f677104
3 changed files with 32 additions and 2 deletions
|
@ -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
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue