about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/diagnostics.rs
diff options
context:
space:
mode:
authorTom Martin <tom.martin1239@gmail.com>2023-06-18 07:19:19 +0100
committerTom Martin <tom.martin1239@gmail.com>2023-06-18 12:28:16 +0100
commit8fa9003621d0031a76b208b277c7832a06e1570a (patch)
tree8c0b4fcbc30905b43a5522172793a847ce7d70f0 /compiler/rustc_resolve/src/diagnostics.rs
parent0c2c243342ec2a2427f0624fac5ac59f0ee6fbcd (diff)
downloadrust-8fa9003621d0031a76b208b277c7832a06e1570a.tar.gz
rust-8fa9003621d0031a76b208b277c7832a06e1570a.zip
Add translatable diagnostic for changing import binding
Diffstat (limited to 'compiler/rustc_resolve/src/diagnostics.rs')
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs11
1 files changed, 3 insertions, 8 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index e42b2df1a5a..0c780672ea3 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -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 });
         }
     }