Fix tools

This commit is contained in:
Deadbeef 2021-11-29 20:42:16 +08:00
parent f394bb57bb
commit fdf5322169
No known key found for this signature in database
GPG key ID: 6D017A96D8E6C2F9
4 changed files with 9 additions and 8 deletions

View file

@ -26,9 +26,9 @@ impl<'tcx> Elaborator<'tcx> {
.predicates
.into_iter()
.flat_map(|(pred, _)| {
pred.subst_supertrait(self.tcx, &trait_ref).to_opt_poly_trait_ref()
pred.subst_supertrait(self.tcx, &trait_ref).to_opt_poly_trait_pred()
})
.map(|t| t.value)
.map(|t| t.map_bound(|pred| pred.trait_ref))
.filter(|supertrait_ref| self.visited.insert(*supertrait_ref));
self.stack.extend(supertrait_refs);

View file

@ -1257,11 +1257,11 @@ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ParamEnv<'tcx> {
impl<'tcx> TypeFoldable<'tcx> for ParamEnv<'tcx> {
fn super_fold_with<F: ty::fold::TypeFolder<'tcx>>(self, folder: &mut F) -> Result<Self, F::Error> {
ParamEnv::new(
Ok(ParamEnv::new(
self.caller_bounds().fold_with(folder)?,
self.reveal().fold_with(folder)?,
self.constness().fold_with(folder)?,
)
))
}
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {

View file

@ -3,7 +3,7 @@ use rustc_hir as hir;
use rustc_infer::infer::{InferOk, TyCtxtInferExt};
use rustc_infer::traits;
use rustc_middle::ty::subst::Subst;
use rustc_middle::ty::{ToPredicate, WithConstness};
use rustc_middle::ty::ToPredicate;
use rustc_span::DUMMY_SP;
use super::*;
@ -66,7 +66,8 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
.into_iter()
.chain(Some(
ty::Binder::dummy(trait_ref)
.without_const()
.to_poly_trait_predicate()
.map_bound(ty::PredicateKind::Trait)
.to_predicate(infcx.tcx),
));
for predicate in predicates {

View file

@ -67,8 +67,8 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
let mut is_future = false;
for &(p, _span) in preds {
let p = p.subst(cx.tcx, subst);
if let Some(trait_ref) = p.to_opt_poly_trait_ref() {
if Some(trait_ref.value.def_id()) == cx.tcx.lang_items().future_trait() {
if let Some(trait_pred) = p.to_opt_poly_trait_pred() {
if Some(trait_pred.skip_binder().trait_ref.def_id) == cx.tcx.lang_items().future_trait() {
is_future = true;
break;
}