Rollup merge of #113177 - estebank:hrlt-sugg, r=compiler-errors
Use structured suggestion when telling user about `for<'a>` ``` error[E0637]: `&` without an explicit lifetime name cannot be used here --> $DIR/E0637.rs:13:13 | LL | T: Into<&u32>, | ^ explicit lifetime name needed here | help: consider introducing a higher-ranked lifetime here | LL | T: for<'a> Into<&'a u32>, | +++++++ ++ ```
This commit is contained in:
commit
207b24413c
17 changed files with 157 additions and 64 deletions
|
@ -1632,9 +1632,13 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
|
|||
..
|
||||
} = &rib.kind
|
||||
{
|
||||
diag.span_help(
|
||||
*span,
|
||||
"consider introducing a higher-ranked lifetime here with `for<'a>`",
|
||||
diag.multipart_suggestion(
|
||||
"consider introducing a higher-ranked lifetime here",
|
||||
vec![
|
||||
(span.shrink_to_lo(), "for<'a> ".into()),
|
||||
(lifetime.ident.span.shrink_to_hi(), "'a ".into()),
|
||||
],
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue