mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercote
Get rid of some `#[allow(rustc::untranslatable_diagnostic)]` `@rustbot` label +A-translation cc https://github.com/rust-lang/rust/issues/100717
This commit is contained in:
commit
ea74eff55c
@ -167,11 +167,23 @@ ast_lowering_template_modifier = template modifier
|
||||
|
||||
ast_lowering_this_not_async = this is not `async`
|
||||
|
||||
ast_lowering_underscore_array_length_unstable =
|
||||
using `_` for array lengths is unstable
|
||||
|
||||
ast_lowering_underscore_expr_lhs_assign =
|
||||
in expressions, `_` can only be used on the left-hand side of an assignment
|
||||
.label = `_` not allowed here
|
||||
|
||||
ast_lowering_unstable_inline_assembly = inline assembly is not stable yet on this architecture
|
||||
ast_lowering_unstable_inline_assembly_const_operands =
|
||||
const operands for inline assembly are unstable
|
||||
ast_lowering_unstable_inline_assembly_label_operands =
|
||||
label operands for inline assembly are unstable
|
||||
ast_lowering_unstable_may_unwind = the `may_unwind` option is unstable
|
||||
|
||||
ast_lowering_use_angle_brackets = use angle brackets instead
|
||||
|
||||
ast_lowering_yield = yield syntax is experimental
|
||||
ast_lowering_yield_in_closure =
|
||||
`yield` can only be used in `#[coroutine]` closures, or `gen` blocks
|
||||
.suggestion = use `#[coroutine]` to make this closure a coroutine
|
||||
|
@ -19,10 +19,12 @@ use super::errors::{
|
||||
InvalidRegisterClass, RegisterClassOnlyClobber, RegisterConflict,
|
||||
};
|
||||
use super::LoweringContext;
|
||||
use crate::{ImplTraitContext, ImplTraitPosition, ParamMode, ResolverAstLoweringExt};
|
||||
use crate::{
|
||||
fluent_generated as fluent, ImplTraitContext, ImplTraitPosition, ParamMode,
|
||||
ResolverAstLoweringExt,
|
||||
};
|
||||
|
||||
impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
pub(crate) fn lower_inline_asm(
|
||||
&mut self,
|
||||
sp: Span,
|
||||
@ -52,7 +54,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
&self.tcx.sess,
|
||||
sym::asm_experimental_arch,
|
||||
sp,
|
||||
"inline assembly is not stable yet on this architecture",
|
||||
fluent::ast_lowering_unstable_inline_assembly,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
@ -64,8 +66,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
self.dcx().emit_err(AttSyntaxOnlyX86 { span: sp });
|
||||
}
|
||||
if asm.options.contains(InlineAsmOptions::MAY_UNWIND) && !self.tcx.features().asm_unwind {
|
||||
feature_err(&self.tcx.sess, sym::asm_unwind, sp, "the `may_unwind` option is unstable")
|
||||
.emit();
|
||||
feature_err(
|
||||
&self.tcx.sess,
|
||||
sym::asm_unwind,
|
||||
sp,
|
||||
fluent::ast_lowering_unstable_may_unwind,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
||||
let mut clobber_abis = FxIndexMap::default();
|
||||
@ -182,7 +189,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
sess,
|
||||
sym::asm_const,
|
||||
*op_sp,
|
||||
"const operands for inline assembly are unstable",
|
||||
fluent::ast_lowering_unstable_inline_assembly_const_operands,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
@ -246,7 +253,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
sess,
|
||||
sym::asm_goto,
|
||||
*op_sp,
|
||||
"label operands for inline assembly are unstable",
|
||||
fluent::ast_lowering_unstable_inline_assembly_label_operands,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ use super::{
|
||||
ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs, ResolverAstLoweringExt,
|
||||
};
|
||||
use crate::errors::YieldInClosure;
|
||||
use crate::{FnDeclKind, ImplTraitPosition};
|
||||
use crate::{fluent_generated, FnDeclKind, ImplTraitPosition};
|
||||
|
||||
impl<'hir> LoweringContext<'_, 'hir> {
|
||||
fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] {
|
||||
@ -1540,7 +1540,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn lower_expr_yield(&mut self, span: Span, opt_expr: Option<&Expr>) -> hir::ExprKind<'hir> {
|
||||
let yielded =
|
||||
opt_expr.as_ref().map(|x| self.lower_expr(x)).unwrap_or_else(|| self.expr_unit(span));
|
||||
@ -1575,7 +1574,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
&self.tcx.sess,
|
||||
sym::coroutines,
|
||||
span,
|
||||
"yield syntax is experimental",
|
||||
fluent_generated::ast_lowering_yield,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
@ -1587,7 +1586,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
&self.tcx.sess,
|
||||
sym::coroutines,
|
||||
span,
|
||||
"yield syntax is experimental",
|
||||
fluent_generated::ast_lowering_yield,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
@ -2326,7 +2326,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
self.expr_block(block)
|
||||
}
|
||||
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn lower_array_length(&mut self, c: &AnonConst) -> hir::ArrayLen<'hir> {
|
||||
match c.value.kind {
|
||||
ExprKind::Underscore => {
|
||||
@ -2340,7 +2339,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
&self.tcx.sess,
|
||||
sym::generic_arg_infer,
|
||||
c.value.span,
|
||||
"using `_` for array lengths is unstable",
|
||||
fluent_generated::ast_lowering_underscore_array_length_unstable,
|
||||
)
|
||||
.stash(c.value.span, StashKey::UnderscoreForArrayLengths);
|
||||
hir::ArrayLen::Body(self.lower_anon_const_to_const_arg(c))
|
||||
|
@ -104,6 +104,9 @@ attr_unknown_meta_item =
|
||||
attr_unknown_version_literal =
|
||||
unknown version literal format, assuming it refers to a future version
|
||||
|
||||
attr_unstable_cfg_target_compact =
|
||||
compact `cfg(target(..))` is experimental and subject to change
|
||||
|
||||
attr_unsupported_literal_cfg_string =
|
||||
literal in `cfg` predicate value must be a string
|
||||
attr_unsupported_literal_deprecated_kv_pair =
|
||||
|
@ -20,6 +20,7 @@ use rustc_span::hygiene::Transparency;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::Span;
|
||||
|
||||
use crate::fluent_generated;
|
||||
use crate::session_diagnostics::{self, IncorrectReprFormatGenericCause};
|
||||
|
||||
/// The version placeholder that recently stabilized features contain inside the
|
||||
@ -521,7 +522,6 @@ pub struct Condition {
|
||||
}
|
||||
|
||||
/// Tests if a cfg-pattern matches the cfg set
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
pub fn cfg_matches(
|
||||
cfg: &ast::MetaItem,
|
||||
sess: &Session,
|
||||
@ -593,7 +593,6 @@ pub fn parse_version(s: Symbol) -> Option<RustcVersion> {
|
||||
|
||||
/// Evaluate a cfg-like condition (with `any` and `all`), using `eval` to
|
||||
/// evaluate individual items.
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
pub fn eval_condition(
|
||||
cfg: &ast::MetaItem,
|
||||
sess: &Session,
|
||||
@ -680,7 +679,7 @@ pub fn eval_condition(
|
||||
sess,
|
||||
sym::cfg_target_compact,
|
||||
cfg.span,
|
||||
"compact `cfg(target(..))` is experimental and subject to change",
|
||||
fluent_generated::attr_unstable_cfg_target_compact,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
@ -62,6 +62,9 @@ borrowck_could_not_normalize =
|
||||
borrowck_could_not_prove =
|
||||
could not prove `{$predicate}`
|
||||
|
||||
borrowck_dereference_suggestion =
|
||||
dereference the return value
|
||||
|
||||
borrowck_func_take_self_moved_place =
|
||||
`{$func}` takes ownership of the receiver `self`, which moves {$place_name}
|
||||
|
||||
@ -74,9 +77,24 @@ borrowck_higher_ranked_lifetime_error =
|
||||
borrowck_higher_ranked_subtype_error =
|
||||
higher-ranked subtype error
|
||||
|
||||
borrowck_implicit_static =
|
||||
this has an implicit `'static` lifetime requirement
|
||||
|
||||
borrowck_implicit_static_introduced =
|
||||
calling this method introduces the `impl`'s `'static` requirement
|
||||
|
||||
borrowck_implicit_static_relax =
|
||||
consider relaxing the implicit `'static` requirement
|
||||
|
||||
borrowck_lifetime_constraints_error =
|
||||
lifetime may not live long enough
|
||||
|
||||
borrowck_limitations_implies_static =
|
||||
due to current limitations in the borrow checker, this implies a `'static` lifetime
|
||||
|
||||
borrowck_move_closure_suggestion =
|
||||
consider adding 'move' keyword before the nested closure
|
||||
|
||||
borrowck_move_out_place_here =
|
||||
{$place} is moved here
|
||||
|
||||
@ -163,6 +181,9 @@ borrowck_partial_var_move_by_use_in_coroutine =
|
||||
*[false] moved
|
||||
} due to use in coroutine
|
||||
|
||||
borrowck_restrict_to_static =
|
||||
consider restricting the type parameter to the `'static` lifetime
|
||||
|
||||
borrowck_returned_async_block_escaped =
|
||||
returns an `async` block that contains a reference to a captured variable, which then escapes the closure body
|
||||
|
||||
|
@ -35,7 +35,7 @@ use crate::session_diagnostics::{
|
||||
LifetimeReturnCategoryErr, RequireStaticErr, VarHereDenote,
|
||||
};
|
||||
use crate::universal_regions::DefiningTy;
|
||||
use crate::{borrowck_errors, MirBorrowckCtxt};
|
||||
use crate::{borrowck_errors, fluent_generated as fluent, MirBorrowckCtxt};
|
||||
|
||||
impl<'tcx> ConstraintDescription for ConstraintCategory<'tcx> {
|
||||
fn description(&self) -> &'static str {
|
||||
@ -198,7 +198,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
|
||||
// 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)]
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn suggest_static_lifetime_for_gat_from_hrtb(
|
||||
&self,
|
||||
diag: &mut Diag<'_>,
|
||||
@ -251,23 +250,28 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
|
||||
debug!(?hrtb_bounds);
|
||||
|
||||
hrtb_bounds.iter().for_each(|bound| {
|
||||
let Trait(PolyTraitRef { trait_ref, span: trait_span, .. }, _) = bound else { return; };
|
||||
diag.span_note(
|
||||
*trait_span,
|
||||
"due to current limitations in the borrow checker, this implies a `'static` lifetime"
|
||||
);
|
||||
let Some(generics_fn) = hir.get_generics(self.body.source.def_id().expect_local()) else { return; };
|
||||
let Def(_, trait_res_defid) = trait_ref.path.res else { return; };
|
||||
let Trait(PolyTraitRef { trait_ref, span: trait_span, .. }, _) = bound else {
|
||||
return;
|
||||
};
|
||||
diag.span_note(*trait_span, fluent::borrowck_limitations_implies_static);
|
||||
let Some(generics_fn) = hir.get_generics(self.body.source.def_id().expect_local())
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let Def(_, trait_res_defid) = trait_ref.path.res else {
|
||||
return;
|
||||
};
|
||||
debug!(?generics_fn);
|
||||
generics_fn.predicates.iter().for_each(|predicate| {
|
||||
let BoundPredicate(
|
||||
WhereBoundPredicate {
|
||||
span: bounded_span,
|
||||
bounded_ty,
|
||||
bounds,
|
||||
..
|
||||
}
|
||||
) = predicate else { return; };
|
||||
let BoundPredicate(WhereBoundPredicate {
|
||||
span: bounded_span,
|
||||
bounded_ty,
|
||||
bounds,
|
||||
..
|
||||
}) = predicate
|
||||
else {
|
||||
return;
|
||||
};
|
||||
bounds.iter().for_each(|bd| {
|
||||
if let Trait(PolyTraitRef { trait_ref: tr_ref, .. }, _) = bd
|
||||
&& let Def(_, res_defid) = tr_ref.path.res
|
||||
@ -277,16 +281,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
|
||||
&& generics_fn.params
|
||||
.iter()
|
||||
.rfind(|param| param.def_id.to_def_id() == defid)
|
||||
.is_some() {
|
||||
suggestions.push((bounded_span.shrink_to_hi(), " + 'static".to_string()));
|
||||
}
|
||||
.is_some()
|
||||
{
|
||||
suggestions.push((bounded_span.shrink_to_hi(), " + 'static".to_string()));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
if suggestions.len() > 0 {
|
||||
suggestions.dedup();
|
||||
diag.multipart_suggestion_verbose(
|
||||
"consider restricting the type parameter to the `'static` lifetime",
|
||||
fluent::borrowck_restrict_to_static,
|
||||
suggestions,
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
@ -976,7 +981,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
|
||||
}
|
||||
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
#[instrument(skip(self, err), level = "debug")]
|
||||
fn suggest_constrain_dyn_trait_in_impl(
|
||||
&self,
|
||||
@ -994,16 +998,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
|
||||
debug!("trait spans found: {:?}", traits);
|
||||
for span in &traits {
|
||||
let mut multi_span: MultiSpan = vec![*span].into();
|
||||
multi_span
|
||||
.push_span_label(*span, "this has an implicit `'static` lifetime requirement");
|
||||
multi_span.push_span_label(
|
||||
ident.span,
|
||||
"calling this method introduces the `impl`'s `'static` requirement",
|
||||
);
|
||||
multi_span.push_span_label(*span, fluent::borrowck_implicit_static);
|
||||
multi_span.push_span_label(ident.span, fluent::borrowck_implicit_static_introduced);
|
||||
err.subdiagnostic(RequireStaticErr::UsedImpl { multi_span });
|
||||
err.span_suggestion_verbose(
|
||||
span.shrink_to_hi(),
|
||||
"consider relaxing the implicit `'static` requirement",
|
||||
fluent::borrowck_implicit_static_relax,
|
||||
" + '_",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
@ -1045,7 +1045,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
|
||||
}
|
||||
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
/// 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.
|
||||
@ -1166,7 +1165,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
|
||||
if ocx.select_all_or_error().is_empty() && count > 0 {
|
||||
diag.span_suggestion_verbose(
|
||||
tcx.hir().body(*body).value.peel_blocks().span.shrink_to_lo(),
|
||||
"dereference the return value",
|
||||
fluent::borrowck_dereference_suggestion,
|
||||
"*".repeat(count),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
@ -1174,7 +1173,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
|
||||
}
|
||||
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn suggest_move_on_borrowing_closure(&self, diag: &mut Diag<'_>) {
|
||||
let map = self.infcx.tcx.hir();
|
||||
let body = map.body_owned_by(self.mir_def_id());
|
||||
@ -1213,7 +1211,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> {
|
||||
if let Some(closure_span) = closure_span {
|
||||
diag.span_suggestion_verbose(
|
||||
closure_span,
|
||||
"consider adding 'move' keyword before the nested closure",
|
||||
fluent::borrowck_move_closure_suggestion,
|
||||
"move ",
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
|
@ -41,6 +41,8 @@ const_eval_const_context = {$kind ->
|
||||
*[other] {""}
|
||||
}
|
||||
|
||||
const_eval_const_stable = const-stable functions can only call other const-stable functions
|
||||
|
||||
const_eval_copy_nonoverlapping_overlapping =
|
||||
`copy_nonoverlapping` called on overlapping ranges
|
||||
|
||||
@ -201,6 +203,9 @@ const_eval_invalid_vtable_pointer =
|
||||
const_eval_invalid_vtable_trait =
|
||||
using vtable for trait `{$vtable_trait}` but trait `{$expected_trait}` was expected
|
||||
|
||||
const_eval_lazy_lock =
|
||||
consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`
|
||||
|
||||
const_eval_live_drop =
|
||||
destructor of `{$dropped_ty}` cannot be evaluated at compile-time
|
||||
.label = the destructor for this type cannot be evaluated in {const_eval_const_context}s
|
||||
|
@ -23,7 +23,7 @@ use rustc_trait_selection::traits::SelectionContext;
|
||||
use tracing::debug;
|
||||
|
||||
use super::ConstCx;
|
||||
use crate::errors;
|
||||
use crate::{errors, fluent_generated};
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum Status {
|
||||
@ -310,7 +310,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
|
||||
}
|
||||
|
||||
if let ConstContext::Static(_) = ccx.const_kind() {
|
||||
err.note("consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`");
|
||||
err.note(fluent_generated::const_eval_lazy_lock);
|
||||
}
|
||||
|
||||
err
|
||||
@ -334,7 +334,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable {
|
||||
// FIXME: make this translatable
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
if ccx.is_const_stable_const_fn() {
|
||||
err.help("const-stable functions can only call other const-stable functions");
|
||||
err.help(fluent_generated::const_eval_const_stable);
|
||||
} else if ccx.tcx.sess.is_nightly_build() {
|
||||
if let Some(feature) = feature {
|
||||
err.help(format!("add `#![feature({feature})]` to the crate attributes to enable"));
|
||||
@ -605,8 +605,6 @@ impl<'tcx> NonConstOp<'tcx> for StaticAccess {
|
||||
span,
|
||||
format!("referencing statics in {}s is unstable", ccx.const_kind(),),
|
||||
);
|
||||
// FIXME: make this translatable
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
err
|
||||
.note("`static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.")
|
||||
.help("to fix this, the value can be extracted to a `const` and then used.");
|
||||
|
@ -129,6 +129,9 @@ expand_module_multiple_candidates =
|
||||
expand_must_repeat_once =
|
||||
this must repeat at least once
|
||||
|
||||
expand_non_inline_modules_in_proc_macro_input_are_unstable =
|
||||
non-inline modules in proc macro input are unstable
|
||||
|
||||
expand_not_a_meta_item =
|
||||
not a meta item
|
||||
|
||||
|
@ -1398,8 +1398,6 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &Session) {
|
||||
};
|
||||
|
||||
if crate_matches {
|
||||
// FIXME: make this translatable
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
sess.dcx().emit_fatal(errors::ProcMacroBackCompat {
|
||||
crate_name: "rental".to_string(),
|
||||
fixed_version: "0.5.6".to_string(),
|
||||
|
@ -39,6 +39,7 @@ use crate::errors::{
|
||||
RecursionLimitReached, RemoveExprNotSupported, RemoveNodeNotSupported, UnsupportedKeyValue,
|
||||
WrongFragmentKind,
|
||||
};
|
||||
use crate::fluent_generated;
|
||||
use crate::mbe::diagnostics::annotate_err_with_kind;
|
||||
use crate::module::{mod_dir_path, parse_external_mod, DirOwnership, ParsedExternalMod};
|
||||
use crate::placeholders::{placeholder, PlaceholderExpander};
|
||||
@ -882,7 +883,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||
}
|
||||
|
||||
impl<'ast, 'a> Visitor<'ast> for GateProcMacroInput<'a> {
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn visit_item(&mut self, item: &'ast ast::Item) {
|
||||
match &item.kind {
|
||||
ItemKind::Mod(_, mod_kind)
|
||||
@ -892,7 +892,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||
self.sess,
|
||||
sym::proc_macro_hygiene,
|
||||
item.span,
|
||||
"non-inline modules in proc macro input are unstable",
|
||||
fluent_generated::expand_non_inline_modules_in_proc_macro_input_are_unstable,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
@ -1876,7 +1876,6 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
|
||||
|
||||
// Detect use of feature-gated or invalid attributes on macro invocations
|
||||
// since they will not be detected after macro expansion.
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn check_attributes(&self, attrs: &[ast::Attribute], call: &ast::MacCall) {
|
||||
let features = self.cx.ecfg.features;
|
||||
let mut attrs = attrs.iter().peekable();
|
||||
|
@ -386,7 +386,6 @@ fn get_codegen_sysroot(
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
pub(crate) fn check_attr_crate_type(
|
||||
sess: &Session,
|
||||
attrs: &[ast::Attribute],
|
||||
|
@ -717,7 +717,6 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
|
||||
};
|
||||
}
|
||||
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn add(&mut self, attrs: &[ast::Attribute], is_crate_node: bool, source_hir_id: Option<HirId>) {
|
||||
let sess = self.sess;
|
||||
for (attr_index, attr) in attrs.iter().enumerate() {
|
||||
@ -1039,7 +1038,6 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
|
||||
let (level, src) = self.lint_level(builtin::UNKNOWN_LINTS);
|
||||
// FIXME: make this translatable
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
lint_level(self.sess, lint, level, src, Some(span.into()), |lint| {
|
||||
lint.primary_message(fluent::lint_unknown_gated_lint);
|
||||
lint.arg("name", lint_id.lint.name_lower());
|
||||
|
@ -134,12 +134,18 @@ metadata_lib_framework_apple =
|
||||
metadata_lib_required =
|
||||
crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form
|
||||
|
||||
metadata_link_arg_unstable =
|
||||
link kind `link-arg` is unstable
|
||||
|
||||
metadata_link_cfg_form =
|
||||
link cfg must be of the form `cfg(/* predicate */)`
|
||||
|
||||
metadata_link_cfg_single_predicate =
|
||||
link cfg must have a single predicate argument
|
||||
|
||||
metadata_link_cfg_unstable =
|
||||
link cfg is unstable
|
||||
|
||||
metadata_link_framework_apple =
|
||||
link kind `framework` is only supported on Apple targets
|
||||
|
||||
|
@ -949,7 +949,6 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn report_unused_deps(&mut self, krate: &ast::Crate) {
|
||||
// Make a point span rather than covering the whole file
|
||||
let span = krate.spans.inner_span.shrink_to_lo();
|
||||
|
@ -17,7 +17,7 @@ use rustc_span::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
use crate::errors;
|
||||
use crate::{errors, fluent_generated};
|
||||
|
||||
pub fn find_native_static_library(name: &str, verbatim: bool, sess: &Session) -> PathBuf {
|
||||
let formats = if verbatim {
|
||||
@ -87,7 +87,6 @@ struct Collector<'tcx> {
|
||||
}
|
||||
|
||||
impl<'tcx> Collector<'tcx> {
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn process_module(&mut self, module: &ForeignModule) {
|
||||
let ForeignModule { def_id, abi, ref foreign_items } = *module;
|
||||
let def_id = def_id.expect_local();
|
||||
@ -161,7 +160,7 @@ impl<'tcx> Collector<'tcx> {
|
||||
sess,
|
||||
sym::link_arg_attribute,
|
||||
span,
|
||||
"link kind `link-arg` is unstable",
|
||||
fluent_generated::metadata_link_arg_unstable,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
@ -201,8 +200,13 @@ impl<'tcx> Collector<'tcx> {
|
||||
continue;
|
||||
};
|
||||
if !features.link_cfg {
|
||||
feature_err(sess, sym::link_cfg, item.span(), "link cfg is unstable")
|
||||
.emit();
|
||||
feature_err(
|
||||
sess,
|
||||
sym::link_cfg,
|
||||
item.span(),
|
||||
fluent_generated::metadata_link_cfg_unstable,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
cfg = Some(link_cfg.clone());
|
||||
}
|
||||
@ -266,6 +270,8 @@ impl<'tcx> Collector<'tcx> {
|
||||
|
||||
macro report_unstable_modifier($feature: ident) {
|
||||
if !features.$feature {
|
||||
// FIXME: make this translatable
|
||||
#[expect(rustc::untranslatable_diagnostic)]
|
||||
feature_err(
|
||||
sess,
|
||||
sym::$feature,
|
||||
|
@ -223,6 +223,9 @@ passes_doc_masked_only_extern_crate =
|
||||
.not_an_extern_crate_label = not an `extern crate` item
|
||||
.note = read <https://doc.rust-lang.org/unstable-book/language-features/doc-masked.html> for more information
|
||||
|
||||
passes_doc_rust_logo =
|
||||
the `#[doc(rust_logo)]` attribute is used for Rust branding
|
||||
|
||||
passes_doc_test_literal = `#![doc(test(...)]` does not take a literal
|
||||
|
||||
passes_doc_test_takes_list =
|
||||
@ -595,6 +598,9 @@ passes_remove_fields =
|
||||
*[other] fields
|
||||
}
|
||||
|
||||
passes_repr_align_function =
|
||||
`repr(align)` attributes on functions are unstable
|
||||
|
||||
passes_repr_conflicting =
|
||||
conflicting representation hints
|
||||
|
||||
|
@ -1142,7 +1142,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
/// of one item. Read the documentation of [`check_doc_inline`] for more information.
|
||||
///
|
||||
/// [`check_doc_inline`]: Self::check_doc_inline
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn check_doc_attrs(
|
||||
&self,
|
||||
attr: &Attribute,
|
||||
@ -1220,7 +1219,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
&self.tcx.sess,
|
||||
sym::rustdoc_internals,
|
||||
meta.span(),
|
||||
"the `#[doc(rust_logo)]` attribute is used for Rust branding",
|
||||
fluent::passes_doc_rust_logo,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
@ -1736,7 +1735,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
}
|
||||
|
||||
/// Checks if the `#[repr]` attributes on `item` are valid.
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn check_repr(
|
||||
&self,
|
||||
attrs: &[Attribute],
|
||||
@ -1793,7 +1791,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
||||
&self.tcx.sess,
|
||||
sym::fn_align,
|
||||
hint.span(),
|
||||
"`repr(align)` attributes on functions are unstable",
|
||||
fluent::passes_repr_align_function,
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
|
@ -106,7 +106,6 @@ fn check_and_search_item(id: ItemId, ctxt: &mut EntryContext<'_>) {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
|
||||
fn configure_main(tcx: TyCtxt<'_>, visitor: &EntryContext<'_>) -> Option<(DefId, EntryFnType)> {
|
||||
if let Some((def_id, _)) = visitor.start_fn {
|
||||
Some((def_id.to_def_id(), EntryFnType::Start))
|
||||
|
@ -73,7 +73,6 @@ LL | let _ = || yield true;
|
||||
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
|
||||
= help: add `#![feature(coroutines)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
|
||||
--> $DIR/gen_block.rs:16:16
|
||||
@ -95,7 +94,6 @@ LL | let _ = #[coroutine] || yield true;
|
||||
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
|
||||
= help: add `#![feature(coroutines)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
|
@ -47,7 +47,6 @@ LL | yield true;
|
||||
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
|
||||
= help: add `#![feature(coroutines)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
|
||||
--> $DIR/feature-gate-coroutines.rs:5:5
|
||||
@ -69,7 +68,6 @@ LL | let _ = || yield true;
|
||||
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
|
||||
= help: add `#![feature(coroutines)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||
|
||||
error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
|
||||
--> $DIR/feature-gate-coroutines.rs:10:16
|
||||
|
Loading…
Reference in New Issue
Block a user