Skip to content

Commit d83d20c

Browse files
committed
Convert early lints to diag structs
1 parent 542da06 commit d83d20c

File tree

10 files changed

+459
-244
lines changed

10 files changed

+459
-244
lines changed

compiler/rustc_lint/messages.ftl

+46-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
lint_abs_path_with_module =
2-
absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
1+
lint_abs_path_with_module = absolute paths must start with `self`, `super`, `crate`, or an external crate name in the 2018 edition
2+
.suggestion = use `crate`
33
44
lint_ambiguous_glob_reexport = ambiguous glob re-exports
55
@@ -235,6 +235,8 @@ lint_dropping_references = calls to `std::mem::drop` with a reference instead of
235235
lint_duplicate_macro_attribute =
236236
duplicated attribute
237237
238+
lint_duplicate_matcher_binding = duplicate matcher binding
239+
238240
lint_elided_lifetime_not_allowed = `'_` cannot be used here
239241
240242
lint_enum_intrinsics_mem_discriminant =
@@ -312,6 +314,11 @@ lint_identifier_uncommon_codepoints = identifier contains {$codepoints_len ->
312314
313315
lint_ignored_unless_crate_specified = {$level}({$name}) is ignored unless specified at crate level
314316
317+
lint_ill_formed_attribute_input = {$num_suggestions ->
318+
[1] attribute must be of the form {$suggestions}
319+
*[other] valid forms for the attribute are {$suggestions}
320+
}
321+
315322
lint_improper_ctypes = `extern` {$desc} uses type `{$ty}`, which is not FFI-safe
316323
.label = not FFI-safe
317324
.note = the type is defined here
@@ -412,8 +419,18 @@ lint_legacy_derive_helpers =
412419
lint_lintpass_by_hand = implementing `LintPass` by hand
413420
.help = try using `declare_lint_pass!` or `impl_lint_pass!` instead
414421
415-
lint_macro_expanded_macro_exports_accessed_by_absolute_paths =
416-
macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
422+
lint_macro_expanded_macro_exports_accessed_by_absolute_paths = macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
423+
.note = the macro is defined here
424+
425+
lint_macro_is_private = macro `{$ident}` is private
426+
427+
lint_macro_rule_never_used = {NUMBER($n, type: "ordinal") ->
428+
[1] first
429+
[one] {$n}st
430+
[two] {$n}nd
431+
[few] {$n}rd
432+
*[other] {$n}th
433+
} rule of macro `{$name}` is never used
417434
418435
lint_macro_use_deprecated =
419436
deprecated `#[macro_use]` attribute used to import macros should be replaced at use sites with a `use` item to import the macro instead
@@ -427,6 +444,10 @@ lint_map_unit_fn = `Iterator::map` call that discard the iterator's values
427444
.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
428445
.suggestion = you might have meant to use `Iterator::for_each`
429446
447+
lint_metavariable_still_repeating = variable '{$name}' is still repeating at this depth
448+
449+
lint_metavariable_wrong_operator = meta-variable repeats with different Kleene operator
450+
430451
lint_missing_fragment_specifier = missing fragment specifier
431452
432453
lint_mixed_script_confusables =
@@ -583,8 +604,14 @@ lint_pattern_in_bodiless = patterns aren't allowed in functions without bodies
583604
lint_pattern_in_foreign = patterns aren't allowed in foreign function declarations
584605
.label = pattern not allowed in foreign function
585606
607+
lint_private_extern_crate_reexport =
608+
extern crate `{$ident}` is private, and cannot be re-exported (error E0365), consider declaring with `pub`
609+
586610
lint_proc_macro_back_compat_rental = using an old version of `rental`
587611
612+
lint_proc_macro_derive_resolution_fallback = cannot find {$ns} `{$ident}` in this scope
613+
.label = names from parent modules are not accessible without an explicit import
614+
588615
lint_ptr_null_checks_fn_ptr = function pointers are not nullable, so checking them for null will always return false
589616
.help = wrap the function pointer inside an `Option` and use `Option::is_none` to check for null pointer value
590617
.label = expression has type `{$orig_ty}`
@@ -658,8 +685,15 @@ lint_undropped_manually_drops = calls to `std::mem::drop` with `std::mem::Manual
658685
lint_ungated_async_fn_track_caller = `#[track_caller]` on async functions is a no-op
659686
.label = this function will not propagate the caller location
660687
661-
lint_unicode_text_flow =
662-
unicode codepoint changing visible direction of text present in comment
688+
lint_unicode_text_flow = unicode codepoint changing visible direction of text present in comment
689+
.label = {$num_codepoints ->
690+
[1] this comment contains an invisible unicode text flow control codepoint
691+
*[other] this comment contains invisible unicode text flow control codepoints
692+
}
693+
.note = these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen
694+
.suggestion = if their presence wasn't intentional, you can remove them
695+
.label_comment_char = {$c_debug}
696+
663697
664698
lint_unit_bindings = binding has unit type `()`
665699
.label = this pattern is inferred to be the unit type `()`
@@ -681,6 +715,8 @@ lint_unknown_lint =
681715
*[false] did you mean: `{$replace}`
682716
}
683717
718+
lint_unknown_macro_variable = unknown macro variable `{$name}`
719+
684720
lint_unknown_tool_in_scoped_lint = unknown tool name `{$tool_name}` found in scoped lint: `{$tool_name}::{$lint_name}`
685721
.help = add `#![register_tool({$tool_name})]` to the crate root
686722
@@ -711,6 +747,8 @@ lint_unused_coroutine =
711747
}{$post} that must be used
712748
.note = coroutines are lazy and do nothing unless resumed
713749
750+
lint_unused_crate_dependency = external crate `{$extern_crate}` unused in `{$local_crate}`: remove the dependency or add `use {$extern_crate} as _;`
751+
714752
lint_unused_def = unused {$pre}`{$def}`{$post} that must be used
715753
.suggestion = use `let _ = ...` to ignore the resulting value
716754
@@ -723,6 +761,8 @@ lint_unused_import_braces = braces around {$node} is unnecessary
723761
724762
lint_unused_label = unused label
725763
764+
lint_unused_macro_definition = unused macro definition: `{$name}`
765+
726766
lint_unused_macro_use = unused `#[macro_use]` import
727767
728768
lint_unused_op = unused {$op} that must be used

0 commit comments

Comments
 (0)