Add translatable diagnostic for changing import binding
This commit is contained in:
@@ -30,6 +30,7 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{BytePos, Span, SyntaxContext};
|
||||
use thin_vec::ThinVec;
|
||||
|
||||
use crate::errors::{ChangeImportBinding, ChangeImportBindingSuggestion};
|
||||
use crate::imports::{Import, ImportKind};
|
||||
use crate::late::{PatternSource, Rib};
|
||||
use crate::path_names_to_string;
|
||||
@@ -376,16 +377,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
let rename_msg = "you can use `as` to change the binding name of the import";
|
||||
if let Some(suggestion) = suggestion {
|
||||
err.span_suggestion(
|
||||
binding_span,
|
||||
rename_msg,
|
||||
suggestion,
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
err.subdiagnostic(ChangeImportBindingSuggestion { span: binding_span, suggestion });
|
||||
} else {
|
||||
err.span_label(binding_span, rename_msg);
|
||||
err.subdiagnostic(ChangeImportBinding { span: binding_span });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user