pub enum AssocKind {
Const,
Method,
- Existential,
+ OpaqueTy,
Type
}
AssocKind::Const => DefKind::AssocConst,
AssocKind::Method => DefKind::Method,
AssocKind::Type => DefKind::AssocTy,
- AssocKind::Existential => DefKind::AssocExistential,
+ AssocKind::OpaqueTy => DefKind::AssocOpaqueTy,
}
}
/// for !
pub fn relevant_for_never(&self) -> bool {
match self.kind {
- AssocKind::Existential |
+ AssocKind::OpaqueTy |
AssocKind::Const |
AssocKind::Type => true,
// FIXME(canndrew): Be more thorough here, check if any argument is uninhabited.
tcx.fn_sig(self.def_id).skip_binder().to_string()
}
ty::AssocKind::Type => format!("type {};", self.ident),
- ty::AssocKind::Existential => format!("existential type {};", self.ident),
+ // FIXME(type_alias_impl_trait): we should print bounds here too.
+ ty::AssocKind::OpaqueTy => format!("type {};", self.ident),
ty::AssocKind::Const => {
format!("const {}: {:?};", self.ident, tcx.type_of(self.def_id))
}
pub parent_count: usize,
pub params: Vec<GenericParamDef>,
- /// Reverse map to the `index` field of each `GenericParamDef`
+ /// Reverse map to the `index` field of each `GenericParamDef`.
#[stable_hasher(ignore)]
pub param_def_id_to_index: FxHashMap<DefId, u32>,
impl<'tcx> PolyTraitPredicate<'tcx> {
pub fn def_id(&self) -> DefId {
- // Ok to skip binder since trait def-ID does not care about regions.
+ // Ok to skip binder since trait `DefId` does not care about regions.
self.skip_binder().def_id()
}
}
/// Note that this is not the `DefId` of the `TraitRef` containing this
/// associated type, which is in `tcx.associated_item(projection_def_id()).container`.
pub fn projection_def_id(&self) -> DefId {
- // Ok to skip binder since trait def-ID does not care about regions.
+ // Ok to skip binder since trait `DefId` does not care about regions.
self.skip_binder().projection_ty.item_def_id
}
}
/// particular point.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
pub struct ParamEnv<'tcx> {
- /// Obligations that the caller must satisfy. This is basically
+ /// `Obligation`s that the caller must satisfy. This is basically
/// the set of bounds on the in-scope type parameters, translated
- /// into Obligations, and elaborated and normalized.
+ /// into `Obligation`s, and elaborated and normalized.
pub caller_bounds: &'tcx List<ty::Predicate<'tcx>>,
/// Typically, this is `Reveal::UserFacing`, but during codegen we
_ => false,
}
} else {
- match self.def_kind(def_id).expect("no def for def-id") {
+ match self.def_kind(def_id).expect("no def for `DefId`") {
DefKind::AssocConst
| DefKind::Method
| DefKind::AssocTy => true,
(ty::AssocKind::Method, has_self)
}
hir::AssocItemKind::Type => (ty::AssocKind::Type, false),
- hir::AssocItemKind::Existential => bug!("only impls can have existentials"),
+ hir::AssocItemKind::OpaqueTy => bug!("only impls can have opaque types"),
};
AssocItem {
(ty::AssocKind::Method, has_self)
}
hir::AssocItemKind::Type => (ty::AssocKind::Type, false),
- hir::AssocItemKind::Existential => (ty::AssocKind::Existential, false),
+ hir::AssocItemKind::OpaqueTy => (ty::AssocKind::OpaqueTy, false),
};
AssocItem {
pub fn is_impl_trait_defn(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) {
if let Node::Item(item) = tcx.hir().get(hir_id) {
- if let hir::ItemKind::Existential(ref exist_ty) = item.node {
- return exist_ty.impl_trait_fn;
+ if let hir::ItemKind::OpaqueTy(ref opaque_ty) = item.node {
+ return opaque_ty.impl_trait_fn;
}
}
}