1
Fork 0
This commit is contained in:
flip1995 2020-10-06 23:32:38 +02:00
parent adb7fc6283
commit b05aeaa9bc
No known key found for this signature in database
GPG key ID: 2CEFCDB27ED0BE79
3 changed files with 4 additions and 12 deletions

View file

@ -92,13 +92,8 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
|db| { |db| {
cx.tcx.infer_ctxt().enter(|infcx| { cx.tcx.infer_ctxt().enter(|infcx| {
for FulfillmentError { obligation, .. } in send_errors { for FulfillmentError { obligation, .. } in send_errors {
infcx.maybe_note_obligation_cause_for_async_await( infcx.maybe_note_obligation_cause_for_async_await(db, &obligation);
db, if let Trait(trait_pred, _) = obligation.predicate.skip_binders() {
&obligation,
);
if let Trait(trait_pred, _) =
obligation.predicate.skip_binders()
{
db.note(&format!( db.note(&format!(
"`{}` doesn't implement `{}`", "`{}` doesn't implement `{}`",
trait_pred.self_ty(), trait_pred.self_ty(),

View file

@ -1668,9 +1668,7 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
if let ty::Opaque(def_id, _) = *ret_ty.kind() { if let ty::Opaque(def_id, _) = *ret_ty.kind() {
// one of the associated types must be Self // one of the associated types must be Self
for &(predicate, _span) in cx.tcx.explicit_item_bounds(def_id) { for &(predicate, _span) in cx.tcx.explicit_item_bounds(def_id) {
if let ty::PredicateAtom::Projection(projection_predicate) = if let ty::PredicateAtom::Projection(projection_predicate) = predicate.skip_binders() {
predicate.skip_binders()
{
// walk the associated type and check for Self // walk the associated type and check for Self
if contains_ty(projection_predicate.ty, self_ty) { if contains_ty(projection_predicate.ty, self_ty) {
return; return;

View file

@ -1287,8 +1287,7 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
ty::Opaque(ref def_id, _) => { ty::Opaque(ref def_id, _) => {
for (predicate, _) in cx.tcx.explicit_item_bounds(*def_id) { for (predicate, _) in cx.tcx.explicit_item_bounds(*def_id) {
if let ty::PredicateAtom::Trait(trait_predicate, _) = predicate.skip_binders() { if let ty::PredicateAtom::Trait(trait_predicate, _) = predicate.skip_binders() {
if must_use_attr(&cx.tcx.get_attrs(trait_predicate.trait_ref.def_id)).is_some() if must_use_attr(&cx.tcx.get_attrs(trait_predicate.trait_ref.def_id)).is_some() {
{
return true; return true;
} }
} }