mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 02:03:53 +00:00
lint: port query instability diagnostics
Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
e88916cc92
commit
8139542598
@ -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
|
||||
|
@ -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();
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user