From 0a58b26e8a296a4f03d55ae0469ce4da9a6080a6 Mon Sep 17 00:00:00 2001 From: nidnogg Date: Sun, 21 Aug 2022 13:08:14 -0300 Subject: [PATCH] Hotfix ftl err name, added check for err.code in create_feature_err --- compiler/rustc_const_eval/src/errors.rs | 2 +- compiler/rustc_error_messages/locales/en-US/const_eval.ftl | 2 +- compiler/rustc_session/src/session.rs | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs index 7e1cf4ef1aab8..d0af304f109f5 100644 --- a/compiler/rustc_const_eval/src/errors.rs +++ b/compiler/rustc_const_eval/src/errors.rs @@ -89,7 +89,7 @@ pub(crate) struct TransientMutBorrowErrRaw { } #[derive(SessionDiagnostic)] -#[error(const_eval::const_evaL_max_num_nodes_in_const_err)] +#[error(const_eval::max_num_nodes_in_const)] pub(crate) struct MaxNumNodesInConstErr { #[primary_span] pub span: Span, diff --git a/compiler/rustc_error_messages/locales/en-US/const_eval.ftl b/compiler/rustc_error_messages/locales/en-US/const_eval.ftl index b8e4199dc1c2a..8a5e1a7a95709 100644 --- a/compiler/rustc_error_messages/locales/en-US/const_eval.ftl +++ b/compiler/rustc_error_messages/locales/en-US/const_eval.ftl @@ -30,7 +30,7 @@ const_eval_transient_mut_borrow = mutable references are not allowed in {$kind}s const_eval_transient_mut_borrow_raw = raw mutable references are not allowed in {$kind}s -const_evaL_max_num_nodes_in_const_err = maximum number of nodes exceeded in constant {$s} +const_eval_max_num_nodes_in_const = maximum number of nodes exceeded in constant {$s} const_eval_unallowed_fn_pointer_call = function pointer calls are not allowed in {$kind}s diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 743b9f429e2bb..edb187ec3f7c5 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -467,7 +467,9 @@ impl Session { feature: Symbol, ) -> DiagnosticBuilder<'a, ErrorGuaranteed> { let mut err = self.parse_sess.create_err(err); - err.code = std::option::Option::Some(error_code!(E0658)); + if err.code.is_none() { + err.code = std::option::Option::Some(error_code!(E0658)); + } add_feature_diagnostics(&mut err, &self.parse_sess, feature); err }