lint: port query instability diagnostics

Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
David Wood 2022-06-27 14:50:58 +01:00
parent e88916cc92
commit 8139542598
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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();
})
}