diff --git a/compiler/rustc_ast_lowering/src/stability.rs b/compiler/rustc_ast_lowering/src/stability.rs index 6752218fa0d4..9acdd672178a 100644 --- a/compiler/rustc_ast_lowering/src/stability.rs +++ b/compiler/rustc_ast_lowering/src/stability.rs @@ -29,7 +29,6 @@ pub(crate) fn extern_abi_enabled( }) } -#[allow(rustc::untranslatable_diagnostic)] pub(crate) fn gate_unstable_abi(sess: &Session, features: &Features, span: Span, abi: ExternAbi) { match extern_abi_enabled(features, span, abi) { Ok(_) => (), diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 028a5048d543..dd0e27948bec 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -13,15 +13,11 @@ use crate::errors; macro_rules! gate { ($visitor:expr, $feature:ident, $span:expr, $explain:expr) => {{ if !$visitor.features.$feature() && !$span.allows_unstable(sym::$feature) { - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable feature_err(&$visitor.sess, sym::$feature, $span, $explain).emit(); } }}; ($visitor:expr, $feature:ident, $span:expr, $explain:expr, $help:expr) => {{ if !$visitor.features.$feature() && !$span.allows_unstable(sym::$feature) { - // FIXME: make this translatable - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] feature_err(&$visitor.sess, sym::$feature, $span, $explain).with_help($help).emit(); } }}; @@ -31,13 +27,11 @@ macro_rules! gate { macro_rules! gate_alt { ($visitor:expr, $has_feature:expr, $name:expr, $span:expr, $explain:expr) => {{ if !$has_feature && !$span.allows_unstable($name) { - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable feature_err(&$visitor.sess, $name, $span, $explain).emit(); } }}; ($visitor:expr, $has_feature:expr, $name:expr, $span:expr, $explain:expr, $notes: expr) => {{ if !$has_feature && !$span.allows_unstable($name) { - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable let mut diag = feature_err(&$visitor.sess, $name, $span, $explain); for note in $notes { diag.note(*note); @@ -491,7 +485,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) { && (!visitor.features.gen_blocks() && !span.allows_unstable(sym::gen_blocks)) && (!visitor.features.yield_expr() && !span.allows_unstable(sym::yield_expr)) { - #[allow(rustc::untranslatable_diagnostic)] // Emit yield_expr as the error, since that will be sufficient. You can think of it // as coroutines and gen_blocks imply yield_expr. feature_err(&visitor.sess, sym::yield_expr, *span, "yield syntax is experimental") @@ -523,7 +516,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) { if !visitor.features.min_generic_const_args() && !span.allows_unstable(sym::min_generic_const_args) { - #[allow(rustc::untranslatable_diagnostic)] feature_err( &visitor.sess, sym::min_generic_const_args, @@ -559,7 +551,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) { if let Ok(snippet) = sm.span_to_snippet(span) && snippet == "!" { - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable feature_err(sess, sym::never_patterns, span, "`!` patterns are experimental") .emit(); } else { diff --git a/compiler/rustc_attr_parsing/src/attributes/cfg.rs b/compiler/rustc_attr_parsing/src/attributes/cfg.rs index 89c2d621e079..a9b2a4c96c33 100644 --- a/compiler/rustc_attr_parsing/src/attributes/cfg.rs +++ b/compiler/rustc_attr_parsing/src/attributes/cfg.rs @@ -412,7 +412,6 @@ fn try_gate_cfg(name: Symbol, span: Span, sess: &Session, features: Option<&Feat } } -#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable fn gate_cfg(gated_cfg: &GatedCfg, cfg_span: Span, sess: &Session, features: &Features) { let (cfg, feature, has_feature) = gated_cfg; if !has_feature(features) && !cfg_span.allows_unstable(*feature) { diff --git a/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs index 2a04b55f469e..ce3d116dce3b 100644 --- a/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/link_attrs.rs @@ -141,8 +141,6 @@ impl CombineAttributeParser for LinkParser { macro report_unstable_modifier($feature: ident) { if !features.$feature() { - // FIXME: make this translatable - #[expect(rustc::untranslatable_diagnostic)] feature_err( sess, sym::$feature, diff --git a/compiler/rustc_attr_parsing/src/attributes/transparency.rs b/compiler/rustc_attr_parsing/src/attributes/transparency.rs index 7db84f8f2d95..5b8b3cd151eb 100644 --- a/compiler/rustc_attr_parsing/src/attributes/transparency.rs +++ b/compiler/rustc_attr_parsing/src/attributes/transparency.rs @@ -4,9 +4,6 @@ use super::prelude::*; pub(crate) struct TransparencyParser; -// FIXME(jdonszelmann): make these proper diagnostics -#[allow(rustc::untranslatable_diagnostic)] -#[allow(rustc::diagnostic_outside_of_impl)] impl SingleAttributeParser for TransparencyParser { const PATH: &[Symbol] = &[sym::rustc_macro_transparency]; const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepInnermost; diff --git a/compiler/rustc_borrowck/src/borrowck_errors.rs b/compiler/rustc_borrowck/src/borrowck_errors.rs index 7c9011505d64..0d3c554e4176 100644 --- a/compiler/rustc_borrowck/src/borrowck_errors.rs +++ b/compiler/rustc_borrowck/src/borrowck_errors.rs @@ -1,6 +1,3 @@ -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] - use rustc_errors::codes::*; use rustc_errors::{Applicability, Diag, DiagCtxtHandle, struct_span_code_err}; use rustc_hir as hir; diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index 5cfe9db009bf..caf6a86af098 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -1,8 +1,5 @@ // ignore-tidy-filelength -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] - use std::iter; use std::ops::ControlFlow; diff --git a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs index 8f643d8f460f..bbd0a8ae0710 100644 --- a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs +++ b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs @@ -1,8 +1,5 @@ //! Print diagnostics to explain why values are borrowed. -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] - use rustc_data_structures::assert_matches; use rustc_errors::{Applicability, Diag, EmissionGuarantee}; use rustc_hir as hir; diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index e725b13434a1..c15e7041c94d 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -162,8 +162,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { } for (_, (mut diag, count)) in std::mem::take(&mut self.diags_buffer.buffered_mut_errors) { if count > 10 { - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] diag.note(format!("...and {} other attempted mutable borrows", count - 10)); } self.buffer_error(diag); @@ -236,7 +234,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { /// LL | for (key, value) in dict { /// | ^^^^ /// ``` - #[allow(rustc::diagnostic_outside_of_impl)] // FIXME pub(super) fn add_moved_or_invoked_closure_note( &self, location: Location, @@ -820,7 +817,6 @@ impl UseSpans<'_> { } /// Add a span label to the arguments of the closure, if it exists. - #[allow(rustc::diagnostic_outside_of_impl)] pub(super) fn args_subdiag(self, err: &mut Diag<'_>, f: impl FnOnce(Span) -> CaptureArgLabel) { if let UseSpans::ClosureUse { args_span, .. } = self { err.subdiagnostic(f(args_span)); @@ -829,7 +825,6 @@ impl UseSpans<'_> { /// Add a span label to the use of the captured variable, if it exists. /// only adds label to the `path_span` - #[allow(rustc::diagnostic_outside_of_impl)] pub(super) fn var_path_only_subdiag( self, err: &mut Diag<'_>, @@ -861,7 +856,6 @@ impl UseSpans<'_> { } /// Add a subdiagnostic to the use of the captured variable, if it exists. - #[allow(rustc::diagnostic_outside_of_impl)] pub(super) fn var_subdiag( self, err: &mut Diag<'_>, @@ -1225,8 +1219,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { self.borrow_spans(span, borrow.reserve_location) } - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable fn explain_captures( &mut self, err: &mut Diag<'infcx>, diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 3322c590a6ce..f83931d37599 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -1,6 +1,3 @@ -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] - use rustc_data_structures::fx::FxHashSet; use rustc_errors::{Applicability, Diag}; use rustc_hir::intravisit::Visitor; diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index e9039d4311b6..4fb739403ced 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -1,6 +1,3 @@ -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] - use core::ops::ControlFlow; use either::Either; diff --git a/compiler/rustc_borrowck/src/diagnostics/opaque_types.rs b/compiler/rustc_borrowck/src/diagnostics/opaque_types.rs index 999136264184..62ba4d172a3f 100644 --- a/compiler/rustc_borrowck/src/diagnostics/opaque_types.rs +++ b/compiler/rustc_borrowck/src/diagnostics/opaque_types.rs @@ -1,6 +1,3 @@ -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] - use std::ops::ControlFlow; use either::Either; diff --git a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs index bd0cf3578c2b..b1e16717466b 100644 --- a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs +++ b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs @@ -1,9 +1,6 @@ //! Contains utilities for generating suggestions for borrowck errors related to unsatisfied //! outlives constraints. -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] - use std::collections::BTreeMap; use rustc_data_structures::fx::FxIndexSet; diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 9c2b9139367a..17f1988a17c4 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -196,7 +196,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { // For generic associated types (GATs) which implied 'static requirement // from higher-ranked trait bounds (HRTB). Try to locate span of the trait // and the span which bounded to the trait for adding 'static lifetime suggestion - #[allow(rustc::diagnostic_outside_of_impl)] fn suggest_static_lifetime_for_gat_from_hrtb( &self, diag: &mut Diag<'_>, @@ -421,9 +420,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { /// ``` /// /// Here we would be invoked with `fr = 'a` and `outlived_fr = 'b`. - // FIXME: make this translatable - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] pub(crate) fn report_region_error( &mut self, fr: RegionVid, @@ -577,7 +573,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { /// executing... /// = note: ...therefore, returned references to captured variables will escape the closure /// ``` - #[allow(rustc::diagnostic_outside_of_impl)] // FIXME fn report_fnmut_error( &self, errci: &ErrorConstraintInfo<'tcx>, @@ -686,18 +681,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { borrowck_errors::borrowed_data_escapes_closure(self.infcx.tcx, *span, escapes_from); if let Some((Some(outlived_fr_name), outlived_fr_span)) = outlived_fr_name_and_span { - // FIXME: make this translatable - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] diag.span_label( outlived_fr_span, format!("`{outlived_fr_name}` declared here, outside of the {escapes_from} body",), ); } - // FIXME: make this translatable - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] if let Some((Some(fr_name), fr_span)) = fr_name_and_span { diag.span_label( fr_span, @@ -732,9 +721,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { let outlived_fr_region_name = self.give_region_a_name(errci.outlived_fr).unwrap(); outlived_fr_region_name.highlight_region_name(&mut diag); - // FIXME: make this translatable - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] diag.span_label( *span, format!( @@ -766,7 +752,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { /// | ^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it /// | is returning data with lifetime `'b` /// ``` - #[allow(rustc::diagnostic_outside_of_impl)] // FIXME fn report_general_error(&self, errci: &ErrorConstraintInfo<'tcx>) -> Diag<'infcx> { let ErrorConstraintInfo { fr, outlived_fr, span, category, .. } = errci; @@ -824,8 +809,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { /// LL | fn iter_values_anon(&self) -> impl Iterator + 'a { /// | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /// ``` - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable fn add_static_impl_trait_suggestion( &self, diag: &mut Diag<'_>, @@ -966,7 +949,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { self.suggest_constrain_dyn_trait_in_impl(diag, &visitor.0, ident, self_ty); } - #[allow(rustc::diagnostic_outside_of_impl)] #[instrument(skip(self, err), level = "debug")] fn suggest_constrain_dyn_trait_in_impl( &self, @@ -1032,7 +1014,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { ); } - #[allow(rustc::diagnostic_outside_of_impl)] /// When encountering a lifetime error caused by the return type of a closure, check the /// corresponding trait bound and see if dereferencing the closure return value would satisfy /// them. If so, we produce a structured suggestion. @@ -1160,7 +1141,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { } } - #[allow(rustc::diagnostic_outside_of_impl)] fn suggest_move_on_borrowing_closure(&self, diag: &mut Diag<'_>) { let body = self.infcx.tcx.hir_body_owned_by(self.mir_def_id()); let expr = &body.value.peel_blocks(); diff --git a/compiler/rustc_borrowck/src/diagnostics/region_name.rs b/compiler/rustc_borrowck/src/diagnostics/region_name.rs index 517f9e88cd9b..fba0879e8133 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_name.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_name.rs @@ -1,6 +1,3 @@ -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] - use std::fmt::{self, Display}; use std::iter; diff --git a/compiler/rustc_borrowck/src/nll.rs b/compiler/rustc_borrowck/src/nll.rs index 5537d90e297a..64e3b59acfff 100644 --- a/compiler/rustc_borrowck/src/nll.rs +++ b/compiler/rustc_borrowck/src/nll.rs @@ -287,8 +287,6 @@ pub(crate) fn emit_nll_mir<'tcx>( Ok(()) } -#[allow(rustc::diagnostic_outside_of_impl)] -#[allow(rustc::untranslatable_diagnostic)] pub(super) fn dump_annotation<'tcx, 'infcx>( infcx: &'infcx BorrowckInferCtxt<'tcx>, body: &Body<'tcx>, diff --git a/compiler/rustc_borrowck/src/universal_regions.rs b/compiler/rustc_borrowck/src/universal_regions.rs index fda4719fc3f5..7ebfb4683bf9 100644 --- a/compiler/rustc_borrowck/src/universal_regions.rs +++ b/compiler/rustc_borrowck/src/universal_regions.rs @@ -11,9 +11,6 @@ //! The code in this file doesn't *do anything* with those results; it //! just returns them for other code to use. -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] - use std::cell::Cell; use std::iter; diff --git a/compiler/rustc_builtin_macros/src/compile_error.rs b/compiler/rustc_builtin_macros/src/compile_error.rs index df64d8f314db..e2109caf2e59 100644 --- a/compiler/rustc_builtin_macros/src/compile_error.rs +++ b/compiler/rustc_builtin_macros/src/compile_error.rs @@ -19,8 +19,6 @@ pub(crate) fn expand_compile_error<'cx>( Err(guar) => return ExpandResult::Ready(DummyResult::any(sp, guar)), }; - #[expect(rustc::diagnostic_outside_of_impl, reason = "diagnostic message is specified by user")] - #[expect(rustc::untranslatable_diagnostic, reason = "diagnostic message is specified by user")] let guar = cx.dcx().span_err(sp, var.to_string()); cx.resolver.mark_scope_with_compile_error(cx.current_expansion.lint_node_id); diff --git a/compiler/rustc_builtin_macros/src/errors.rs b/compiler/rustc_builtin_macros/src/errors.rs index a9ce41c9be76..0aaa8cf558c4 100644 --- a/compiler/rustc_builtin_macros/src/errors.rs +++ b/compiler/rustc_builtin_macros/src/errors.rs @@ -503,10 +503,6 @@ pub(crate) struct EnvNotDefinedWithUserMessage { impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for EnvNotDefinedWithUserMessage { #[track_caller] fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> { - #[expect( - rustc::untranslatable_diagnostic, - reason = "cannot translate user-provided messages" - )] let mut diag = Diag::new(dcx, level, self.msg_from_user.to_string()); diag.span(self.span); diag diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs index e1c5a4f85c1b..120e3f849ff6 100644 --- a/compiler/rustc_builtin_macros/src/lib.rs +++ b/compiler/rustc_builtin_macros/src/lib.rs @@ -3,8 +3,6 @@ // tidy-alphabetical-start #![allow(internal_features)] -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(decl_macro)] diff --git a/compiler/rustc_builtin_macros/src/util.rs b/compiler/rustc_builtin_macros/src/util.rs index e26f31dce67b..9ac3d0e7eac1 100644 --- a/compiler/rustc_builtin_macros/src/util.rs +++ b/compiler/rustc_builtin_macros/src/util.rs @@ -78,8 +78,6 @@ type UnexpectedExprKind<'a> = Result<(Diag<'a>, bool /* has_suggestions */), Err /// The returned bool indicates whether an applicable suggestion has already been /// added to the diagnostic to avoid emitting multiple suggestions. `Err(Err(ErrorGuaranteed))` /// indicates that an ast error was encountered. -// FIXME(Nilstrieb) Make this function setup translatable -#[allow(rustc::untranslatable_diagnostic)] pub(crate) fn expr_to_spanned_string<'a>( cx: &'a mut ExtCtxt<'_>, expr: Box, diff --git a/compiler/rustc_codegen_cranelift/src/lib.rs b/compiler/rustc_codegen_cranelift/src/lib.rs index 5fdecd014ac0..7361a6af4178 100644 --- a/compiler/rustc_codegen_cranelift/src/lib.rs +++ b/compiler/rustc_codegen_cranelift/src/lib.rs @@ -1,6 +1,4 @@ // tidy-alphabetical-start -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] // Note: please avoid adding other feature gates where possible #![feature(rustc_private)] // Only used to define intrinsics in `compiler_builtins.rs`. diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index 8c39d04ef21d..3ffc16d49ac1 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -1,6 +1,4 @@ // tidy-alphabetical-start -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(file_buffered)] diff --git a/compiler/rustc_const_eval/src/check_consts/ops.rs b/compiler/rustc_const_eval/src/check_consts/ops.rs index f606158e4018..a9366bf29fbe 100644 --- a/compiler/rustc_const_eval/src/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/check_consts/ops.rs @@ -125,9 +125,6 @@ pub(crate) struct FnCallNonConst<'tcx> { } impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> { - // FIXME: make this translatable - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, _: Span) -> Diag<'tcx> { let tcx = ccx.tcx; let caller = ccx.def_id(); diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index aeadf0257ea8..b72a50a0bfce 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -232,7 +232,6 @@ pub fn format_interp_error<'tcx>(dcx: DiagCtxtHandle<'_>, e: InterpErrorInfo<'tc backtrace.print_backtrace(); // FIXME(fee1-dead), HACK: we want to use the error as title therefore we can just extract the // label and arguments from the InterpError. - #[allow(rustc::untranslatable_diagnostic)] let mut diag = dcx.struct_allow(""); let msg = e.diagnostic_message(); e.add_args(&mut diag); diff --git a/compiler/rustc_const_eval/src/lib.rs b/compiler/rustc_const_eval/src/lib.rs index 9b1d4652212b..1266e15c682f 100644 --- a/compiler/rustc_const_eval/src/lib.rs +++ b/compiler/rustc_const_eval/src/lib.rs @@ -1,5 +1,4 @@ // tidy-alphabetical-start -#![allow(rustc::diagnostic_outside_of_impl)] #![feature(array_try_map)] #![feature(assert_matches)] #![feature(box_patterns)] diff --git a/compiler/rustc_driver_impl/src/args.rs b/compiler/rustc_driver_impl/src/args.rs index b0970144c421..d8d55ce14125 100644 --- a/compiler/rustc_driver_impl/src/args.rs +++ b/compiler/rustc_driver_impl/src/args.rs @@ -97,7 +97,6 @@ impl Expander { /// **Note:** This function doesn't interpret argument 0 in any special way. /// If this function is intended to be used with command line arguments, /// `argv[0]` must be removed prior to calling it manually. -#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable pub fn arg_expand_all(early_dcx: &EarlyDiagCtxt, at_args: &[String]) -> Vec { let mut expander = Expander::default(); let mut result = Ok(()); diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 021802040d3b..b82b1e100c5c 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -5,7 +5,6 @@ //! This API is completely unstable and subject to change. // tidy-alphabetical-start -#![allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable #![feature(decl_macro)] #![feature(panic_backtrace_config)] #![feature(panic_update_hook)] @@ -303,7 +302,6 @@ pub fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send)) } if !has_input { - #[allow(rustc::diagnostic_outside_of_impl)] sess.dcx().fatal("no input filename given"); // this is fatal } @@ -615,7 +613,6 @@ fn list_metadata(sess: &Session, metadata_loader: &dyn MetadataLoader) { safe_println!("{}", String::from_utf8(v).unwrap()); } Input::Str { .. } => { - #[allow(rustc::diagnostic_outside_of_impl)] sess.dcx().fatal("cannot list metadata for stdin"); } } @@ -842,7 +839,6 @@ fn print_crate_info( sess.apple_deployment_target().fmt_pretty(), ) } else { - #[allow(rustc::diagnostic_outside_of_impl)] sess.dcx().fatal("only Apple targets currently support deployment version info") } } diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index ce40f3ae8bf8..7ca493b502d8 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -4,9 +4,7 @@ // tidy-alphabetical-start #![allow(internal_features)] -#![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::direct_use_of_rustc_type_ir)] -#![allow(rustc::untranslatable_diagnostic)] #![cfg_attr(bootstrap, feature(array_windows))] #![feature(assert_matches)] #![feature(associated_type_defaults)] diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index a1fc9694d663..e2d62bdc5453 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -1355,8 +1355,6 @@ impl<'a> ExtCtxt<'a> { for (span, notes) in self.expansions.iter() { let mut db = self.dcx().create_note(errors::TraceMacro { span: *span }); for note in notes { - // FIXME: make this translatable - #[allow(rustc::untranslatable_diagnostic)] db.note(note.clone()); } db.emit(); diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index fabe1f5a8c5d..20cdffac2d67 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -999,7 +999,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> { }) } - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable fn gate_proc_macro_attr_item(&self, span: Span, item: &Annotatable) { let kind = match item { Annotatable::Item(_) diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs index 5ac7ec0cd035..1814abd141d8 100644 --- a/compiler/rustc_expand/src/lib.rs +++ b/compiler/rustc_expand/src/lib.rs @@ -1,6 +1,5 @@ // tidy-alphabetical-start #![allow(internal_features)] -#![allow(rustc::diagnostic_outside_of_impl)] #![cfg_attr(bootstrap, feature(array_windows))] #![feature(associated_type_defaults)] #![feature(if_let_guard)] @@ -13,8 +12,6 @@ mod build; mod errors; -// FIXME(Nilstrieb) Translate macro_rules diagnostics -#[allow(rustc::untranslatable_diagnostic)] mod mbe; mod placeholders; mod proc_macro_server; @@ -25,8 +22,6 @@ pub mod base; pub mod config; pub mod expand; pub mod module; -// FIXME(Nilstrieb) Translate proc_macro diagnostics -#[allow(rustc::untranslatable_diagnostic)] pub mod proc_macro; pub fn provide(providers: &mut rustc_middle::query::Providers) { diff --git a/compiler/rustc_expand/src/proc_macro_server.rs b/compiler/rustc_expand/src/proc_macro_server.rs index 0e063011eea4..7688df2d3a55 100644 --- a/compiler/rustc_expand/src/proc_macro_server.rs +++ b/compiler/rustc_expand/src/proc_macro_server.rs @@ -548,9 +548,6 @@ impl server::FreeFunctions for Rustc<'_, '_> { Diag::new(self.psess().dcx(), diagnostic.level.to_internal(), message); diag.span(MultiSpan::from_spans(diagnostic.spans)); for child in diagnostic.children { - // This message comes from another diagnostic, and we are just reconstructing the - // diagnostic, so there's no need for translation. - #[allow(rustc::untranslatable_diagnostic)] diag.sub(child.level.to_internal(), child.message, MultiSpan::from_spans(child.spans)); } diag.emit(); diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index a51355adf72f..3a4d894239fc 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -56,8 +56,6 @@ This API is completely unstable and subject to change. */ // tidy-alphabetical-start -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] #![feature(assert_matches)] #![feature(gen_blocks)] #![feature(if_let_guard)] diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs index b60d053957a9..4594b9217f83 100644 --- a/compiler/rustc_hir_typeck/src/callee.rs +++ b/compiler/rustc_hir_typeck/src/callee.rs @@ -524,9 +524,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // Unit testing: function items annotated with // `#[rustc_evaluate_where_clauses]` trigger special output // to let us test the trait evaluation system. - // Untranslatable diagnostics are okay for rustc internals - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] if self.has_rustc_attrs && self.tcx.has_attr(def_id, sym::rustc_evaluate_where_clauses) { diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 1e46db1188b7..f76e8d4632fc 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -66,8 +66,6 @@ pub(crate) fn parse_cfg(dcx: DiagCtxtHandle<'_>, cfgs: Vec) -> Cfg { macro_rules! error { ($reason: expr) => { - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] dcx.fatal(format!("invalid `--cfg` argument: `{s}` ({})", $reason)); }; } @@ -146,42 +144,30 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec) -> Ch "visit for more details"; macro_rules! error { - ($reason:expr) => { - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] - { - let mut diag = - dcx.struct_fatal(format!("invalid `--check-cfg` argument: `{s}`")); - diag.note($reason); - diag.note(VISIT); - diag.emit() - } - }; - (in $arg:expr, $reason:expr) => { - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] - { - let mut diag = - dcx.struct_fatal(format!("invalid `--check-cfg` argument: `{s}`")); + ($reason:expr) => {{ + let mut diag = dcx.struct_fatal(format!("invalid `--check-cfg` argument: `{s}`")); + diag.note($reason); + diag.note(VISIT); + diag.emit() + }}; + (in $arg:expr, $reason:expr) => {{ + let mut diag = dcx.struct_fatal(format!("invalid `--check-cfg` argument: `{s}`")); - let pparg = rustc_ast_pretty::pprust::meta_list_item_to_string($arg); - if let Some(lit) = $arg.lit() { - let (lit_kind_article, lit_kind_descr) = { - let lit_kind = lit.as_token_lit().kind; - (lit_kind.article(), lit_kind.descr()) - }; - diag.note(format!( - "`{pparg}` is {lit_kind_article} {lit_kind_descr} literal" - )); - } else { - diag.note(format!("`{pparg}` is invalid")); - } - - diag.note($reason); - diag.note(VISIT); - diag.emit() + let pparg = rustc_ast_pretty::pprust::meta_list_item_to_string($arg); + if let Some(lit) = $arg.lit() { + let (lit_kind_article, lit_kind_descr) = { + let lit_kind = lit.as_token_lit().kind; + (lit_kind.article(), lit_kind.descr()) + }; + diag.note(format!("`{pparg}` is {lit_kind_article} {lit_kind_descr} literal")); + } else { + diag.note(format!("`{pparg}` is invalid")); } - }; + + diag.note($reason); + diag.note(VISIT); + diag.emit() + }}; } let expected_error = || -> ! { @@ -408,8 +394,6 @@ pub struct Config { /// Initialize jobserver before getting `jobserver::client` and `build_session`. pub(crate) fn initialize_checked_jobserver(early_dcx: &EarlyDiagCtxt) { jobserver::initialize_checked(|err| { - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] early_dcx .early_struct_warn(err) .with_note("the build environment is likely misconfigured") @@ -476,11 +460,7 @@ pub fn run_compiler(config: Config, f: impl FnOnce(&Compiler) -> R + Se config.opts.unstable_opts.translate_directionality_markers, ) { Ok(bundle) => bundle, - Err(e) => { - // We can't translate anything if we failed to load translations - #[allow(rustc::untranslatable_diagnostic)] - early_dcx.early_fatal(format!("failed to load fluent bundle: {e}")) - } + Err(e) => early_dcx.early_fatal(format!("failed to load fluent bundle: {e}")), }; let mut locale_resources = config.locale_resources; diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index 7e9c13566163..94f3b056266e 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -119,8 +119,6 @@ fn init_stack_size(early_dcx: &EarlyDiagCtxt) -> usize { // FIXME: we could accept `RUST_MIN_STACK=64MB`, perhaps? .map(|s| { let s = s.trim(); - // FIXME(workingjubilee): add proper diagnostics when we factor out "pre-run" setup - #[allow(rustc::untranslatable_diagnostic, rustc::diagnostic_outside_of_impl)] s.parse::().unwrap_or_else(|_| { let mut err = early_dcx.early_struct_fatal(format!( r#"`RUST_MIN_STACK` should be a number of bytes, but was "{s}""#, @@ -301,7 +299,6 @@ pub(crate) fn run_in_thread_pool_with_globals< }) } -#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable fn load_backend_from_dylib(early_dcx: &EarlyDiagCtxt, path: &Path) -> MakeBackendFn { match unsafe { load_symbol_from_dylib::(path, "__rustc_codegen_backend") } { Ok(backend_sym) => backend_sym, @@ -434,8 +431,6 @@ impl CodegenBackend for DummyCodegenBackend { .find(|&&crate_type| crate_type != CrateType::Rlib) && outputs.outputs.should_link() { - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] sess.dcx().fatal(format!( "crate type {crate_type} not supported by the dummy codegen backend" )); @@ -491,7 +486,6 @@ pub fn rustc_path<'a>(sysroot: &Sysroot) -> Option<&'a Path> { .as_deref() } -#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable fn get_codegen_sysroot( early_dcx: &EarlyDiagCtxt, sysroot: &Sysroot, diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs index 68fcf73cec51..99899bdf70ec 100644 --- a/compiler/rustc_lint/src/context.rs +++ b/compiler/rustc_lint/src/context.rs @@ -590,8 +590,6 @@ pub trait LintContext { // and stored between compilation sessions. To not manually do these steps, we simply create // a dummy diagnostic and emit it as usual, which will be suppressed and stored like a // normal expected lint diagnostic. - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] self.sess() .dcx() .struct_expect( diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index 6cb5aea79840..0295df2feca5 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -33,7 +33,6 @@ pub struct EarlyContextAndPass<'ecx, 'tcx, T: EarlyLintPass> { } impl<'ecx, 'tcx, T: EarlyLintPass> EarlyContextAndPass<'ecx, 'tcx, T> { - #[allow(rustc::diagnostic_outside_of_impl)] fn check_id(&mut self, id: ast::NodeId) { for early_lint in self.context.buffered.take(id) { let BufferedEarlyLint { span, node_id: _, lint_id, diagnostic } = early_lint; diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/errors.rs index 586e55c8055c..8f2f3594161a 100644 --- a/compiler/rustc_lint/src/errors.rs +++ b/compiler/rustc_lint/src/errors.rs @@ -35,7 +35,6 @@ impl Subdiagnostic for OverruledAttributeSub { OverruledAttributeSub::NodeSource { span, reason } => { diag.span_label(span, fluent::lint_node_source); if let Some(rationale) = reason { - #[allow(rustc::untranslatable_diagnostic)] diag.note(rationale.to_string()); } } diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 0f6452a2bc99..5fa101a04dbd 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -941,8 +941,6 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { if self.lint_added_lints { let lint = builtin::UNKNOWN_LINTS; let level = self.lint_level(builtin::UNKNOWN_LINTS); - // FIXME: make this translatable - #[allow(rustc::diagnostic_outside_of_impl)] lint_level(self.sess, lint, level, Some(span.into()), |lint| { lint.primary_message(fluent::lint_unknown_gated_lint); lint.arg("name", lint_id.lint.name_lower()); diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs index ec7ce1ade929..ae5fbec29e46 100644 --- a/compiler/rustc_lint/src/lib.rs +++ b/compiler/rustc_lint/src/lib.rs @@ -667,10 +667,6 @@ fn register_internals(store: &mut LintStore) { store.register_late_mod_pass(|_| Box::new(SymbolInternStringLiteral)); store.register_lints(&ImplicitSysrootCrateImport::lint_vec()); store.register_early_pass(|| Box::new(ImplicitSysrootCrateImport)); - // FIXME(davidtwco): deliberately do not include `UNTRANSLATABLE_DIAGNOSTIC` and - // `DIAGNOSTIC_OUTSIDE_OF_IMPL` here because `-Wrustc::internal` is provided to every crate and - // these lints will trigger all of the time - change this once migration to diagnostic structs - // and translation is completed store.register_group( false, "rustc::internal", diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index c85e4ffe91fc..ef11b9884927 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -1,6 +1,5 @@ // ignore-tidy-filelength -#![allow(rustc::untranslatable_diagnostic)] use std::num::NonZero; use rustc_errors::codes::*; @@ -2869,7 +2868,6 @@ pub(crate) struct AmbiguousGlobReexports { pub duplicate_reexport: Span, pub name: String, - // FIXME: make this translatable pub namespace: String, } @@ -2882,7 +2880,6 @@ pub(crate) struct HiddenGlobReexports { pub private_item: Span, pub name: String, - // FIXME: make this translatable pub namespace: String, } diff --git a/compiler/rustc_lint/src/non_fmt_panic.rs b/compiler/rustc_lint/src/non_fmt_panic.rs index f6295698b281..a07c3b372d34 100644 --- a/compiler/rustc_lint/src/non_fmt_panic.rs +++ b/compiler/rustc_lint/src/non_fmt_panic.rs @@ -120,7 +120,6 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc arg_span = expn.call_site; } - #[allow(rustc::diagnostic_outside_of_impl)] cx.span_lint(NON_FMT_PANICS, arg_span, |lint| { lint.primary_message(fluent::lint_non_fmt_panic); lint.arg("name", symbol); diff --git a/compiler/rustc_lint/src/non_local_def.rs b/compiler/rustc_lint/src/non_local_def.rs index b10be22dc389..bcf4d9ec3b29 100644 --- a/compiler/rustc_lint/src/non_local_def.rs +++ b/compiler/rustc_lint/src/non_local_def.rs @@ -199,10 +199,6 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions { let mut ms = MultiSpan::from_span(impl_span); for path in &collector.paths { - // FIXME: While a translatable diagnostic message can have an argument - // we (currently) have no way to set different args per diag msg with - // `MultiSpan::push_span_label`. - #[allow(rustc::untranslatable_diagnostic)] ms.push_span_label( path_span_without_args(path), format!("`{}` is not local", path_name_to_string(path)), diff --git a/compiler/rustc_metadata/src/errors.rs b/compiler/rustc_metadata/src/errors.rs index 2702c4498df6..8eb4fad078fe 100644 --- a/compiler/rustc_metadata/src/errors.rs +++ b/compiler/rustc_metadata/src/errors.rs @@ -338,8 +338,6 @@ impl Diagnostic<'_, G> for MultipleCandidates { diag.code(E0464); diag.span(self.span); for (i, candidate) in self.candidates.iter().enumerate() { - // FIXME: make this translatable - #[allow(rustc::untranslatable_diagnostic)] diag.note(format!("candidate #{}: {}", i + 1, candidate.display())); } diag @@ -446,8 +444,6 @@ impl Diagnostic<'_, G> for InvalidMetadataFiles { diag.code(E0786); diag.span(self.span); for crate_rejection in self.crate_rejections { - // FIXME: make this translatable - #[allow(rustc::untranslatable_diagnostic)] diag.note(crate_rejection); } diag diff --git a/compiler/rustc_middle/src/lib.rs b/compiler/rustc_middle/src/lib.rs index 5f62d44df6b6..412e1896fb87 100644 --- a/compiler/rustc_middle/src/lib.rs +++ b/compiler/rustc_middle/src/lib.rs @@ -26,9 +26,7 @@ // tidy-alphabetical-start #![allow(internal_features)] -#![allow(rustc::diagnostic_outside_of_impl)] #![allow(rustc::direct_use_of_rustc_type_ir)] -#![allow(rustc::untranslatable_diagnostic)] #![cfg_attr(bootstrap, feature(array_windows))] #![feature(allocator_api)] #![feature(assert_matches)] diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs index 63bbd1a0b854..fe2d4b9130ed 100644 --- a/compiler/rustc_middle/src/middle/stability.rs +++ b/compiler/rustc_middle/src/middle/stability.rs @@ -119,7 +119,6 @@ pub struct DeprecationSuggestion { pub struct Deprecated { pub sub: Option, - // FIXME: make this translatable pub kind: String, pub path: String, pub note: Option, diff --git a/compiler/rustc_mir_build/src/lib.rs b/compiler/rustc_mir_build/src/lib.rs index 91cc4dfa665f..5c5d979306bf 100644 --- a/compiler/rustc_mir_build/src/lib.rs +++ b/compiler/rustc_mir_build/src/lib.rs @@ -1,8 +1,6 @@ //! Construction of MIR from HIR. // tidy-alphabetical-start -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(if_let_guard)] diff --git a/compiler/rustc_mir_transform/src/pass_manager.rs b/compiler/rustc_mir_transform/src/pass_manager.rs index ab09cdf787ee..e225c31881f8 100644 --- a/compiler/rustc_mir_transform/src/pass_manager.rs +++ b/compiler/rustc_mir_transform/src/pass_manager.rs @@ -258,8 +258,6 @@ fn run_passes_inner<'tcx>( // Verify that no passes are missing from the `declare_passes` invocation #[cfg(debug_assertions)] - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] { let used_passes: FxIndexSet<_> = passes.iter().map(|p| p.name()).collect(); diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index 1fb44df65347..c836d52a71e4 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -1,8 +1,6 @@ //! The main parser interface. // tidy-alphabetical-start -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(debug_closure_helpers)] diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index d7f3a36122e5..b6608779787b 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -1669,7 +1669,6 @@ impl<'a> Parser<'a> { Ok((fields, etc)) } - #[deny(rustc::untranslatable_diagnostic)] fn report_misplaced_at_in_struct_pat(&self, prev_field: Ident) -> Diag<'a> { debug_assert_eq!(self.token, token::At); let span = prev_field.span.to(self.token.span); diff --git a/compiler/rustc_parse/src/parser/tests.rs b/compiler/rustc_parse/src/parser/tests.rs index 2e1acca9e9af..c57b9baa0c4d 100644 --- a/compiler/rustc_parse/src/parser/tests.rs +++ b/compiler/rustc_parse/src/parser/tests.rs @@ -184,7 +184,6 @@ impl Write for Shared { } } -#[allow(rustc::untranslatable_diagnostic)] // no translation needed for tests fn test_harness( file_text: &str, span_labels: Vec, diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index 8074ae429892..5799d1bf36b1 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -1692,7 +1692,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { let hir_sig = tcx.hir_fn_sig_by_hir_id(hir_id); if let Some(hir_sig) = hir_sig { - #[allow(rustc::diagnostic_outside_of_impl)] // FIXME match terr { TypeError::ArgumentMutability(idx) | TypeError::ArgumentSorts(_, idx) => { if let Some(ty) = hir_sig.decl.inputs.get(idx) { diff --git a/compiler/rustc_pattern_analysis/src/lib.rs b/compiler/rustc_pattern_analysis/src/lib.rs index f3308086ddc6..364ffc7bace0 100644 --- a/compiler/rustc_pattern_analysis/src/lib.rs +++ b/compiler/rustc_pattern_analysis/src/lib.rs @@ -3,8 +3,6 @@ //! [`rustc`] module. // tidy-alphabetical-start -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] #![allow(unused_crate_dependencies)] // tidy-alphabetical-end diff --git a/compiler/rustc_query_system/src/query/job.rs b/compiler/rustc_query_system/src/query/job.rs index 4a9b6a0d557c..79d08d33c0b1 100644 --- a/compiler/rustc_query_system/src/query/job.rs +++ b/compiler/rustc_query_system/src/query/job.rs @@ -612,9 +612,6 @@ pub fn print_query_stack( }; if Some(count_printed) < limit_frames || limit_frames.is_none() { // Only print to stderr as many stack frames as `num_frames` when present. - // FIXME: needs translation - #[allow(rustc::diagnostic_outside_of_impl)] - #[allow(rustc::untranslatable_diagnostic)] dcx.struct_failure_note(format!( "#{} [{:?}] {}", count_printed, query_info.query.dep_kind, query_info.query.description diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index a16235c5a1e4..ed4727b9d421 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -8,8 +8,6 @@ // tidy-alphabetical-start #![allow(internal_features)] -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] #![feature(arbitrary_self_types)] #![feature(assert_matches)] #![feature(box_patterns)] diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index 7246eded2e72..8f05ad7924e3 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -1138,7 +1138,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { errors::OutOfScopeMacroCalls { span: path.span, path: pprust::path_to_string(path), - // FIXME: Make this translatable. location, }, ); diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index f8b9ae040568..4f4c710c12a2 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1,8 +1,6 @@ //! Contains infrastructure for configuring the compiler, including parsing //! command-line options. -#![allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable - use std::collections::btree_map::{ Iter as BTreeMapIter, Keys as BTreeMapKeysIter, Values as BTreeMapValuesIter, }; diff --git a/compiler/rustc_session/src/config/externs.rs b/compiler/rustc_session/src/config/externs.rs index 1420ee38bf21..d668d8b4203d 100644 --- a/compiler/rustc_session/src/config/externs.rs +++ b/compiler/rustc_session/src/config/externs.rs @@ -49,7 +49,6 @@ pub(crate) fn split_extern_opt<'a>( )); let adjusted_name = crate_name.replace('-', "_"); if is_ascii_ident(&adjusted_name) { - #[allow(rustc::diagnostic_outside_of_impl)] // FIXME error .help(format!("consider replacing the dashes with underscores: `{adjusted_name}`")); } diff --git a/compiler/rustc_session/src/config/print_request.rs b/compiler/rustc_session/src/config/print_request.rs index 395f7a4fab71..dc53fcc6955f 100644 --- a/compiler/rustc_session/src/config/print_request.rs +++ b/compiler/rustc_session/src/config/print_request.rs @@ -213,7 +213,6 @@ fn emit_unknown_print_request_help(early_dcx: &EarlyDiagCtxt, req: &str, is_nigh .join(", "); let mut diag = early_dcx.early_struct_fatal(format!("unknown print request: `{req}`")); - #[allow(rustc::diagnostic_outside_of_impl)] diag.help(format!("valid print requests are: {prints}")); if req == "lints" { diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 39213a002383..dfb388c9380d 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -724,7 +724,6 @@ impl OptionDesc { } } -#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable fn build_options( early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches, diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index edc5ae9e6f63..4242b184cc98 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -132,8 +132,6 @@ pub fn feature_warn(sess: &Session, feature: Symbol, span: Span, explain: &'stat /// /// This variant allows you to control whether it is a library or language feature. /// Almost always, you want to use this for a language feature. If so, prefer `feature_warn`. -#[allow(rustc::diagnostic_outside_of_impl)] -#[allow(rustc::untranslatable_diagnostic)] #[track_caller] pub fn feature_warn_issue( sess: &Session, @@ -171,7 +169,6 @@ pub fn add_feature_diagnostics( /// This variant allows you to control whether it is a library or language feature. /// Almost always, you want to use this for a language feature. If so, prefer /// `add_feature_diagnostics`. -#[allow(rustc::diagnostic_outside_of_impl)] // FIXME pub fn add_feature_diagnostics_for_issue( err: &mut Diag<'_, G>, sess: &Session, diff --git a/compiler/rustc_session/src/search_paths.rs b/compiler/rustc_session/src/search_paths.rs index 2ca390b50dd0..3e1fb4df4c3a 100644 --- a/compiler/rustc_session/src/search_paths.rs +++ b/compiler/rustc_session/src/search_paths.rs @@ -107,7 +107,6 @@ impl SearchPath { let dir = match path.strip_prefix("@RUSTC_BUILTIN") { Some(stripped) => { if !is_unstable_enabled { - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable early_dcx.early_fatal( "the `-Z unstable-options` flag must also be passed to \ enable the use of `@RUSTC_BUILTIN`", @@ -119,7 +118,6 @@ impl SearchPath { None => PathBuf::from(path), }; if dir.as_os_str().is_empty() { - #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable early_dcx.early_fatal("empty search path given via `-L`"); } diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 1d5b36fc61b8..27d6efb8b549 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -246,7 +246,6 @@ impl Session { pub fn create_feature_err<'a>(&'a self, err: impl Diagnostic<'a>, feature: Symbol) -> Diag<'a> { let mut err = self.dcx().create_err(err); if err.code.is_none() { - #[allow(rustc::diagnostic_outside_of_impl)] err.code(E0658); } add_feature_diagnostics(&mut err, self, feature); @@ -960,7 +959,6 @@ fn default_emitter( // JUSTIFICATION: literally session construction #[allow(rustc::bad_opt_access)] -#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable pub fn build_session( sopts: config::Options, io: CompilerIO, @@ -1396,45 +1394,31 @@ impl EarlyDiagCtxt { self.dcx = DiagCtxt::new(emitter); } - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] pub fn early_note(&self, msg: impl Into) { self.dcx.handle().note(msg) } - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] pub fn early_help(&self, msg: impl Into) { self.dcx.handle().struct_help(msg).emit() } - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] #[must_use = "raise_fatal must be called on the returned ErrorGuaranteed in order to exit with a non-zero status code"] pub fn early_err(&self, msg: impl Into) -> ErrorGuaranteed { self.dcx.handle().err(msg) } - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] pub fn early_fatal(&self, msg: impl Into) -> ! { self.dcx.handle().fatal(msg) } - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] pub fn early_struct_fatal(&self, msg: impl Into) -> Diag<'_, FatalAbort> { self.dcx.handle().struct_fatal(msg) } - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] pub fn early_warn(&self, msg: impl Into) { self.dcx.handle().warn(msg) } - #[allow(rustc::untranslatable_diagnostic)] - #[allow(rustc::diagnostic_outside_of_impl)] pub fn early_struct_warn(&self, msg: impl Into) -> Diag<'_, ()> { self.dcx.handle().struct_warn(msg) } diff --git a/compiler/rustc_symbol_mangling/src/errors.rs b/compiler/rustc_symbol_mangling/src/errors.rs index 775f3112ed5f..ada9e3fb1562 100644 --- a/compiler/rustc_symbol_mangling/src/errors.rs +++ b/compiler/rustc_symbol_mangling/src/errors.rs @@ -18,7 +18,6 @@ impl Diagnostic<'_, G> for TestOutput { fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> { let TestOutput { span, kind, content } = self; - #[allow(rustc::untranslatable_diagnostic)] Diag::new(dcx, level, format!("{kind}({content})")).with_span(span) } } diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index 6705d271bc7d..561a95bad50c 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -11,8 +11,6 @@ //! This API is completely unstable and subject to change. // tidy-alphabetical-start -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] #![feature(assert_matches)] #![feature(associated_type_defaults)] #![feature(box_patterns)] diff --git a/src/tools/clippy/clippy_config/src/lib.rs b/src/tools/clippy/clippy_config/src/lib.rs index 67904b4fcdc8..a565a21a0e77 100644 --- a/src/tools/clippy/clippy_config/src/lib.rs +++ b/src/tools/clippy/clippy_config/src/lib.rs @@ -9,8 +9,6 @@ #![allow( clippy::must_use_candidate, clippy::missing_panics_doc, - rustc::diagnostic_outside_of_impl, - rustc::untranslatable_diagnostic )] #![deny(clippy::derive_deserialize_allowing_unknown)] diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index a957afdb1910..ae236ac25de7 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -14,8 +14,6 @@ #![allow( clippy::missing_docs_in_private_items, clippy::must_use_candidate, - rustc::diagnostic_outside_of_impl, - rustc::untranslatable_diagnostic, clippy::literal_string_with_formatting_args )] #![warn( diff --git a/src/tools/clippy/clippy_lints_internal/src/lib.rs b/src/tools/clippy/clippy_lints_internal/src/lib.rs index cca5608fa6be..e009f263f11f 100644 --- a/src/tools/clippy/clippy_lints_internal/src/lib.rs +++ b/src/tools/clippy/clippy_lints_internal/src/lib.rs @@ -3,8 +3,6 @@ clippy::missing_docs_in_private_items, clippy::must_use_candidate, clippy::symbol_as_str, - rustc::diagnostic_outside_of_impl, - rustc::untranslatable_diagnostic )] #![warn( trivial_casts, diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 2a620e917228..9b6a9937b8ac 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -11,8 +11,6 @@ clippy::missing_errors_doc, clippy::missing_panics_doc, clippy::must_use_candidate, - rustc::diagnostic_outside_of_impl, - rustc::untranslatable_diagnostic )] #![warn( trivial_casts, diff --git a/src/tools/clippy/src/driver.rs b/src/tools/clippy/src/driver.rs index 8693973ef78c..c9ca6335de6e 100644 --- a/src/tools/clippy/src/driver.rs +++ b/src/tools/clippy/src/driver.rs @@ -1,5 +1,3 @@ -#![allow(rustc::diagnostic_outside_of_impl)] -#![allow(rustc::untranslatable_diagnostic)] #![feature(rustc_private)] // warn on lints, that are included in `rust-lang/rust`s bootstrap #![warn(rust_2018_idioms, unused_lifetimes)] diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs index a2795f233655..48f8e146a190 100644 --- a/src/tools/miri/src/bin/miri.rs +++ b/src/tools/miri/src/bin/miri.rs @@ -4,8 +4,6 @@ clippy::useless_format, clippy::field_reassign_with_default, clippy::needless_lifetimes, - rustc::diagnostic_outside_of_impl, - rustc::untranslatable_diagnostic )] // The rustc crates we need diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index 7ce2ab3b3a43..5722969a31bf 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -39,11 +39,8 @@ clippy::needless_lifetimes, clippy::too_long_first_doc_paragraph, clippy::len_zero, - // We don't use translatable diagnostics - rustc::diagnostic_outside_of_impl, // We are not implementing queries here so it's fine rustc::potential_query_instability, - rustc::untranslatable_diagnostic, )] #![warn( rust_2018_idioms, diff --git a/src/tools/rustfmt/src/parse/session.rs b/src/tools/rustfmt/src/parse/session.rs index 2fd8bfdaf3e1..d3ff27c51eab 100644 --- a/src/tools/rustfmt/src/parse/session.rs +++ b/src/tools/rustfmt/src/parse/session.rs @@ -349,7 +349,6 @@ mod tests { } fn build_diagnostic(level: DiagnosticLevel, span: Option) -> DiagInner { - #[allow(rustc::untranslatable_diagnostic)] // no translation needed for empty string let mut diag = DiagInner::new(level, ""); diag.messages.clear(); if let Some(span) = span { diff --git a/tests/ui-fulldeps/internal-lints/diagnostics.rs b/tests/ui-fulldeps/internal-lints/diagnostics.rs index 1238fefd5bc0..039a9dcbd4c2 100644 --- a/tests/ui-fulldeps/internal-lints/diagnostics.rs +++ b/tests/ui-fulldeps/internal-lints/diagnostics.rs @@ -4,8 +4,6 @@ #![crate_type = "lib"] #![feature(rustc_attrs)] #![feature(rustc_private)] -#![deny(rustc::untranslatable_diagnostic)] -#![deny(rustc::diagnostic_outside_of_impl)] extern crate rustc_errors; extern crate rustc_fluent_macro; @@ -106,7 +104,6 @@ pub fn make_diagnostics<'a>(dcx: DiagCtxtHandle<'a>) { // `diagnostic_outside_of_impl`. #[rustc_lint_diagnostics] pub fn skipped_because_of_annotation<'a>(dcx: DiagCtxtHandle<'a>) { - #[allow(rustc::untranslatable_diagnostic)] let _diag = dcx.struct_err("untranslatable diagnostic"); // okay! }