Remove Ty prefix from Ty{Foreign|Param}
This commit is contained in:
parent
6f637da50c
commit
04fa5d3adb
68 changed files with 160 additions and 160 deletions
|
@ -53,13 +53,13 @@ pub enum Def {
|
|||
Existential(DefId),
|
||||
/// `type Foo = Bar;`
|
||||
TyAlias(DefId),
|
||||
TyForeign(DefId),
|
||||
Foreign(DefId),
|
||||
TraitAlias(DefId),
|
||||
AssociatedTy(DefId),
|
||||
/// `existential type Foo: Bar;`
|
||||
AssociatedExistential(DefId),
|
||||
PrimTy(hir::PrimTy),
|
||||
TyParam(DefId),
|
||||
Param(DefId),
|
||||
SelfTy(Option<DefId> /* trait */, Option<DefId> /* impl */),
|
||||
ToolMod, // e.g. `rustfmt` in `#[rustfmt::skip]`
|
||||
|
||||
|
@ -269,10 +269,10 @@ impl Def {
|
|||
Def::Fn(id) | Def::Mod(id) | Def::Static(id, _) |
|
||||
Def::Variant(id) | Def::VariantCtor(id, ..) | Def::Enum(id) |
|
||||
Def::TyAlias(id) | Def::TraitAlias(id) |
|
||||
Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
|
||||
Def::AssociatedTy(id) | Def::Param(id) | Def::Struct(id) | Def::StructCtor(id, ..) |
|
||||
Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) |
|
||||
Def::AssociatedConst(id) | Def::Macro(id, ..) |
|
||||
Def::Existential(id) | Def::AssociatedExistential(id) | Def::TyForeign(id) => {
|
||||
Def::Existential(id) | Def::AssociatedExistential(id) | Def::Foreign(id) => {
|
||||
id
|
||||
}
|
||||
|
||||
|
@ -311,11 +311,11 @@ impl Def {
|
|||
Def::StructCtor(.., CtorKind::Fictive) => bug!("impossible struct constructor"),
|
||||
Def::Union(..) => "union",
|
||||
Def::Trait(..) => "trait",
|
||||
Def::TyForeign(..) => "foreign type",
|
||||
Def::Foreign(..) => "foreign type",
|
||||
Def::Method(..) => "method",
|
||||
Def::Const(..) => "constant",
|
||||
Def::AssociatedConst(..) => "associated constant",
|
||||
Def::TyParam(..) => "type parameter",
|
||||
Def::Param(..) => "type parameter",
|
||||
Def::PrimTy(..) => "builtin type",
|
||||
Def::Local(..) => "local variable",
|
||||
Def::Upvar(..) => "closure capture",
|
||||
|
|
|
@ -1183,7 +1183,7 @@ impl<'a> LoweringContext<'a> {
|
|||
}
|
||||
ImplTraitContext::Universal(in_band_ty_params) => {
|
||||
self.lower_node_id(def_node_id);
|
||||
// Add a definition for the in-band TyParam
|
||||
// Add a definition for the in-band Param
|
||||
let def_index = self
|
||||
.resolver
|
||||
.definitions()
|
||||
|
@ -1213,7 +1213,7 @@ impl<'a> LoweringContext<'a> {
|
|||
None,
|
||||
P(hir::Path {
|
||||
span,
|
||||
def: Def::TyParam(DefId::local(def_index)),
|
||||
def: Def::Param(DefId::local(def_index)),
|
||||
segments: hir_vec![hir::PathSegment::from_ident(ident)],
|
||||
}),
|
||||
))
|
||||
|
@ -2352,7 +2352,7 @@ impl<'a> LoweringContext<'a> {
|
|||
if path.segments.len() == 1
|
||||
&& bound_pred.bound_generic_params.is_empty() =>
|
||||
{
|
||||
if let Some(Def::TyParam(def_id)) = self.resolver
|
||||
if let Some(Def::Param(def_id)) = self.resolver
|
||||
.get_resolution(bound_pred.bounded_ty.id)
|
||||
.map(|d| d.base_def())
|
||||
{
|
||||
|
|
|
@ -453,7 +453,7 @@ impl<'hir> Map<'hir> {
|
|||
match item.node {
|
||||
ForeignItemKind::Fn(..) => Some(Def::Fn(def_id)),
|
||||
ForeignItemKind::Static(_, m) => Some(Def::Static(def_id, m)),
|
||||
ForeignItemKind::Type => Some(Def::TyForeign(def_id)),
|
||||
ForeignItemKind::Type => Some(Def::Foreign(def_id)),
|
||||
}
|
||||
}
|
||||
NodeTraitItem(item) => {
|
||||
|
@ -499,7 +499,7 @@ impl<'hir> Map<'hir> {
|
|||
NodeGenericParam(param) => {
|
||||
Some(match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => Def::Local(param.id),
|
||||
GenericParamKind::Type { .. } => Def::TyParam(self.local_def_id(param.id)),
|
||||
GenericParamKind::Type { .. } => Def::Param(self.local_def_id(param.id)),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1010,9 +1010,9 @@ impl_stable_hash_for!(enum hir::def::Def {
|
|||
AssociatedTy(def_id),
|
||||
AssociatedExistential(def_id),
|
||||
PrimTy(prim_ty),
|
||||
TyParam(def_id),
|
||||
Param(def_id),
|
||||
SelfTy(trait_def_id, impl_def_id),
|
||||
TyForeign(def_id),
|
||||
Foreign(def_id),
|
||||
Fn(def_id),
|
||||
Const(def_id),
|
||||
Static(def_id, is_mutbl),
|
||||
|
|
|
@ -874,10 +874,10 @@ for ty::TyKind<'gcx>
|
|||
def_id.hash_stable(hcx, hasher);
|
||||
substs.hash_stable(hcx, hasher);
|
||||
}
|
||||
TyParam(param_ty) => {
|
||||
Param(param_ty) => {
|
||||
param_ty.hash_stable(hcx, hasher);
|
||||
}
|
||||
TyForeign(def_id) => {
|
||||
Foreign(def_id) => {
|
||||
def_id.hash_stable(hcx, hasher);
|
||||
}
|
||||
Infer(infer_ty) => {
|
||||
|
|
|
@ -283,8 +283,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
|
|||
| ty::Never
|
||||
| ty::Tuple(..)
|
||||
| ty::Projection(..)
|
||||
| ty::TyForeign(..)
|
||||
| ty::TyParam(..)
|
||||
| ty::Foreign(..)
|
||||
| ty::Param(..)
|
||||
| ty::Anon(..) => {
|
||||
if t.flags.intersects(self.needs_canonical_flags) {
|
||||
t.super_fold_with(self)
|
||||
|
|
|
@ -1123,7 +1123,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
let type_param = generics.type_param(param, self.tcx);
|
||||
let hir = &self.tcx.hir;
|
||||
hir.as_local_node_id(type_param.def_id).map(|id| {
|
||||
// Get the `hir::TyParam` to verify whether it already has any bounds.
|
||||
// Get the `hir::Param` to verify whether it already has any bounds.
|
||||
// We do this to avoid suggesting code that ends up as `T: 'a'b`,
|
||||
// instead we suggest `T: 'a + 'b` in that case.
|
||||
let mut has_bounds = false;
|
||||
|
|
|
@ -193,8 +193,8 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
|
|||
ty::Never |
|
||||
ty::Tuple(..) |
|
||||
ty::Projection(..) |
|
||||
ty::TyForeign(..) |
|
||||
ty::TyParam(..) |
|
||||
ty::Foreign(..) |
|
||||
ty::Param(..) |
|
||||
ty::Closure(..) |
|
||||
ty::GeneratorWitness(..) |
|
||||
ty::Anon(..) => {
|
||||
|
|
|
@ -450,7 +450,7 @@ where
|
|||
|
||||
fn type_bound(&self, ty: Ty<'tcx>) -> VerifyBound<'tcx> {
|
||||
match ty.sty {
|
||||
ty::TyParam(p) => self.param_bound(p),
|
||||
ty::Param(p) => self.param_bound(p),
|
||||
ty::Projection(data) => {
|
||||
let declared_bounds = self.projection_declared_bounds(data);
|
||||
self.projection_bound(declared_bounds, data)
|
||||
|
|
|
@ -1326,7 +1326,7 @@ fn object_lifetime_defaults_for_item(
|
|||
_ => continue,
|
||||
};
|
||||
|
||||
if def == Def::TyParam(param_def_id) {
|
||||
if def == Def::Param(param_def_id) {
|
||||
add_bounds(&mut set, &data.bounds);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -606,7 +606,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
|
|||
}
|
||||
|
||||
return match substs.type_at(0).sty {
|
||||
ty::TyParam(_) => true,
|
||||
ty::Param(_) => true,
|
||||
ty::Projection(p) => self.is_of_param(p.substs),
|
||||
_ => false,
|
||||
};
|
||||
|
|
|
@ -407,7 +407,7 @@ fn uncovered_tys<'tcx>(tcx: TyCtxt, ty: Ty<'tcx>, in_crate: InCrate)
|
|||
|
||||
fn is_possibly_remote_type(ty: Ty, _in_crate: InCrate) -> bool {
|
||||
match ty.sty {
|
||||
ty::Projection(..) | ty::TyParam(..) => true,
|
||||
ty::Projection(..) | ty::Param(..) => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
|
|||
ty::Ref(..) |
|
||||
ty::Never |
|
||||
ty::Tuple(..) |
|
||||
ty::TyParam(..) |
|
||||
ty::Param(..) |
|
||||
ty::Projection(..) => {
|
||||
false
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
|
|||
},
|
||||
|
||||
ty::Adt(def, _) => def_id_is_local(def.did, in_crate),
|
||||
ty::TyForeign(did) => def_id_is_local(did, in_crate),
|
||||
ty::Foreign(did) => def_id_is_local(did, in_crate),
|
||||
|
||||
ty::Dynamic(ref tt, ..) => {
|
||||
tt.principal().map_or(false, |p| {
|
||||
|
|
|
@ -256,7 +256,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
ty::Closure(..) => Some(9),
|
||||
ty::Tuple(..) => Some(10),
|
||||
ty::Projection(..) => Some(11),
|
||||
ty::TyParam(..) => Some(12),
|
||||
ty::Param(..) => Some(12),
|
||||
ty::Anon(..) => Some(13),
|
||||
ty::Never => Some(14),
|
||||
ty::Adt(adt, ..) => match adt.adt_kind() {
|
||||
|
@ -265,7 +265,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
AdtKind::Enum => Some(17),
|
||||
},
|
||||
ty::Generator(..) => Some(18),
|
||||
ty::TyForeign(..) => Some(19),
|
||||
ty::Foreign(..) => Some(19),
|
||||
ty::GeneratorWitness(..) => Some(20),
|
||||
ty::Infer(..) | ty::Error => None
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
|
||||
let found_did = match found_trait_ty.sty {
|
||||
ty::Closure(did, _) |
|
||||
ty::TyForeign(did) |
|
||||
ty::Foreign(did) |
|
||||
ty::FnDef(did, _) => Some(did),
|
||||
ty::Adt(def, _) => Some(def.did),
|
||||
_ => None,
|
||||
|
@ -1348,7 +1348,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.infcx.tcx }
|
||||
|
||||
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
if let ty::TyParam(ty::ParamTy {name, ..}) = ty.sty {
|
||||
if let ty::Param(ty::ParamTy {name, ..}) = ty.sty {
|
||||
let infcx = self.infcx;
|
||||
self.var_map.entry(ty).or_insert_with(||
|
||||
infcx.next_ty_var(
|
||||
|
|
|
@ -371,7 +371,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
let mut error = false;
|
||||
ty.maybe_walk(|ty| {
|
||||
match ty.sty {
|
||||
ty::TyParam(ref param_ty) => {
|
||||
ty::Param(ref param_ty) => {
|
||||
if param_ty.is_self() {
|
||||
error = true;
|
||||
}
|
||||
|
|
|
@ -228,7 +228,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) ->
|
|||
| ty::RawPtr(_)
|
||||
| ty::Ref(..)
|
||||
| ty::TyStr
|
||||
| ty::TyForeign(..)
|
||||
| ty::Foreign(..)
|
||||
| ty::Error => true,
|
||||
|
||||
// [T; N] and [T] have same properties as T.
|
||||
|
@ -257,7 +257,7 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) ->
|
|||
// The following *might* require a destructor: it would deeper inspection to tell.
|
||||
ty::Dynamic(..)
|
||||
| ty::Projection(..)
|
||||
| ty::TyParam(_)
|
||||
| ty::Param(_)
|
||||
| ty::Anon(..)
|
||||
| ty::Infer(_)
|
||||
| ty::Generator(..) => false,
|
||||
|
|
|
@ -1810,13 +1810,13 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
|||
// say nothing; a candidate may be added by
|
||||
// `assemble_candidates_from_object_ty`.
|
||||
}
|
||||
ty::TyForeign(..) => {
|
||||
ty::Foreign(..) => {
|
||||
// Since the contents of foreign types is unknown,
|
||||
// we don't add any `..` impl. Default traits could
|
||||
// still be provided by a manual implementation for
|
||||
// this trait and type.
|
||||
}
|
||||
ty::TyParam(..) |
|
||||
ty::Param(..) |
|
||||
ty::Projection(..) => {
|
||||
// In these cases, we don't know what the actual
|
||||
// type is. Therefore, we cannot break it down
|
||||
|
@ -2189,7 +2189,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
|||
Where(ty::Binder::dummy(Vec::new()))
|
||||
}
|
||||
|
||||
ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::TyForeign(..) => None,
|
||||
ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::Foreign(..) => None,
|
||||
|
||||
ty::Tuple(tys) => {
|
||||
Where(ty::Binder::bind(tys.last().into_iter().cloned().collect()))
|
||||
|
@ -2203,7 +2203,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
|||
))
|
||||
}
|
||||
|
||||
ty::Projection(_) | ty::TyParam(_) | ty::Anon(..) => None,
|
||||
ty::Projection(_) | ty::Param(_) | ty::Anon(..) => None,
|
||||
ty::Infer(ty::TyVar(_)) => Ambiguous,
|
||||
|
||||
ty::Infer(ty::CanonicalTy(_)) |
|
||||
|
@ -2239,7 +2239,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
|||
}
|
||||
|
||||
ty::Dynamic(..) | ty::TyStr | ty::Slice(..) |
|
||||
ty::Generator(..) | ty::GeneratorWitness(..) | ty::TyForeign(..) |
|
||||
ty::Generator(..) | ty::GeneratorWitness(..) | ty::Foreign(..) |
|
||||
ty::Ref(_, _, hir::MutMutable) => {
|
||||
None
|
||||
}
|
||||
|
@ -2265,7 +2265,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
ty::Adt(..) | ty::Projection(..) | ty::TyParam(..) | ty::Anon(..) => {
|
||||
ty::Adt(..) | ty::Projection(..) | ty::Param(..) | ty::Anon(..) => {
|
||||
// Fallback to whatever user-defined impls exist in this case.
|
||||
None
|
||||
}
|
||||
|
@ -2316,8 +2316,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
|||
}
|
||||
|
||||
ty::Dynamic(..) |
|
||||
ty::TyParam(..) |
|
||||
ty::TyForeign(..) |
|
||||
ty::Param(..) |
|
||||
ty::Foreign(..) |
|
||||
ty::Projection(..) |
|
||||
ty::Infer(ty::CanonicalTy(_)) |
|
||||
ty::Infer(ty::TyVar(_)) |
|
||||
|
@ -3072,7 +3072,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
|||
let mut ty_params = BitArray::new(substs_a.types().count());
|
||||
let mut found = false;
|
||||
for ty in field.walk() {
|
||||
if let ty::TyParam(p) = ty.sty {
|
||||
if let ty::Param(p) = ty.sty {
|
||||
ty_params.insert(p.idx as usize);
|
||||
found = true;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
|
|||
.unwrap()
|
||||
.subst(infcx.tcx, &source_substs);
|
||||
|
||||
// translate the Self and TyParam parts of the substitution, since those
|
||||
// translate the Self and Param parts of the substitution, since those
|
||||
// vary across impls
|
||||
let target_substs = match target_node {
|
||||
specialization_graph::Node::Impl(target_impl) => {
|
||||
|
|
|
@ -2078,7 +2078,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> {
|
|||
self,
|
||||
Adt, Array, Slice, RawPtr, Ref, FnDef, FnPtr,
|
||||
Generator, GeneratorWitness, Dynamic, Closure, Tuple,
|
||||
TyParam, Infer, Projection, Anon, TyForeign);
|
||||
Param, Infer, Projection, Anon, Foreign);
|
||||
|
||||
println!("Substs interner: #{}", self.interners.substs.borrow().len());
|
||||
println!("Region interner: #{}", self.interners.region.borrow().len());
|
||||
|
@ -2387,7 +2387,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
|
||||
pub fn mk_foreign(self, def_id: DefId) -> Ty<'tcx> {
|
||||
self.mk_ty(TyForeign(def_id))
|
||||
self.mk_ty(Foreign(def_id))
|
||||
}
|
||||
|
||||
pub fn mk_box(self, ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
|
@ -2532,7 +2532,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
pub fn mk_ty_param(self,
|
||||
index: u32,
|
||||
name: InternedString) -> Ty<'tcx> {
|
||||
self.mk_ty(TyParam(ParamTy { idx: index, name: name }))
|
||||
self.mk_ty(Param(ParamTy { idx: index, name: name }))
|
||||
}
|
||||
|
||||
pub fn mk_self_type(self) -> Ty<'tcx> {
|
||||
|
|
|
@ -180,7 +180,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
|
|||
ty::Tuple(ref tys) if tys.is_empty() => self.to_string(),
|
||||
|
||||
ty::Adt(def, _) => format!("{} `{}`", def.descr(), tcx.item_path_str(def.did)),
|
||||
ty::TyForeign(def_id) => format!("extern type `{}`", tcx.item_path_str(def_id)),
|
||||
ty::Foreign(def_id) => format!("extern type `{}`", tcx.item_path_str(def_id)),
|
||||
ty::Array(_, n) => {
|
||||
match n.assert_usize(tcx) {
|
||||
Some(n) => format!("array of {} elements", n),
|
||||
|
@ -222,7 +222,7 @@ impl<'a, 'gcx, 'lcx, 'tcx> ty::TyS<'tcx> {
|
|||
ty::Infer(ty::FreshIntTy(_)) => "skolemized integral type".to_string(),
|
||||
ty::Infer(ty::FreshFloatTy(_)) => "skolemized floating-point type".to_string(),
|
||||
ty::Projection(_) => "associated type".to_string(),
|
||||
ty::TyParam(ref p) => {
|
||||
ty::Param(ref p) => {
|
||||
if p.is_self() {
|
||||
"Self".to_string()
|
||||
} else {
|
||||
|
|
|
@ -103,7 +103,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
|||
ty::FnPtr(ref f) => {
|
||||
Some(FunctionSimplifiedType(f.skip_binder().inputs().len()))
|
||||
}
|
||||
ty::Projection(_) | ty::TyParam(_) => {
|
||||
ty::Projection(_) | ty::Param(_) => {
|
||||
if can_simplify_params {
|
||||
// In normalized types, projections don't unify with
|
||||
// anything. when lazy normalization happens, this
|
||||
|
@ -118,7 +118,7 @@ pub fn simplify_type<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
|||
ty::Anon(def_id, _) => {
|
||||
Some(AnonSimplifiedType(def_id))
|
||||
}
|
||||
ty::TyForeign(def_id) => {
|
||||
ty::Foreign(def_id) => {
|
||||
Some(ForeignSimplifiedType(def_id))
|
||||
}
|
||||
ty::Infer(_) | ty::Error => None,
|
||||
|
|
|
@ -76,7 +76,7 @@ impl FlagComputation {
|
|||
&ty::TyUint(_) |
|
||||
&ty::Never |
|
||||
&ty::TyStr |
|
||||
&ty::TyForeign(..) => {
|
||||
&ty::Foreign(..) => {
|
||||
}
|
||||
|
||||
// You might think that we could just return Error for
|
||||
|
@ -90,7 +90,7 @@ impl FlagComputation {
|
|||
self.add_flags(TypeFlags::HAS_TY_ERR)
|
||||
}
|
||||
|
||||
&ty::TyParam(ref p) => {
|
||||
&ty::Param(ref p) => {
|
||||
self.add_flags(TypeFlags::HAS_FREE_LOCAL_NAMES);
|
||||
if p.is_self() {
|
||||
self.add_flags(TypeFlags::HAS_SELF);
|
||||
|
|
|
@ -307,7 +307,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
ty::TyForeign(did) => self.push_item_path(buffer, did),
|
||||
ty::Foreign(did) => self.push_item_path(buffer, did),
|
||||
|
||||
ty::TyBool |
|
||||
ty::TyChar |
|
||||
|
@ -375,7 +375,7 @@ pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> {
|
|||
ty::FnDef(def_id, _) |
|
||||
ty::Closure(def_id, _) |
|
||||
ty::Generator(def_id, _, _) |
|
||||
ty::TyForeign(def_id) => Some(def_id),
|
||||
ty::Foreign(def_id) => Some(def_id),
|
||||
|
||||
ty::TyBool |
|
||||
ty::TyChar |
|
||||
|
@ -384,7 +384,7 @@ pub fn characteristic_def_id_of_type(ty: Ty) -> Option<DefId> {
|
|||
ty::TyStr |
|
||||
ty::FnPtr(_) |
|
||||
ty::Projection(_) |
|
||||
ty::TyParam(_) |
|
||||
ty::Param(_) |
|
||||
ty::Anon(..) |
|
||||
ty::Infer(_) |
|
||||
ty::Error |
|
||||
|
|
|
@ -521,7 +521,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
|
|||
|
||||
let unsized_part = tcx.struct_tail(pointee);
|
||||
let metadata = match unsized_part.sty {
|
||||
ty::TyForeign(..) => {
|
||||
ty::Foreign(..) => {
|
||||
return Ok(tcx.intern_layout(LayoutDetails::scalar(self, data_ptr)));
|
||||
}
|
||||
ty::Slice(_) | ty::TyStr => {
|
||||
|
@ -594,7 +594,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
|
|||
ty::FnDef(..) => {
|
||||
univariant(&[], &ReprOptions::default(), StructKind::AlwaysSized)?
|
||||
}
|
||||
ty::Dynamic(..) | ty::TyForeign(..) => {
|
||||
ty::Dynamic(..) | ty::Foreign(..) => {
|
||||
let mut unit = univariant_uninterned(&[], &ReprOptions::default(),
|
||||
StructKind::AlwaysSized)?;
|
||||
match unit.abi {
|
||||
|
@ -1113,7 +1113,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
|
|||
ty::GeneratorWitness(..) | ty::Infer(_) => {
|
||||
bug!("LayoutDetails::compute: unexpected type `{}`", ty)
|
||||
}
|
||||
ty::TyParam(_) | ty::Error => {
|
||||
ty::Param(_) | ty::Error => {
|
||||
return Err(LayoutError::Unknown(ty));
|
||||
}
|
||||
})
|
||||
|
@ -1299,7 +1299,7 @@ impl<'a, 'tcx> SizeSkeleton<'tcx> {
|
|||
let non_zero = !ty.is_unsafe_ptr();
|
||||
let tail = tcx.struct_tail(pointee);
|
||||
match tail.sty {
|
||||
ty::TyParam(_) | ty::Projection(_) => {
|
||||
ty::Param(_) | ty::Projection(_) => {
|
||||
debug_assert!(tail.has_param_types() || tail.has_self_ty());
|
||||
Ok(SizeSkeleton::Pointer {
|
||||
non_zero,
|
||||
|
@ -1591,7 +1591,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
|
|||
ty::Never |
|
||||
ty::FnDef(..) |
|
||||
ty::GeneratorWitness(..) |
|
||||
ty::TyForeign(..) |
|
||||
ty::Foreign(..) |
|
||||
ty::Dynamic(..) => {
|
||||
bug!("TyLayout::field_type({:?}): not applicable", this)
|
||||
}
|
||||
|
@ -1686,7 +1686,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
|
|||
}
|
||||
}
|
||||
|
||||
ty::Projection(_) | ty::Anon(..) | ty::TyParam(_) |
|
||||
ty::Projection(_) | ty::Anon(..) | ty::Param(_) |
|
||||
ty::Infer(_) | ty::Error => {
|
||||
bug!("TyLayout::field_type: unexpected type `{}`", this.ty)
|
||||
}
|
||||
|
|
|
@ -2239,7 +2239,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
|
|||
TyStr |
|
||||
Dynamic(..) |
|
||||
Slice(_) |
|
||||
TyForeign(..) |
|
||||
Foreign(..) |
|
||||
Error |
|
||||
GeneratorWitness(..) => {
|
||||
// these are never sized - return the target type
|
||||
|
@ -2270,7 +2270,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
|
|||
vec![ty]
|
||||
}
|
||||
|
||||
TyParam(..) => {
|
||||
Param(..) => {
|
||||
// perf hack: if there is a `T: Sized` bound, then
|
||||
// we know that `T` is Sized and do not need to check
|
||||
// it on the impl.
|
||||
|
|
|
@ -94,7 +94,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
|
||||
// OutlivesTypeParameterEnv -- the actual checking that `X:'a`
|
||||
// is implied by the environment is done in regionck.
|
||||
ty::TyParam(p) => {
|
||||
ty::Param(p) => {
|
||||
out.push(Component::Param(p));
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
ty::Never | // ...
|
||||
ty::Adt(..) | // OutlivesNominalType
|
||||
ty::Anon(..) | // OutlivesNominalType (ish)
|
||||
ty::TyForeign(..) | // OutlivesNominalType
|
||||
ty::Foreign(..) | // OutlivesNominalType
|
||||
ty::TyStr | // OutlivesScalar (ish)
|
||||
ty::Array(..) | // ...
|
||||
ty::Slice(..) | // ...
|
||||
|
|
|
@ -387,7 +387,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R,
|
|||
Ok(a)
|
||||
}
|
||||
|
||||
(&ty::TyParam(ref a_p), &ty::TyParam(ref b_p))
|
||||
(&ty::Param(ref a_p), &ty::Param(ref b_p))
|
||||
if a_p.idx == b_p.idx =>
|
||||
{
|
||||
Ok(a)
|
||||
|
@ -400,7 +400,7 @@ pub fn super_relate_tys<'a, 'gcx, 'tcx, R>(relation: &mut R,
|
|||
Ok(tcx.mk_adt(a_def, substs))
|
||||
}
|
||||
|
||||
(&ty::TyForeign(a_id), &ty::TyForeign(b_id))
|
||||
(&ty::Foreign(a_id), &ty::Foreign(b_id))
|
||||
if a_id == b_id =>
|
||||
{
|
||||
Ok(tcx.mk_foreign(a_id))
|
||||
|
|
|
@ -862,7 +862,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
|
|||
ty::Anon(did, substs) => ty::Anon(did, substs.fold_with(folder)),
|
||||
ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) |
|
||||
ty::TyUint(_) | ty::TyFloat(_) | ty::Error | ty::Infer(_) |
|
||||
ty::TyParam(..) | ty::Never | ty::TyForeign(..) => return self
|
||||
ty::Param(..) | ty::Never | ty::Foreign(..) => return self
|
||||
};
|
||||
|
||||
if self.sty == sty {
|
||||
|
@ -897,7 +897,7 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
|
|||
ty::Anon(_, ref substs) => substs.visit_with(visitor),
|
||||
ty::TyBool | ty::TyChar | ty::TyStr | ty::TyInt(_) |
|
||||
ty::TyUint(_) | ty::TyFloat(_) | ty::Error | ty::Infer(_) |
|
||||
ty::TyParam(..) | ty::Never | ty::TyForeign(..) => false,
|
||||
ty::Param(..) | ty::Never | ty::Foreign(..) => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,13 +101,13 @@ pub enum TyKind<'tcx> {
|
|||
|
||||
/// Structures, enumerations and unions.
|
||||
///
|
||||
/// Substs here, possibly against intuition, *may* contain `TyParam`s.
|
||||
/// Substs here, possibly against intuition, *may* contain `Param`s.
|
||||
/// That is, even after substitution it is possible that there are type
|
||||
/// variables. This happens when the `Adt` corresponds to an ADT
|
||||
/// definition and not a concrete use of it.
|
||||
Adt(&'tcx AdtDef, &'tcx Substs<'tcx>),
|
||||
|
||||
TyForeign(DefId),
|
||||
Foreign(DefId),
|
||||
|
||||
/// The pointee of a string slice. Written as `str`.
|
||||
TyStr,
|
||||
|
@ -166,7 +166,7 @@ pub enum TyKind<'tcx> {
|
|||
Anon(DefId, &'tcx Substs<'tcx>),
|
||||
|
||||
/// A type parameter; for example, `T` in `fn f<T>(x: T) {}
|
||||
TyParam(ParamTy),
|
||||
Param(ParamTy),
|
||||
|
||||
/// A type variable used during type-checking.
|
||||
Infer(InferTy),
|
||||
|
@ -1058,7 +1058,7 @@ pub type Region<'tcx> = &'tcx RegionKind;
|
|||
/// the likes of `liberate_late_bound_regions`. The distinction exists
|
||||
/// because higher-ranked lifetimes aren't supported in all places. See [1][2].
|
||||
///
|
||||
/// Unlike TyParam-s, bound regions are not supposed to exist "in the wild"
|
||||
/// Unlike Param-s, bound regions are not supposed to exist "in the wild"
|
||||
/// outside their binder, e.g. in types passed to type inference, and
|
||||
/// should first be substituted (by skolemized regions, free regions,
|
||||
/// or region variables).
|
||||
|
@ -1514,14 +1514,14 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
|
|||
|
||||
pub fn is_param(&self, index: u32) -> bool {
|
||||
match self.sty {
|
||||
ty::TyParam(ref data) => data.idx == index,
|
||||
ty::Param(ref data) => data.idx == index,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_self(&self) -> bool {
|
||||
match self.sty {
|
||||
TyParam(ref p) => p.is_self(),
|
||||
Param(ref p) => p.is_self(),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
@ -1714,7 +1714,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
|
|||
|
||||
pub fn has_concrete_skeleton(&self) -> bool {
|
||||
match self.sty {
|
||||
TyParam(_) | Infer(_) | Error => false,
|
||||
Param(_) | Infer(_) | Error => false,
|
||||
_ => true,
|
||||
}
|
||||
}
|
||||
|
@ -1815,8 +1815,8 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
|
|||
RawPtr(_) |
|
||||
Never |
|
||||
Tuple(..) |
|
||||
TyForeign(..) |
|
||||
TyParam(_) |
|
||||
Foreign(..) |
|
||||
Param(_) |
|
||||
Infer(_) |
|
||||
Error => {
|
||||
vec![]
|
||||
|
@ -1867,7 +1867,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
|
|||
ty::Never | ty::Error =>
|
||||
true,
|
||||
|
||||
ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::TyForeign(..) =>
|
||||
ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::Foreign(..) =>
|
||||
false,
|
||||
|
||||
ty::Tuple(tys) =>
|
||||
|
@ -1876,7 +1876,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
|
|||
ty::Adt(def, _substs) =>
|
||||
def.sized_constraint(tcx).is_empty(),
|
||||
|
||||
ty::Projection(_) | ty::TyParam(_) | ty::Anon(..) => false,
|
||||
ty::Projection(_) | ty::Param(_) | ty::Anon(..) => false,
|
||||
|
||||
ty::Infer(ty::TyVar(_)) => false,
|
||||
|
||||
|
|
|
@ -449,7 +449,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> {
|
|||
self.ty_stack_depth += 1;
|
||||
|
||||
let t1 = match t.sty {
|
||||
ty::TyParam(p) => {
|
||||
ty::Param(p) => {
|
||||
self.ty_for_param(p, t)
|
||||
}
|
||||
_ => {
|
||||
|
|
|
@ -503,7 +503,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
!impl_generics.region_param(ebr, self).pure_wrt_drop
|
||||
}
|
||||
UnpackedKind::Type(&ty::TyS {
|
||||
sty: ty::TyKind::TyParam(ref pt), ..
|
||||
sty: ty::TyKind::Param(ref pt), ..
|
||||
}) => {
|
||||
!impl_generics.type_param(pt, self).pure_wrt_drop
|
||||
}
|
||||
|
@ -930,7 +930,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
ty::RawPtr(_) | ty::Ref(..) | ty::TyStr => false,
|
||||
|
||||
// Foreign types can never have destructors
|
||||
ty::TyForeign(..) => false,
|
||||
ty::Foreign(..) => false,
|
||||
|
||||
// `ManuallyDrop` doesn't have a destructor regardless of field types.
|
||||
ty::Adt(def, _) if Some(def.did) == tcx.lang_items().manually_drop() => false,
|
||||
|
@ -955,7 +955,7 @@ fn needs_drop_raw<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
|
||||
// Can refer to a type which may drop.
|
||||
// FIXME(eddyb) check this against a ParamEnv.
|
||||
ty::Dynamic(..) | ty::Projection(..) | ty::TyParam(_) |
|
||||
ty::Dynamic(..) | ty::Projection(..) | ty::Param(_) |
|
||||
ty::Anon(..) | ty::Infer(_) | ty::Error => true,
|
||||
|
||||
// Structural recursion.
|
||||
|
|
|
@ -82,8 +82,8 @@ pub fn walk_shallow<'tcx>(ty: Ty<'tcx>) -> AccIntoIter<TypeWalkerArray<'tcx>> {
|
|||
fn push_subtypes<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent_ty: Ty<'tcx>) {
|
||||
match parent_ty.sty {
|
||||
ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) |
|
||||
ty::TyStr | ty::Infer(_) | ty::TyParam(_) | ty::Never | ty::Error |
|
||||
ty::TyForeign(..) => {
|
||||
ty::TyStr | ty::Infer(_) | ty::Param(_) | ty::Never | ty::Error |
|
||||
ty::Foreign(..) => {
|
||||
}
|
||||
ty::Array(ty, len) => {
|
||||
push_const(stack, len);
|
||||
|
|
|
@ -257,8 +257,8 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> {
|
|||
ty::TyStr |
|
||||
ty::GeneratorWitness(..) |
|
||||
ty::Never |
|
||||
ty::TyParam(_) |
|
||||
ty::TyForeign(..) => {
|
||||
ty::Param(_) |
|
||||
ty::Foreign(..) => {
|
||||
// WfScalar, WfParameter, etc
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ use ty::subst::{self, Subst};
|
|||
use ty::{BrAnon, BrEnv, BrFresh, BrNamed};
|
||||
use ty::{TyBool, TyChar, Adt};
|
||||
use ty::{Error, TyStr, Array, Slice, TyFloat, FnDef, FnPtr};
|
||||
use ty::{TyParam, RawPtr, Ref, Never, Tuple};
|
||||
use ty::{Closure, Generator, GeneratorWitness, TyForeign, Projection, Anon};
|
||||
use ty::{Param, RawPtr, Ref, Never, Tuple};
|
||||
use ty::{Closure, Generator, GeneratorWitness, Foreign, Projection, Anon};
|
||||
use ty::{Dynamic, TyInt, TyUint, Infer};
|
||||
use ty::{self, RegionVid, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind};
|
||||
use util::nodemap::FxHashSet;
|
||||
|
@ -1086,7 +1086,7 @@ define_print! {
|
|||
}
|
||||
Infer(infer_ty) => write!(f, "{}", infer_ty),
|
||||
Error => write!(f, "[type error]"),
|
||||
TyParam(ref param_ty) => write!(f, "{}", param_ty),
|
||||
Param(ref param_ty) => write!(f, "{}", param_ty),
|
||||
Adt(def, substs) => cx.parameterized(f, substs, def.did, &[]),
|
||||
Dynamic(data, r) => {
|
||||
let r = r.print_to_string(cx);
|
||||
|
@ -1101,7 +1101,7 @@ define_print! {
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
TyForeign(def_id) => parameterized(f, subst::Substs::empty(), def_id, &[]),
|
||||
Foreign(def_id) => parameterized(f, subst::Substs::empty(), def_id, &[]),
|
||||
Projection(ref data) => data.print(f, cx),
|
||||
Anon(def_id, substs) => {
|
||||
if cx.is_verbose {
|
||||
|
|
|
@ -434,7 +434,7 @@ impl<'b, 'tcx> CodegenCx<'b, 'tcx> {
|
|||
|
||||
let tail = self.tcx.struct_tail(ty);
|
||||
match tail.sty {
|
||||
ty::TyForeign(..) => false,
|
||||
ty::Foreign(..) => false,
|
||||
ty::TyStr | ty::Slice(..) | ty::Dynamic(..) => true,
|
||||
_ => bug!("unexpected unsized tail: {:?}", tail.sty),
|
||||
}
|
||||
|
|
|
@ -585,7 +585,7 @@ pub fn type_metadata(
|
|||
trait_pointer_metadata(cx, t, None, unique_type_id),
|
||||
false)
|
||||
}
|
||||
ty::TyForeign(..) => {
|
||||
ty::Foreign(..) => {
|
||||
MetadataCreationResult::new(
|
||||
foreign_type_metadata(cx, t, unique_type_id),
|
||||
false)
|
||||
|
|
|
@ -48,7 +48,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
|
|||
ty::TyInt(int_ty) => output.push_str(int_ty.ty_to_string()),
|
||||
ty::TyUint(uint_ty) => output.push_str(uint_ty.ty_to_string()),
|
||||
ty::TyFloat(float_ty) => output.push_str(float_ty.ty_to_string()),
|
||||
ty::TyForeign(def_id) => push_item_name(cx, def_id, qualified, output),
|
||||
ty::Foreign(def_id) => push_item_name(cx, def_id, qualified, output),
|
||||
ty::Adt(def, substs) => {
|
||||
push_item_name(cx, def.did, qualified, output);
|
||||
push_type_params(cx, substs, output);
|
||||
|
@ -176,7 +176,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
|
|||
ty::Projection(..) |
|
||||
ty::Anon(..) |
|
||||
ty::GeneratorWitness(..) |
|
||||
ty::TyParam(_) => {
|
||||
ty::Param(_) => {
|
||||
bug!("debuginfo: Trying to create type name for \
|
||||
unexpected type: {:?}", t);
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ impl PlaceRef<'ll, 'tcx> {
|
|||
return simple();
|
||||
}
|
||||
_ if !field.is_unsized() => return simple(),
|
||||
ty::Slice(..) | ty::TyStr | ty::TyForeign(..) => return simple(),
|
||||
ty::Slice(..) | ty::TyStr | ty::Foreign(..) => return simple(),
|
||||
ty::Adt(def, _) => {
|
||||
if def.repr.packed() {
|
||||
// FIXME(eddyb) generalize the adjustment when we
|
||||
|
|
|
@ -62,7 +62,7 @@ fn uncached_llvm_type<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
|
|||
// FIXME(eddyb) producing readable type names for trait objects can result
|
||||
// in problematically distinct types due to HRTB and subtyping (see #47638).
|
||||
// ty::Dynamic(..) |
|
||||
ty::TyForeign(..) |
|
||||
ty::Foreign(..) |
|
||||
ty::TyStr => {
|
||||
let mut name = String::with_capacity(32);
|
||||
let printer = DefPathBasedNames::new(cx.tcx, true, true);
|
||||
|
|
|
@ -1510,7 +1510,7 @@ impl TypeAliasBounds {
|
|||
match ty.node {
|
||||
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
|
||||
match path.def {
|
||||
Def::TyParam(_) => true,
|
||||
Def::Param(_) => true,
|
||||
_ => false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -712,9 +712,9 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
|
|||
FfiSafe
|
||||
}
|
||||
|
||||
ty::TyForeign(..) => FfiSafe,
|
||||
ty::Foreign(..) => FfiSafe,
|
||||
|
||||
ty::TyParam(..) |
|
||||
ty::Param(..) |
|
||||
ty::Infer(..) |
|
||||
ty::Error |
|
||||
ty::Closure(..) |
|
||||
|
|
|
@ -429,7 +429,7 @@ impl<'tcx> EntryKind<'tcx> {
|
|||
EntryKind::Trait(_) => Def::Trait(did),
|
||||
EntryKind::Enum(..) => Def::Enum(did),
|
||||
EntryKind::MacroDef(_) => Def::Macro(did, MacroKind::Bang),
|
||||
EntryKind::ForeignType => Def::TyForeign(did),
|
||||
EntryKind::ForeignType => Def::Foreign(did),
|
||||
|
||||
EntryKind::ForeignMod |
|
||||
EntryKind::GlobalAsm |
|
||||
|
|
|
@ -838,7 +838,7 @@ fn find_vtable_types_for_unsizing<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
}
|
||||
let tail = tcx.struct_tail(ty);
|
||||
match tail.sty {
|
||||
ty::TyForeign(..) => false,
|
||||
ty::Foreign(..) => false,
|
||||
ty::TyStr | ty::Slice(..) | ty::Dynamic(..) => true,
|
||||
_ => bug!("unexpected unsized tail: {:?}", tail.sty),
|
||||
}
|
||||
|
|
|
@ -327,7 +327,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
|
|||
output);
|
||||
}
|
||||
},
|
||||
ty::TyForeign(did) => self.push_def_path(did, output),
|
||||
ty::Foreign(did) => self.push_def_path(did, output),
|
||||
ty::FnDef(..) |
|
||||
ty::FnPtr(_) => {
|
||||
let sig = t.fn_sig(self.tcx);
|
||||
|
@ -383,7 +383,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {
|
|||
ty::Error |
|
||||
ty::Infer(_) |
|
||||
ty::Projection(..) |
|
||||
ty::TyParam(_) |
|
||||
ty::Param(_) |
|
||||
ty::GeneratorWitness(_) |
|
||||
ty::Anon(..) => {
|
||||
bug!("DefPathBasedNames: Trying to create type name for \
|
||||
|
|
|
@ -90,7 +90,7 @@ impl<'a, 'tcx> EmbargoVisitor<'a, 'tcx> {
|
|||
fn item_ty_level(&self, item_def_id: DefId) -> Option<AccessLevel> {
|
||||
let ty_def_id = match self.tcx.type_of(item_def_id).sty {
|
||||
ty::Adt(adt, _) => adt.did,
|
||||
ty::TyForeign(did) => did,
|
||||
ty::Foreign(did) => did,
|
||||
ty::Dynamic(ref obj, ..) if obj.principal().is_some() =>
|
||||
obj.principal().unwrap().def_id(),
|
||||
ty::Projection(ref proj) => proj.trait_ref(self.tcx).def_id,
|
||||
|
@ -471,7 +471,7 @@ impl<'b, 'a, 'tcx> TypeVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'b
|
|||
fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
|
||||
let ty_def_id = match ty.sty {
|
||||
ty::Adt(adt, _) => Some(adt.did),
|
||||
ty::TyForeign(did) => Some(did),
|
||||
ty::Foreign(did) => Some(did),
|
||||
ty::Dynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()),
|
||||
ty::Projection(ref proj) => Some(proj.item_def_id),
|
||||
ty::FnDef(def_id, ..) |
|
||||
|
@ -898,7 +898,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> {
|
|||
match ty.sty {
|
||||
ty::Adt(&ty::AdtDef { did: def_id, .. }, ..) |
|
||||
ty::FnDef(def_id, ..) |
|
||||
ty::TyForeign(def_id) => {
|
||||
ty::Foreign(def_id) => {
|
||||
if !self.item_is_accessible(def_id) {
|
||||
let msg = format!("type `{}` is private", ty);
|
||||
self.tcx.sess.span_err(self.span, &msg);
|
||||
|
@ -1435,7 +1435,7 @@ impl<'a, 'tcx: 'a> TypeVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'
|
|||
fn visit_ty(&mut self, ty: Ty<'tcx>) -> bool {
|
||||
let ty_def_id = match ty.sty {
|
||||
ty::Adt(adt, _) => Some(adt.did),
|
||||
ty::TyForeign(did) => Some(did),
|
||||
ty::Foreign(did) => Some(did),
|
||||
ty::Dynamic(ref obj, ..) => obj.principal().map(|p| p.def_id()),
|
||||
ty::Projection(ref proj) => {
|
||||
if self.required_visibility == ty::Visibility::Invisible {
|
||||
|
|
|
@ -656,7 +656,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
|||
(Def::Static(self.definitions.local_def_id(item.id), m), ValueNS)
|
||||
}
|
||||
ForeignItemKind::Ty => {
|
||||
(Def::TyForeign(self.definitions.local_def_id(item.id)), TypeNS)
|
||||
(Def::Foreign(self.definitions.local_def_id(item.id)), TypeNS)
|
||||
}
|
||||
ForeignItemKind::Macro(_) => unreachable!(),
|
||||
};
|
||||
|
@ -692,7 +692,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
|||
span);
|
||||
self.define(parent, ident, TypeNS, (module, vis, DUMMY_SP, expansion));
|
||||
}
|
||||
Def::Variant(..) | Def::TyAlias(..) | Def::TyForeign(..) => {
|
||||
Def::Variant(..) | Def::TyAlias(..) | Def::Foreign(..) => {
|
||||
self.define(parent, ident, TypeNS, (def, vis, DUMMY_SP, expansion));
|
||||
}
|
||||
Def::Fn(..) | Def::Static(..) | Def::Const(..) | Def::VariantCtor(..) => {
|
||||
|
|
|
@ -204,14 +204,14 @@ fn resolve_struct_error<'sess, 'a>(resolver: &'sess Resolver,
|
|||
"`Self` type implicitly declared here, on the `impl`");
|
||||
}
|
||||
},
|
||||
Def::TyParam(typaram_defid) => {
|
||||
Def::Param(typaram_defid) => {
|
||||
if let Some(typaram_span) = resolver.definitions.opt_span(typaram_defid) {
|
||||
err.span_label(typaram_span, "type variable from outer function");
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
bug!("TypeParametersFromOuterFunction should only be used with Def::SelfTy or \
|
||||
Def::TyParam")
|
||||
Def::Param")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -537,9 +537,9 @@ impl<'a> PathSource<'a> {
|
|||
PathSource::Type => match def {
|
||||
Def::Struct(..) | Def::Union(..) | Def::Enum(..) |
|
||||
Def::Trait(..) | Def::TyAlias(..) | Def::AssociatedTy(..) |
|
||||
Def::PrimTy(..) | Def::TyParam(..) | Def::SelfTy(..) |
|
||||
Def::PrimTy(..) | Def::Param(..) | Def::SelfTy(..) |
|
||||
Def::Existential(..) |
|
||||
Def::TyForeign(..) => true,
|
||||
Def::Foreign(..) => true,
|
||||
_ => false,
|
||||
},
|
||||
PathSource::Trait(AliasPossibility::No) => match def {
|
||||
|
@ -2359,7 +2359,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
|
|||
seen_bindings.entry(ident).or_insert(param.ident.span);
|
||||
|
||||
// Plain insert (no renaming).
|
||||
let def = Def::TyParam(self.definitions.local_def_id(param.id));
|
||||
let def = Def::Param(self.definitions.local_def_id(param.id));
|
||||
function_type_rib.bindings.insert(ident, def);
|
||||
self.record_def(param.id, PathResolution::new(def));
|
||||
}
|
||||
|
@ -3765,7 +3765,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
|
|||
}
|
||||
}
|
||||
}
|
||||
Def::TyParam(..) | Def::SelfTy(..) => {
|
||||
Def::Param(..) | Def::SelfTy(..) => {
|
||||
for rib in ribs {
|
||||
match rib.kind {
|
||||
NormalRibKind | TraitOrImplItemRibKind | ClosureRibKind(..) |
|
||||
|
|
|
@ -747,13 +747,13 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
|
|||
HirDef::Union(def_id) |
|
||||
HirDef::Enum(def_id) |
|
||||
HirDef::TyAlias(def_id) |
|
||||
HirDef::TyForeign(def_id) |
|
||||
HirDef::Foreign(def_id) |
|
||||
HirDef::TraitAlias(def_id) |
|
||||
HirDef::AssociatedExistential(def_id) |
|
||||
HirDef::AssociatedTy(def_id) |
|
||||
HirDef::Trait(def_id) |
|
||||
HirDef::Existential(def_id) |
|
||||
HirDef::TyParam(def_id) => {
|
||||
HirDef::Param(def_id) => {
|
||||
let span = self.span_from_span(sub_span);
|
||||
Some(Ref {
|
||||
kind: RefKind::Type,
|
||||
|
|
|
@ -119,7 +119,7 @@ fn dropck_outlives<'tcx>(
|
|||
match ty.sty {
|
||||
// All parameters live for the duration of the
|
||||
// function.
|
||||
ty::TyParam(..) => {}
|
||||
ty::Param(..) => {}
|
||||
|
||||
// A projection that we couldn't resolve - it
|
||||
// might have a destructor.
|
||||
|
@ -180,7 +180,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>(
|
|||
| ty::TyFloat(_)
|
||||
| ty::TyStr
|
||||
| ty::Never
|
||||
| ty::TyForeign(..)
|
||||
| ty::Foreign(..)
|
||||
| ty::RawPtr(..)
|
||||
| ty::Ref(..)
|
||||
| ty::FnDef(..)
|
||||
|
@ -266,7 +266,7 @@ fn dtorck_constraint_for_ty<'a, 'gcx, 'tcx>(
|
|||
}),
|
||||
|
||||
// Types that can't be resolved. Pass them forward.
|
||||
ty::Projection(..) | ty::Anon(..) | ty::TyParam(..) => Ok(DtorckConstraint {
|
||||
ty::Projection(..) | ty::Anon(..) | ty::Param(..) => Ok(DtorckConstraint {
|
||||
outlives: vec![],
|
||||
dtorck_types: vec![ty],
|
||||
overflows: vec![],
|
||||
|
|
|
@ -1239,8 +1239,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
|
|||
Err(ErrorReported) => return (tcx.types.err, Def::Err),
|
||||
}
|
||||
}
|
||||
(&ty::TyParam(_), Def::SelfTy(Some(param_did), None)) |
|
||||
(&ty::TyParam(_), Def::TyParam(param_did)) => {
|
||||
(&ty::Param(_), Def::SelfTy(Some(param_did), None)) |
|
||||
(&ty::Param(_), Def::Param(param_did)) => {
|
||||
match self.find_bound_for_assoc_item(param_did, assoc_name, span) {
|
||||
Ok(bound) => bound,
|
||||
Err(ErrorReported) => return (tcx.types.err, Def::Err),
|
||||
|
@ -1387,7 +1387,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
|
|||
)
|
||||
}
|
||||
Def::Enum(did) | Def::TyAlias(did) | Def::Struct(did) |
|
||||
Def::Union(did) | Def::TyForeign(did) => {
|
||||
Def::Union(did) | Def::Foreign(did) => {
|
||||
assert_eq!(opt_self_ty, None);
|
||||
self.prohibit_generics(path.segments.split_last().unwrap().1);
|
||||
self.ast_path_to_ty(span, did, path.segments.last().unwrap())
|
||||
|
@ -1401,7 +1401,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
|
|||
tcx.parent_def_id(did).unwrap(),
|
||||
path.segments.last().unwrap())
|
||||
}
|
||||
Def::TyParam(did) => {
|
||||
Def::Param(did) => {
|
||||
assert_eq!(opt_self_ty, None);
|
||||
self.prohibit_generics(&path.segments);
|
||||
|
||||
|
|
|
@ -121,11 +121,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
},
|
||||
|
||||
// Pointers to foreign types are thin, despite being unsized
|
||||
ty::TyForeign(..) => Some(PointerKind::Thin),
|
||||
ty::Foreign(..) => Some(PointerKind::Thin),
|
||||
// We should really try to normalize here.
|
||||
ty::Projection(ref pi) => Some(PointerKind::OfProjection(pi)),
|
||||
ty::Anon(def_id, substs) => Some(PointerKind::OfAnon(def_id, substs)),
|
||||
ty::TyParam(ref p) => Some(PointerKind::OfParam(p)),
|
||||
ty::Param(ref p) => Some(PointerKind::OfParam(p)),
|
||||
// Insufficient type information.
|
||||
ty::Infer(_) => None,
|
||||
|
||||
|
|
|
@ -830,7 +830,7 @@ fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
hir::intravisit::walk_ty(self, ty);
|
||||
match ty.node {
|
||||
hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
|
||||
if let hir::def::Def::TyParam(def_id) = path.def {
|
||||
if let hir::def::Def::Param(def_id) = path.def {
|
||||
if def_id == self.1 {
|
||||
self.0 = Some(ty.span);
|
||||
}
|
||||
|
|
|
@ -459,10 +459,10 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
|
|||
ty::Adt(def, _) => {
|
||||
self.assemble_inherent_impl_candidates_for_type(def.did);
|
||||
}
|
||||
ty::TyForeign(did) => {
|
||||
ty::Foreign(did) => {
|
||||
self.assemble_inherent_impl_candidates_for_type(did);
|
||||
}
|
||||
ty::TyParam(p) => {
|
||||
ty::Param(p) => {
|
||||
self.assemble_inherent_candidates_from_param(self_ty, p);
|
||||
}
|
||||
ty::TyChar => {
|
||||
|
@ -652,7 +652,7 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> {
|
|||
match *predicate {
|
||||
ty::Predicate::Trait(ref trait_predicate) => {
|
||||
match trait_predicate.skip_binder().trait_ref.self_ty().sty {
|
||||
ty::TyParam(ref p) if *p == param_ty => {
|
||||
ty::Param(ref p) if *p == param_ty => {
|
||||
Some(trait_predicate.to_poly_trait_ref())
|
||||
}
|
||||
_ => None,
|
||||
|
|
|
@ -639,12 +639,12 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
fn is_local(ty: Ty) -> bool {
|
||||
match ty.sty {
|
||||
ty::Adt(def, _) => def.did.is_local(),
|
||||
ty::TyForeign(did) => did.is_local(),
|
||||
ty::Foreign(did) => did.is_local(),
|
||||
|
||||
ty::Dynamic(ref tr, ..) => tr.principal()
|
||||
.map_or(false, |p| p.def_id().is_local()),
|
||||
|
||||
ty::TyParam(_) => true,
|
||||
ty::Param(_) => true,
|
||||
|
||||
// everything else (primitive types etc.) is effectively
|
||||
// non-local (there are "edge" cases, e.g. (LocalType,), but
|
||||
|
|
|
@ -1647,7 +1647,7 @@ pub fn check_simd<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sp: Span, def_id: DefId
|
|||
return;
|
||||
}
|
||||
match e.sty {
|
||||
ty::TyParam(_) => { /* struct<T>(T, T, T, T) is ok */ }
|
||||
ty::Param(_) => { /* struct<T>(T, T, T, T) is ok */ }
|
||||
_ if e.is_machine() => { /* struct(u8, u8, u8, u8) is ok */ }
|
||||
_ => {
|
||||
span_err!(tcx.sess, sp, E0077,
|
||||
|
@ -5155,7 +5155,7 @@ pub fn check_bounds_are_used<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
let mut types_used = vec![false; own_counts.types];
|
||||
|
||||
for leaf_ty in ty.walk() {
|
||||
if let ty::TyParam(ty::ParamTy { idx, .. }) = leaf_ty.sty {
|
||||
if let ty::Param(ty::ParamTy { idx, .. }) = leaf_ty.sty {
|
||||
debug!("Found use of ty param num {}", idx);
|
||||
types_used[idx as usize - own_counts.lifetimes] = true;
|
||||
} else if let ty::Error = leaf_ty.sty {
|
||||
|
|
|
@ -311,7 +311,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
// This has nothing here because it means we did string
|
||||
// concatenation (e.g. "Hello " += "World!"). This means
|
||||
// we don't want the note in the else clause to be emitted
|
||||
} else if let ty::TyParam(_) = lhs_ty.sty {
|
||||
} else if let ty::Param(_) = lhs_ty.sty {
|
||||
// FIXME: point to span of param
|
||||
err.note(&format!(
|
||||
"`{}` might need a bound for `{}`",
|
||||
|
@ -385,7 +385,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
// This has nothing here because it means we did string
|
||||
// concatenation (e.g. "Hello " + "World!"). This means
|
||||
// we don't want the note in the else clause to be emitted
|
||||
} else if let ty::TyParam(_) = lhs_ty.sty {
|
||||
} else if let ty::Param(_) = lhs_ty.sty {
|
||||
// FIXME: point to span of param
|
||||
err.note(&format!(
|
||||
"`{}` might need a bound for `{}`",
|
||||
|
|
|
@ -454,7 +454,7 @@ fn check_where_clauses<'a, 'gcx, 'fcx, 'tcx>(
|
|||
impl<'tcx> ty::fold::TypeVisitor<'tcx> for CountParams {
|
||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> bool {
|
||||
match t.sty {
|
||||
ty::TyParam(p) => {
|
||||
ty::Param(p) => {
|
||||
self.params.insert(p.idx);
|
||||
t.super_visit_with(self)
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ fn check_existential_types<'a, 'fcx, 'gcx, 'tcx>(
|
|||
for (subst, param) in substs.iter().zip(&generics.params) {
|
||||
match subst.unpack() {
|
||||
ty::subst::UnpackedKind::Type(ty) => match ty.sty {
|
||||
ty::TyParam(..) => {},
|
||||
ty::Param(..) => {},
|
||||
// prevent `fn foo() -> Foo<u32>` from being defining
|
||||
_ => {
|
||||
tcx
|
||||
|
|
|
@ -417,7 +417,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
|
|||
fldop: |ty| {
|
||||
trace!("checking type {:?}: {:#?}", ty, ty.sty);
|
||||
// find a type parameter
|
||||
if let ty::TyParam(..) = ty.sty {
|
||||
if let ty::Param(..) = ty.sty {
|
||||
// look it up in the substitution list
|
||||
assert_eq!(anon_defn.substs.len(), generics.params.len());
|
||||
for (subst, param) in anon_defn.substs.iter().zip(&generics.params) {
|
||||
|
|
|
@ -105,7 +105,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for InherentCollect<'a, 'tcx> {
|
|||
ty::Adt(def, _) => {
|
||||
self.check_def_id(item, def.did);
|
||||
}
|
||||
ty::TyForeign(did) => {
|
||||
ty::Foreign(did) => {
|
||||
self.check_def_id(item, did);
|
||||
}
|
||||
ty::Dynamic(ref data, ..) if data.principal().is_some() => {
|
||||
|
|
|
@ -115,7 +115,7 @@ impl<'cx, 'tcx, 'v> ItemLikeVisitor<'v> for OrphanChecker<'cx, 'tcx> {
|
|||
let self_ty = trait_ref.self_ty();
|
||||
let opt_self_def_id = match self_ty.sty {
|
||||
ty::Adt(self_def, _) => Some(self_def.did),
|
||||
ty::TyForeign(did) => Some(did),
|
||||
ty::Foreign(did) => Some(did),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
|
|
|
@ -350,7 +350,7 @@ fn is_param<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node {
|
||||
match path.def {
|
||||
Def::SelfTy(Some(def_id), None) |
|
||||
Def::TyParam(def_id) => {
|
||||
Def::Param(def_id) => {
|
||||
def_id == tcx.hir.local_def_id(param_id)
|
||||
}
|
||||
_ => false
|
||||
|
|
|
@ -66,7 +66,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
|
|||
// projections are not injective
|
||||
return false;
|
||||
}
|
||||
ty::TyParam(data) => {
|
||||
ty::Param(data) => {
|
||||
self.parameters.push(Parameter::from(data));
|
||||
}
|
||||
_ => {}
|
||||
|
|
|
@ -262,7 +262,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
|
|||
|
||||
match ty.sty {
|
||||
ty::TyBool | ty::TyChar | ty::TyInt(_) | ty::TyUint(_) | ty::TyFloat(_) |
|
||||
ty::TyStr | ty::Never | ty::TyForeign(..) => {
|
||||
ty::TyStr | ty::Never | ty::Foreign(..) => {
|
||||
// leaf type -- noop
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
ty::TyParam(ref data) => {
|
||||
ty::Param(ref data) => {
|
||||
self.add_constraint(current, data.idx, variance);
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name, visited: &mut FxHa
|
|||
ret.extend(build_impls(cx, did, true));
|
||||
clean::EnumItem(build_enum(cx, did))
|
||||
}
|
||||
Def::TyForeign(did) => {
|
||||
Def::Foreign(did) => {
|
||||
record_extern_fqn(cx, did, clean::TypeKind::Foreign);
|
||||
ret.extend(build_impls(cx, did, false));
|
||||
clean::ForeignTypeItem
|
||||
|
|
|
@ -2411,7 +2411,7 @@ impl Clean<Type> for hir::Ty {
|
|||
return new_ty;
|
||||
}
|
||||
|
||||
if let Def::TyParam(did) = path.def {
|
||||
if let Def::Param(did) = path.def {
|
||||
if let Some(bounds) = cx.impl_trait_bounds.borrow_mut().remove(&did) {
|
||||
return ImplTrait(bounds);
|
||||
}
|
||||
|
@ -2460,7 +2460,7 @@ impl Clean<Type> for hir::Ty {
|
|||
}
|
||||
hir::GenericParamKind::Type { ref default, .. } => {
|
||||
let ty_param_def =
|
||||
Def::TyParam(cx.tcx.hir.local_def_id(param.id));
|
||||
Def::Param(cx.tcx.hir.local_def_id(param.id));
|
||||
let mut j = 0;
|
||||
let type_ = generic_args.args.iter().find_map(|arg| {
|
||||
match arg {
|
||||
|
@ -2602,7 +2602,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
|||
is_generic: false,
|
||||
}
|
||||
}
|
||||
ty::TyForeign(did) => {
|
||||
ty::Foreign(did) => {
|
||||
inline::record_extern_fqn(cx, did, TypeKind::Foreign);
|
||||
let path = external_path(cx, &cx.tcx.item_name(did).as_str(),
|
||||
None, false, vec![], Substs::empty());
|
||||
|
@ -2661,7 +2661,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
|||
|
||||
ty::Projection(ref data) => data.clean(cx),
|
||||
|
||||
ty::TyParam(ref p) => Generic(p.name.to_string()),
|
||||
ty::Param(ref p) => Generic(p.name.to_string()),
|
||||
|
||||
ty::Anon(def_id, substs) => {
|
||||
// Grab the "TraitA + TraitB" from `impl TraitA + TraitB`,
|
||||
|
@ -3710,10 +3710,10 @@ fn resolve_type(cx: &DocContext,
|
|||
Def::SelfTy(..) if path.segments.len() == 1 => {
|
||||
return Generic(keywords::SelfType.name().to_string());
|
||||
}
|
||||
Def::TyParam(..) if path.segments.len() == 1 => {
|
||||
Def::Param(..) if path.segments.len() == 1 => {
|
||||
return Generic(format!("{:#}", path));
|
||||
}
|
||||
Def::SelfTy(..) | Def::TyParam(..) | Def::AssociatedTy(..) => true,
|
||||
Def::SelfTy(..) | Def::Param(..) | Def::AssociatedTy(..) => true,
|
||||
_ => false,
|
||||
};
|
||||
let did = register_def(&*cx, path.def);
|
||||
|
@ -3731,7 +3731,7 @@ pub fn register_def(cx: &DocContext, def: Def) -> DefId {
|
|||
Def::Struct(i) => (i, TypeKind::Struct),
|
||||
Def::Union(i) => (i, TypeKind::Union),
|
||||
Def::Mod(i) => (i, TypeKind::Module),
|
||||
Def::TyForeign(i) => (i, TypeKind::Foreign),
|
||||
Def::Foreign(i) => (i, TypeKind::Foreign),
|
||||
Def::Const(i) => (i, TypeKind::Const),
|
||||
Def::Static(i, _) => (i, TypeKind::Static),
|
||||
Def::Variant(i) => (cx.tcx.parent_def_id(i).expect("cannot get parent def id"),
|
||||
|
|
|
@ -234,7 +234,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> DocContext<'a, 'tcx, 'rcx, 'cstore> {
|
|||
None,
|
||||
P(hir::Path {
|
||||
span: DUMMY_SP,
|
||||
def: Def::TyParam(param.def_id),
|
||||
def: Def::Param(param.def_id),
|
||||
segments: HirVec::from_vec(vec![
|
||||
hir::PathSegment::from_ident(Ident::from_interned_str(param.name))
|
||||
]),
|
||||
|
|
|
@ -267,7 +267,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
|
|||
Def::Struct(did) |
|
||||
Def::Union(did) |
|
||||
Def::Enum(did) |
|
||||
Def::TyForeign(did) |
|
||||
Def::Foreign(did) |
|
||||
Def::TyAlias(did) if !self_is_hidden => {
|
||||
self.cx.access_levels.borrow_mut().map.insert(did, AccessLevel::Public);
|
||||
},
|
||||
|
|
|
@ -89,7 +89,7 @@ pub mod testtypes {
|
|||
pub type FooNil = ();
|
||||
pub type FooTuple = (u8, i8, bool);
|
||||
|
||||
// Skipping TyParam
|
||||
// Skipping Param
|
||||
|
||||
// Skipping Infer
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
trait Arr0 {
|
||||
fn arr0_secret(&self);
|
||||
}
|
||||
trait TyParam {
|
||||
trait Param {
|
||||
fn ty_param_secret(&self);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ mod m {
|
|||
struct Priv;
|
||||
|
||||
impl ::Arr0 for [Priv; 0] { fn arr0_secret(&self) {} }
|
||||
impl ::TyParam for Option<Priv> { fn ty_param_secret(&self) {} }
|
||||
impl ::Param for Option<Priv> { fn ty_param_secret(&self) {} }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue