Skip to content

Commit ab7bc3a

Browse files
committed
Rename UserTypeAnnotation -> UserType
1 parent c87144f commit ab7bc3a

File tree

14 files changed

+43
-43
lines changed

14 files changed

+43
-43
lines changed

src/librustc/ich/impls_ty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,16 +1240,16 @@ impl_stable_hash_for!(
12401240
}
12411241
);
12421242

1243-
impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::UserTypeAnnotation<'gcx> {
1243+
impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for ty::UserType<'gcx> {
12441244
fn hash_stable<W: StableHasherResult>(&self,
12451245
hcx: &mut StableHashingContext<'a>,
12461246
hasher: &mut StableHasher<W>) {
12471247
mem::discriminant(self).hash_stable(hcx, hasher);
12481248
match *self {
1249-
ty::UserTypeAnnotation::Ty(ref ty) => {
1249+
ty::UserType::Ty(ref ty) => {
12501250
ty.hash_stable(hcx, hasher);
12511251
}
1252-
ty::UserTypeAnnotation::TypeOf(ref def_id, ref substs) => {
1252+
ty::UserType::TypeOf(ref def_id, ref substs) => {
12531253
def_id.hash_stable(hcx, hasher);
12541254
substs.hash_stable(hcx, hasher);
12551255
}

src/librustc/mir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use ty::subst::{Subst, Substs};
3131
use ty::layout::VariantIdx;
3232
use ty::{
3333
self, AdtDef, CanonicalUserTypeAnnotations, ClosureSubsts, GeneratorSubsts, Region, Ty, TyCtxt,
34-
UserTypeAnnotationIndex, UserTypeAnnotation,
34+
UserTypeAnnotationIndex, UserType,
3535
};
3636
use util::ppaux;
3737

src/librustc/mir/visit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ macro_rules! make_mir_visitor {
221221
fn visit_user_type_annotation(
222222
&mut self,
223223
index: UserTypeAnnotationIndex,
224-
ty: & $($mutability)* Canonical<'tcx, UserTypeAnnotation<'tcx>>,
224+
ty: & $($mutability)* Canonical<'tcx, UserType<'tcx>>,
225225
) {
226226
self.super_user_type_annotation(index, ty);
227227
}
@@ -882,7 +882,7 @@ macro_rules! make_mir_visitor {
882882
fn super_user_type_annotation(
883883
&mut self,
884884
_index: UserTypeAnnotationIndex,
885-
_ty: & $($mutability)* Canonical<'tcx, UserTypeAnnotation<'tcx>>,
885+
_ty: & $($mutability)* Canonical<'tcx, UserType<'tcx>>,
886886
) {
887887
}
888888

src/librustc/ty/context.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for TypeckTables<'gcx> {
800800

801801
newtype_index! {
802802
pub struct UserTypeAnnotationIndex {
803-
DEBUG_FORMAT = "UserTypeAnnotation({})",
803+
DEBUG_FORMAT = "UserType({})",
804804
const START_INDEX = 0,
805805
}
806806
}
@@ -810,15 +810,15 @@ pub type CanonicalUserTypeAnnotations<'tcx> =
810810
IndexVec<UserTypeAnnotationIndex, (Span, CanonicalUserTypeAnnotation<'tcx>)>;
811811

812812
/// Canonicalized user type annotation.
813-
pub type CanonicalUserTypeAnnotation<'gcx> = Canonical<'gcx, UserTypeAnnotation<'gcx>>;
813+
pub type CanonicalUserTypeAnnotation<'gcx> = Canonical<'gcx, UserType<'gcx>>;
814814

815815
impl CanonicalUserTypeAnnotation<'gcx> {
816816
/// Returns `true` if this represents a substitution of the form `[?0, ?1, ?2]`,
817817
/// i.e. each thing is mapped to a canonical variable with the same index.
818818
pub fn is_identity(&self) -> bool {
819819
match self.value {
820-
UserTypeAnnotation::Ty(_) => false,
821-
UserTypeAnnotation::TypeOf(_, user_substs) => {
820+
UserType::Ty(_) => false,
821+
UserType::TypeOf(_, user_substs) => {
822822
if user_substs.user_self_ty.is_some() {
823823
return false;
824824
}
@@ -853,7 +853,7 @@ impl CanonicalUserTypeAnnotation<'gcx> {
853853
/// from constants that are named via paths, like `Foo::<A>::new` and
854854
/// so forth.
855855
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
856-
pub enum UserTypeAnnotation<'tcx> {
856+
pub enum UserType<'tcx> {
857857
Ty(Ty<'tcx>),
858858

859859
/// The canonical type is the result of `type_of(def_id)` with the
@@ -862,17 +862,17 @@ pub enum UserTypeAnnotation<'tcx> {
862862
}
863863

864864
EnumTypeFoldableImpl! {
865-
impl<'tcx> TypeFoldable<'tcx> for UserTypeAnnotation<'tcx> {
866-
(UserTypeAnnotation::Ty)(ty),
867-
(UserTypeAnnotation::TypeOf)(def, substs),
865+
impl<'tcx> TypeFoldable<'tcx> for UserType<'tcx> {
866+
(UserType::Ty)(ty),
867+
(UserType::TypeOf)(def, substs),
868868
}
869869
}
870870

871871
EnumLiftImpl! {
872-
impl<'a, 'tcx> Lift<'tcx> for UserTypeAnnotation<'a> {
873-
type Lifted = UserTypeAnnotation<'tcx>;
874-
(UserTypeAnnotation::Ty)(ty),
875-
(UserTypeAnnotation::TypeOf)(def, substs),
872+
impl<'a, 'tcx> Lift<'tcx> for UserType<'a> {
873+
type Lifted = UserType<'tcx>;
874+
(UserType::Ty)(ty),
875+
(UserType::TypeOf)(def, substs),
876876
}
877877
}
878878

src/librustc/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub use self::binding::BindingMode::*;
7373
pub use self::context::{TyCtxt, FreeRegionInfo, GlobalArenas, AllArenas, tls, keep_local};
7474
pub use self::context::{Lift, TypeckTables, CtxtInterners};
7575
pub use self::context::{
76-
UserTypeAnnotationIndex, UserTypeAnnotation, CanonicalUserTypeAnnotation,
76+
UserTypeAnnotationIndex, UserType, CanonicalUserTypeAnnotation,
7777
CanonicalUserTypeAnnotations,
7878
};
7979

src/librustc_mir/borrow_check/nll/renumber.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc::infer::canonical::Canonical;
22
use rustc::ty::subst::Substs;
33
use rustc::ty::{
4-
self, ClosureSubsts, GeneratorSubsts, Ty, TypeFoldable, UserTypeAnnotation,
4+
self, ClosureSubsts, GeneratorSubsts, Ty, TypeFoldable, UserType,
55
UserTypeAnnotationIndex,
66
};
77
use rustc::mir::{Location, Mir};
@@ -62,7 +62,7 @@ impl<'a, 'gcx, 'tcx> MutVisitor<'tcx> for NLLVisitor<'a, 'gcx, 'tcx> {
6262
fn visit_user_type_annotation(
6363
&mut self,
6464
_index: UserTypeAnnotationIndex,
65-
_ty: &mut Canonical<'tcx, UserTypeAnnotation<'tcx>>,
65+
_ty: &mut Canonical<'tcx, UserType<'tcx>>,
6666
) {
6767
// User type annotations represent the types that the user
6868
// wrote in the progarm. We don't want to erase the regions

src/librustc_mir/borrow_check/nll/type_check/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use rustc::traits::{ObligationCause, PredicateObligations};
3737
use rustc::ty::fold::TypeFoldable;
3838
use rustc::ty::subst::{Subst, Substs, UnpackedKind};
3939
use rustc::ty::{
40-
self, RegionVid, ToPolyTraitRef, Ty, TyCtxt, TyKind, UserTypeAnnotation,
40+
self, RegionVid, ToPolyTraitRef, Ty, TyCtxt, TyKind, UserType,
4141
UserTypeAnnotationIndex,
4242
};
4343
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
@@ -748,7 +748,7 @@ struct TypeChecker<'a, 'gcx: 'tcx, 'tcx: 'a> {
748748
/// annotations. Part of the reason for this setup is that it allows us to enforce basic
749749
/// WF criteria on the types even if the code that referenced them is dead
750750
/// code (see #54943).
751-
instantiated_type_annotations: FxHashMap<UserTypeAnnotationIndex, UserTypeAnnotation<'tcx>>,
751+
instantiated_type_annotations: FxHashMap<UserTypeAnnotationIndex, UserType<'tcx>>,
752752
}
753753

754754
struct BorrowCheckContext<'a, 'tcx: 'a> {
@@ -925,7 +925,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
925925
*span, &canonical_annotation
926926
);
927927
match annotation {
928-
UserTypeAnnotation::Ty(ref mut ty) =>
928+
UserType::Ty(ref mut ty) =>
929929
*ty = self.normalize(ty, Locations::All(*span)),
930930
_ => {},
931931
}
@@ -1068,7 +1068,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
10681068

10691069
let type_annotation = self.instantiated_type_annotations[&user_ty.base];
10701070
match type_annotation {
1071-
UserTypeAnnotation::Ty(ty) => {
1071+
UserType::Ty(ty) => {
10721072
// The `TypeRelating` code assumes that "unresolved inference
10731073
// variables" appear in the "a" side, so flip `Contravariant`
10741074
// ambient variance to get the right relationship.
@@ -1107,7 +1107,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
11071107
self.relate_types(ty, v1, a, locations, category)?;
11081108
}
11091109
}
1110-
UserTypeAnnotation::TypeOf(def_id, user_substs) => {
1110+
UserType::TypeOf(def_id, user_substs) => {
11111111
let projs = self.infcx.tcx.intern_projs(&user_ty.projs);
11121112
self.fully_perform_op(
11131113
locations,

src/librustc_mir/hair/cx/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
278278
let user_ty = user_provided_types.get(fun.hir_id)
279279
.map(|u_ty| *u_ty)
280280
.map(|mut u_ty| {
281-
if let UserTypeAnnotation::TypeOf(ref mut did, _) = &mut u_ty.value {
281+
if let UserType::TypeOf(ref mut did, _) = &mut u_ty.value {
282282
*did = adt_def.did;
283283
}
284284
u_ty

src/librustc_mir/hair/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc::hir::def_id::DefId;
99
use rustc::infer::canonical::Canonical;
1010
use rustc::middle::region;
1111
use rustc::ty::subst::Substs;
12-
use rustc::ty::{AdtDef, UpvarSubsts, Ty, Const, LazyConst, UserTypeAnnotation};
12+
use rustc::ty::{AdtDef, UpvarSubsts, Ty, Const, LazyConst, UserType};
1313
use rustc::ty::layout::VariantIdx;
1414
use rustc::hir;
1515
use syntax::ast;
@@ -265,20 +265,20 @@ pub enum ExprKind<'tcx> {
265265

266266
/// Optional user-given substs: for something like `let x =
267267
/// Bar::<T> { ... }`.
268-
user_ty: Option<Canonical<'tcx, UserTypeAnnotation<'tcx>>>,
268+
user_ty: Option<Canonical<'tcx, UserType<'tcx>>>,
269269

270270
fields: Vec<FieldExprRef<'tcx>>,
271271
base: Option<FruInfo<'tcx>>
272272
},
273273
PlaceTypeAscription {
274274
source: ExprRef<'tcx>,
275275
/// Type that the user gave to this expression
276-
user_ty: Option<Canonical<'tcx, UserTypeAnnotation<'tcx>>>,
276+
user_ty: Option<Canonical<'tcx, UserType<'tcx>>>,
277277
},
278278
ValueTypeAscription {
279279
source: ExprRef<'tcx>,
280280
/// Type that the user gave to this expression
281-
user_ty: Option<Canonical<'tcx, UserTypeAnnotation<'tcx>>>,
281+
user_ty: Option<Canonical<'tcx, UserType<'tcx>>>,
282282
},
283283
Closure {
284284
closure_id: DefId,
@@ -288,7 +288,7 @@ pub enum ExprKind<'tcx> {
288288
},
289289
Literal {
290290
literal: &'tcx LazyConst<'tcx>,
291-
user_ty: Option<Canonical<'tcx, UserTypeAnnotation<'tcx>>>,
291+
user_ty: Option<Canonical<'tcx, UserType<'tcx>>>,
292292
},
293293
InlineAsm {
294294
asm: &'tcx hir::InlineAsm,

src/librustc_mir/hair/pattern/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use rustc::mir::{fmt_const_val, Field, BorrowKind, Mutability};
1515
use rustc::mir::{ProjectionElem, UserTypeProjection};
1616
use rustc::mir::interpret::{Scalar, GlobalId, ConstValue, sign_extend};
1717
use rustc::ty::{self, Region, TyCtxt, AdtDef, Ty, Lift};
18-
use rustc::ty::{CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, UserTypeAnnotation};
18+
use rustc::ty::{CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, UserType};
1919
use rustc::ty::subst::{Substs, Kind};
2020
use rustc::ty::layout::VariantIdx;
2121
use rustc::hir::{self, PatKind, RangeEnd};
@@ -1040,7 +1040,7 @@ macro_rules! CloneImpls {
10401040
CloneImpls!{ <'tcx>
10411041
Span, Field, Mutability, ast::Name, ast::NodeId, usize, ty::Const<'tcx>,
10421042
Region<'tcx>, Ty<'tcx>, BindingMode, &'tcx AdtDef,
1043-
&'tcx Substs<'tcx>, &'tcx Kind<'tcx>, UserTypeAnnotation<'tcx>,
1043+
&'tcx Substs<'tcx>, &'tcx Kind<'tcx>, UserType<'tcx>,
10441044
UserTypeProjection<'tcx>, PatternTypeProjection<'tcx>
10451045
}
10461046

src/librustc_mir/hair/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc::hir;
2-
use rustc::ty::{self, CanonicalUserTypeAnnotation, TyCtxt, UserTypeAnnotation};
2+
use rustc::ty::{self, CanonicalUserTypeAnnotation, TyCtxt, UserType};
33

44
crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> {
55
fn tcx(&self) -> TyCtxt<'_, 'gcx, 'tcx>;
@@ -18,7 +18,7 @@ crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> {
1818
debug!("user_subts_applied_to_ty_of_hir_id: user_ty={:?}", user_ty);
1919
match &self.tables().node_id_to_type(hir_id).sty {
2020
ty::Adt(adt_def, ..) => {
21-
if let UserTypeAnnotation::TypeOf(ref mut did, _) = &mut user_ty.value {
21+
if let UserType::TypeOf(ref mut did, _) = &mut user_ty.value {
2222
*did = adt_def.did;
2323
}
2424
Some(user_ty)

src/librustc_typeck/check/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ use rustc::mir::interpret::{ConstValue, GlobalId};
104104
use rustc::traits::{self, ObligationCause, ObligationCauseCode, TraitEngine};
105105
use rustc::ty::{
106106
self, AdtKind, CanonicalUserTypeAnnotation, Ty, TyCtxt, GenericParamDefKind, Visibility,
107-
ToPolyTraitRef, ToPredicate, RegionKind, UserTypeAnnotation
107+
ToPolyTraitRef, ToPredicate, RegionKind, UserType
108108
};
109109
use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
110110
use rustc::ty::fold::TypeFoldable;
@@ -985,7 +985,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for GatherLocalsVisitor<'a, 'gcx, 'tcx> {
985985
};
986986

987987
let c_ty = self.fcx.inh.infcx.canonicalize_user_type_annotation(
988-
&UserTypeAnnotation::Ty(revealed_ty)
988+
&UserType::Ty(revealed_ty)
989989
);
990990
debug!("visit_local: ty.hir_id={:?} o_ty={:?} revealed_ty={:?} c_ty={:?}",
991991
ty.hir_id, o_ty, revealed_ty, c_ty);
@@ -2194,7 +2194,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
21942194
user_self_ty: None, // not relevant here
21952195
};
21962196

2197-
self.infcx.canonicalize_user_type_annotation(&UserTypeAnnotation::TypeOf(
2197+
self.infcx.canonicalize_user_type_annotation(&UserType::TypeOf(
21982198
method.def_id,
21992199
user_substs,
22002200
))
@@ -2239,7 +2239,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
22392239

22402240
if !substs.is_noop() {
22412241
let canonicalized = self.infcx.canonicalize_user_type_annotation(
2242-
&UserTypeAnnotation::TypeOf(def_id, UserSubsts {
2242+
&UserType::TypeOf(def_id, UserSubsts {
22432243
substs,
22442244
user_self_ty,
22452245
})
@@ -2440,7 +2440,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
24402440
// although I have my doubts). Other sorts of things are
24412441
// already sufficiently enforced with erased regions. =)
24422442
if ty.has_free_regions() || ty.has_projections() {
2443-
let c_ty = self.infcx.canonicalize_response(&UserTypeAnnotation::Ty(ty));
2443+
let c_ty = self.infcx.canonicalize_response(&UserType::Ty(ty));
24442444
debug!("to_ty_saving_user_provided_ty: c_ty={:?}", c_ty);
24452445
self.tables.borrow_mut().user_provided_types_mut().insert(ast_ty.hir_id, c_ty);
24462446
}

src/librustc_typeck/check/writeback.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
404404
.user_provided_types_mut()
405405
.insert(hir_id, c_ty.clone());
406406

407-
if let ty::UserTypeAnnotation::TypeOf(_, user_substs) = c_ty.value {
407+
if let ty::UserType::TypeOf(_, user_substs) = c_ty.value {
408408
if self.rustc_dump_user_substs {
409409
// This is a unit-testing mechanism.
410410
let node_id = self.tcx().hir().hir_to_node_id(hir_id);

src/test/mir-opt/basic_assignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn main() {
3737
// StorageLive(_4);
3838
// _4 = std::option::Option<std::boxed::Box<u32>>::None;
3939
// FakeRead(ForLet, _4);
40-
// AscribeUserType(_4, o, UserTypeProjection { base: UserTypeAnnotation(1), projs: [] });
40+
// AscribeUserType(_4, o, UserTypeProjection { base: UserType(1), projs: [] });
4141
// StorageLive(_5);
4242
// StorageLive(_6);
4343
// _6 = move _4;

0 commit comments

Comments
 (0)