use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_middle::ty::subst::Subst;
-use rustc_middle::ty::{self, Binder, Predicate, PredicateKind, ToPredicate, Ty, TyCtxt};
+use rustc_middle::ty::{
+ self, Binder, EarlyBinder, Predicate, PredicateKind, ToPredicate, Ty, TyCtxt,
+};
use rustc_span::{sym, Span};
use rustc_trait_selection::traits;
debug!("sized_constraint_for_ty({:?}) intermediate = {:?}", ty, adt_tys);
adt_tys
.iter()
- .map(|ty| ty.subst(tcx, substs))
+ .map(|ty| EarlyBinder(*ty).subst(tcx, substs))
.flat_map(|ty| sized_constraint_for_ty(tcx, adtdef, ty))
.collect()
}
/// Check if a function is async.
fn asyncness(tcx: TyCtxt<'_>, def_id: DefId) -> hir::IsAsync {
let node = tcx.hir().get_by_def_id(def_id.expect_local());
-
- let fn_kind = node.fn_kind().unwrap_or_else(|| {
- bug!("asyncness: expected fn-like node but got `{:?}`", def_id);
- });
-
- fn_kind.asyncness()
+ if let Some(fn_kind) = node.fn_kind() { fn_kind.asyncness() } else { hir::IsAsync::NotAsync }
}
/// Don't call this directly: use ``tcx.conservative_is_privately_uninhabited`` instead.
// one uninhabited field.
def.variants().iter().all(|var| {
var.fields.iter().any(|field| {
- let ty = tcx.type_of(field.did).subst(tcx, substs);
+ let ty = tcx.bound_type_of(field.did).subst(tcx, substs);
tcx.conservative_is_privately_uninhabited(param_env.and(ty))
})
})