diff options
| author | David Wood <david.wood@huawei.com> | 2022-06-27 14:50:58 +0100 |
|---|---|---|
| committer | David Wood <david.wood@huawei.com> | 2022-06-30 08:59:21 +0100 |
| commit | 81395425985edee9260fdf597d3dcf0f67ada4bb (patch) | |
| tree | 1967cd76cbb2dbef7a8c5fdf2cdd17842dc3007f | |
| parent | e88916cc926da547f68ae24e44f11a1a1fa5d34d (diff) | |
| download | rust-81395425985edee9260fdf597d3dcf0f67ada4bb.tar.gz rust-81395425985edee9260fdf597d3dcf0f67ada4bb.zip | |
lint: port query instability diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
| -rw-r--r-- | compiler/rustc_error_messages/locales/en-US/lint.ftl | 3 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/internal.rs | 9 |
2 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_error_messages/locales/en-US/lint.ftl b/compiler/rustc_error_messages/locales/en-US/lint.ftl index ff6feb46868..5b793ed93e8 100644 --- a/compiler/rustc_error_messages/locales/en-US/lint.ftl +++ b/compiler/rustc_error_messages/locales/en-US/lint.ftl @@ -31,3 +31,6 @@ lint-hidden-unicode-codepoints = unicode codepoint changing visible direction of lint-default-hash-types = prefer `{$preferred}` over `{$used}`, it has better performance .note = a `use rustc_data_structures::fx::{$preferred}` may be necessary + +lint-query-instability = using `{$query}` can result in unstable query results + .note = if you believe this case to be fine, allow this lint and add a comment explaining your rationale diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs index 24e58bbcb00..90274503274 100644 --- a/compiler/rustc_lint/src/internal.rs +++ b/compiler/rustc_lint/src/internal.rs @@ -96,12 +96,9 @@ impl LateLintPass<'_> for QueryStability { let def_id = instance.def_id(); if cx.tcx.has_attr(def_id, sym::rustc_lint_query_instability) { cx.struct_span_lint(POTENTIAL_QUERY_INSTABILITY, span, |lint| { - let msg = format!( - "using `{}` can result in unstable query results", - cx.tcx.item_name(def_id) - ); - lint.build(&msg) - .note("if you believe this case to be fine, allow this lint and add a comment explaining your rationale") + lint.build(fluent::lint::query_instability) + .set_arg("query", cx.tcx.item_name(def_id)) + .note(fluent::lint::note) .emit(); }) } |
