Use ty::List instead of InternalSubsts

This commit is contained in:
Oli Scherer 2022-11-17 10:24:55 +00:00
parent 250dcf421a
commit 48ff6a95b5

View File

@ -5,7 +5,6 @@ use rustc_hir as hir;
use rustc_infer::infer::TyCtxtInferExt;
use rustc_middle::lint::in_external_macro;
use rustc_middle::ty;
use rustc_middle::ty::subst::InternalSubsts;
use rustc_parse_format::{ParseMode, Parser, Piece};
use rustc_session::lint::FutureIncompatibilityReason;
use rustc_span::edition::Edition;
@ -154,15 +153,11 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
let infcx = cx.tcx.infer_ctxt().build();
let suggest_display = is_str
|| cx.tcx.get_diagnostic_item(sym::Display).map(|t| {
infcx
.type_implements_trait(t, ty, InternalSubsts::empty(), cx.param_env)
.may_apply()
infcx.type_implements_trait(t, ty, ty::List::empty(), cx.param_env).may_apply()
}) == Some(true);
let suggest_debug = !suggest_display
&& cx.tcx.get_diagnostic_item(sym::Debug).map(|t| {
infcx
.type_implements_trait(t, ty, InternalSubsts::empty(), cx.param_env)
.may_apply()
infcx.type_implements_trait(t, ty, ty::List::empty(), cx.param_env).may_apply()
}) == Some(true);
let suggest_panic_any = !is_str && panic == sym::std_panic_macro;