Skip to content

Commit eb1df77

Browse files
committed
Make lint messages translatable
1 parent 44c0e13 commit eb1df77

File tree

2 files changed

+117
-85
lines changed

2 files changed

+117
-85
lines changed

compiler/rustc_lint/messages.ftl

+68
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
lint_abs_path_with_module =
2+
absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
3+
4+
lint_ambiguous_glob_reexport = ambiguous glob re-exports
5+
16
lint_ambiguous_wide_pointer_comparisons = ambiguous wide pointer comparison, the comparison includes metadata which may not be expected
27
.addr_metadata_suggestion = use explicit `std::ptr::eq` method to compare metadata and addresses
38
.addr_suggestion = use `std::ptr::addr_eq` or untyped pointers to only compare their addresses
@@ -26,10 +31,19 @@ lint_atomic_ordering_load = atomic loads cannot have `Release` or `AcqRel` order
2631
lint_atomic_ordering_store = atomic stores cannot have `Acquire` or `AcqRel` ordering
2732
.help = consider using ordering modes `Release`, `SeqCst` or `Relaxed`
2833
34+
lint_avoid_att_syntax =
35+
avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
36+
37+
lint_avoid_intel_syntax =
38+
avoid using `.intel_syntax`, Intel syntax is the default
39+
2940
lint_bad_attribute_argument = bad attribute argument
3041
3142
lint_bad_opt_access = {$msg}
3243
44+
lint_break_with_label_and_loop =
45+
this labeled break expression is easy to confuse with an unlabeled break with a labeled value expression
46+
3347
lint_builtin_allow_internal_unsafe =
3448
`allow_internal_unsafe` allows defining macros using unsafe without triggering the `unsafe_code` lint at their call site
3549
@@ -184,6 +198,8 @@ lint_cstring_ptr = getting the inner pointer of a temporary `CString`
184198
.note = pointers do not have a lifetime; when calling `as_ptr` the `CString` will be deallocated at the end of the statement because nothing is referencing it as far as the type system is concerned
185199
.help = for more information, see https://doc.rust-lang.org/reference/destructors.html
186200
201+
lint_custom_inner_attribute_unstable = custom inner attributes are unstable
202+
187203
lint_default_hash_types = prefer `{$preferred}` over `{$used}`, it has better performance
188204
.note = a `use rustc_data_structures::fx::{$preferred}` may be necessary
189205
@@ -214,6 +230,11 @@ lint_dropping_references = calls to `std::mem::drop` with a reference instead of
214230
.label = argument has type `{$arg_ty}`
215231
.note = use `let _ = ...` to ignore the expression or result
216232
233+
lint_duplicate_macro_attribute =
234+
duplicated attribute
235+
236+
lint_elided_lifetime_not_allowed = `'_` cannot be used here
237+
217238
lint_enum_intrinsics_mem_discriminant =
218239
the return value of `mem::discriminant` is unspecified when called with a non-enum type
219240
.note = the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `{$ty_param}`, which is not an enum.
@@ -226,6 +247,8 @@ lint_expectation = this lint expectation is unfulfilled
226247
.note = the `unfulfilled_lint_expectations` lint can't be expected and will always produce this message
227248
.rationale = {$rationale}
228249
250+
lint_extern_crate_not_idiomatic = `extern crate` is not idiomatic in the new edition
251+
229252
lint_extern_without_abi = extern declarations without an explicit ABI are deprecated
230253
231254
lint_for_loops_over_fallibles =
@@ -242,6 +265,10 @@ lint_forgetting_references = calls to `std::mem::forget` with a reference instea
242265
.label = argument has type `{$arg_ty}`
243266
.note = use `let _ = ...` to ignore the expression or result
244267
268+
lint_hidden_glob_reexport = private item shadows public glob re-export
269+
270+
lint_hidden_lifetime_parameters = hidden lifetime parameters in types are deprecated
271+
245272
lint_hidden_unicode_codepoints = unicode codepoint changing visible direction of text present in {$label}
246273
.label = this {$label} contains {$count ->
247274
[one] an invisible
@@ -342,6 +369,13 @@ lint_improper_ctypes_union_layout_help = consider adding a `#[repr(C)]` or `#[re
342369
lint_improper_ctypes_union_layout_reason = this union has unspecified layout
343370
lint_improper_ctypes_union_non_exhaustive = this union is non-exhaustive
344371
372+
lint_incomplete_include =
373+
include macro expected single expression in source
374+
375+
lint_inner_macro_attribute_unstable = inner macro attributes are unstable
376+
377+
lint_invalid_crate_type_value = invalid `crate_type` value
378+
345379
# FIXME: we should ordinalize $valid_up_to when we add support for doing so
346380
lint_invalid_from_utf8_checked = calls to `{$method}` with a invalid literal always return an error
347381
.label = the literal was valid UTF-8 up to the {$valid_up_to} bytes
@@ -370,9 +404,18 @@ lint_invalid_reference_casting_note_book = for more information, visit <https://
370404
371405
lint_invalid_reference_casting_note_ty_has_interior_mutability = even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get`
372406
407+
lint_legacy_derive_helpers =
408+
derive helper attribute is used before it is introduced
409+
373410
lint_lintpass_by_hand = implementing `LintPass` by hand
374411
.help = try using `declare_lint_pass!` or `impl_lint_pass!` instead
375412
413+
lint_macro_expanded_macro_exports_accessed_by_absolute_paths =
414+
macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
415+
416+
lint_macro_use_deprecated =
417+
deprecated `#[macro_use]` attribute used to import macros should be replaced at use sites with a `use` item to import the macro instead
418+
376419
lint_malformed_attribute = malformed lint attribute input
377420
378421
lint_map_unit_fn = `Iterator::map` call that discard the iterator's values
@@ -382,6 +425,8 @@ lint_map_unit_fn = `Iterator::map` call that discard the iterator's values
382425
.map_label = after this call to map, the resulting iterator is `impl Iterator<Item = ()>`, which means the only information carried by the iterator is the number of items
383426
.suggestion = you might have meant to use `Iterator::for_each`
384427
428+
lint_missing_fragment_specifier = missing fragment specifier
429+
385430
lint_mixed_script_confusables =
386431
the usage of Script Group `{$set}` in this crate consists solely of mixed script confusables
387432
.includes_note = the usage includes {$includes}
@@ -498,6 +543,9 @@ lint_opaque_hidden_inferred_bound = opaque type `{$ty}` does not satisfy its ass
498543
499544
lint_opaque_hidden_inferred_bound_sugg = add this bound
500545
546+
lint_or_patterns_back_compat =
547+
the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro
548+
501549
lint_overflowing_bin_hex = literal out of range for `{$ty}`
502550
.negative_note = the literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}`
503551
.negative_becomes_note = and the value `-{$lit}` will become `{$actually}{$ty}`
@@ -533,6 +581,8 @@ lint_pattern_in_bodiless = patterns aren't allowed in functions without bodies
533581
lint_pattern_in_foreign = patterns aren't allowed in foreign function declarations
534582
.label = pattern not allowed in foreign function
535583
584+
lint_proc_macro_back_compat_rental = using an old version of `rental`
585+
536586
lint_ptr_null_checks_fn_ptr = function pointers are not nullable, so checking them for null will always return false
537587
.help = wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
538588
.label = expression has type `{$orig_ty}`
@@ -564,6 +614,8 @@ lint_redundant_semicolons =
564614
*[false] this semicolon
565615
}
566616
617+
lint_reference_without_lifetime_not_allowed = `&` without an explicit lifetime name cannot be used here
618+
567619
lint_removed_lint = lint `{$name}` has been removed: {$reason}
568620
569621
lint_renamed_lint = lint `{$name}` has been renamed to `{$replace}`
@@ -585,6 +637,9 @@ lint_suspicious_double_ref_clone =
585637
lint_suspicious_double_ref_deref =
586638
using `.deref()` on a double reference, which returns `{$ty}` instead of dereferencing the inner type
587639
640+
lint_trailing_semi_macro =
641+
trailing semicolon in macro used in expression position
642+
588643
lint_ty_qualified = usage of qualified `ty::{$ty}`
589644
.suggestion = try importing it and using it unqualified
590645
@@ -601,9 +656,14 @@ lint_undropped_manually_drops = calls to `std::mem::drop` with `std::mem::Manual
601656
lint_ungated_async_fn_track_caller = `#[track_caller]` on async functions is a no-op
602657
.label = this function will not propagate the caller location
603658
659+
lint_unicode_text_flow =
660+
unicode codepoint changing visible direction of text present in comment
661+
604662
lint_unit_bindings = binding has unit type `()`
605663
.label = this pattern is inferred to be the unit type `()`
606664
665+
lint_unknown_diagnostic_attribute = unknown diagnostic attribute
666+
607667
lint_unknown_gated_lint =
608668
unknown lint: `{$name}`
609669
.note = the `{$name}` lint is unstable
@@ -624,6 +684,8 @@ lint_unknown_tool_in_scoped_lint = unknown tool name `{$tool_name}` found in sco
624684
625685
lint_unnameable_test_items = cannot test inner items
626686
687+
lint_unnecessary_qualification = unnecessary qualification
688+
627689
lint_unsupported_group = `{$lint_group}` lint group is not supported with ´--force-warn´
628690
629691
lint_untranslatable_diag = diagnostics should be created using translatable messages
@@ -653,8 +715,14 @@ lint_unused_def = unused {$pre}`{$def}`{$post} that must be used
653715
lint_unused_delim = unnecessary {$delim} around {$item}
654716
.suggestion = remove these {$delim}
655717
718+
lint_unused_doc_comment = unused doc comment
719+
656720
lint_unused_import_braces = braces around {$node} is unnecessary
657721
722+
lint_unused_label = unused label
723+
724+
lint_unused_macro_use = unused `#[macro_use]` import
725+
658726
lint_unused_op = unused {$op} that must be used
659727
.label = the {$op} produces a value
660728
.suggestion = use `let _ = ...` to ignore the resulting value

0 commit comments

Comments
 (0)