mirror of
https://github.com/rust-lang/rust
synced 2024-09-19 08:22:55 +00:00
code fixes for error code use warning
This commit is contained in:
parent
5841021f07
commit
5be4fa864a
|
@ -131,29 +131,23 @@ pub fn try_report_named_anon_conflict(&self, error: &RegionResolutionError<'tcx>
|
|||
return false;
|
||||
}
|
||||
|
||||
if let Some(simple_name) = arg.pat.simple_name() {
|
||||
struct_span_err!(self.tcx.sess,
|
||||
span,
|
||||
E0621,
|
||||
"explicit lifetime required in the type of `{}`",
|
||||
simple_name)
|
||||
.span_label(arg.pat.span,
|
||||
format!("consider changing the type of `{}` to `{}`",
|
||||
simple_name,
|
||||
new_ty))
|
||||
.span_label(span, format!("lifetime `{}` required", named))
|
||||
.emit();
|
||||
|
||||
let (error_var, span_label_var) = if let Some(simple_name) = arg.pat.simple_name() {
|
||||
(format!("the type of `{}`", simple_name), format!("the type of `{}`", simple_name))
|
||||
} else {
|
||||
struct_span_err!(self.tcx.sess,
|
||||
span,
|
||||
E0621,
|
||||
"explicit lifetime required in parameter type")
|
||||
.span_label(arg.pat.span,
|
||||
format!("consider changing type to `{}`", new_ty))
|
||||
.span_label(span, format!("lifetime `{}` required", named))
|
||||
.emit();
|
||||
}
|
||||
(format!("parameter type"), format!("type"))
|
||||
};
|
||||
|
||||
|
||||
struct_span_err!(self.tcx.sess,
|
||||
span,
|
||||
E0621,
|
||||
"explicit lifetime required in {}",
|
||||
error_var)
|
||||
.span_label(arg.pat.span,
|
||||
format!("consider changing {} to `{}`", span_label_var, new_ty))
|
||||
.span_label(span, format!("lifetime `{}` required", named))
|
||||
.emit();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue