Rollup merge of #90985 - camsteffen:diag-name-usage, r=jackh726
Use `get_diagnostic_name` more
This commit is contained in:
commit
a4f46742c2
6 changed files with 73 additions and 74 deletions
|
@ -539,11 +539,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
// is otherwise overwhelming and unhelpful (see #85844 for an
|
||||
// example).
|
||||
|
||||
let trait_is_debug =
|
||||
self.tcx.is_diagnostic_item(sym::Debug, trait_ref.def_id());
|
||||
let trait_is_display =
|
||||
self.tcx.is_diagnostic_item(sym::Display, trait_ref.def_id());
|
||||
|
||||
let in_std_macro =
|
||||
match obligation.cause.span.ctxt().outer_expn_data().macro_def_id {
|
||||
Some(macro_def_id) => {
|
||||
|
@ -553,7 +548,12 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
|||
None => false,
|
||||
};
|
||||
|
||||
if in_std_macro && (trait_is_debug || trait_is_display) {
|
||||
if in_std_macro
|
||||
&& matches!(
|
||||
self.tcx.get_diagnostic_name(trait_ref.def_id()),
|
||||
Some(sym::Debug | sym::Display)
|
||||
)
|
||||
{
|
||||
err.emit();
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue