Skip to content

Commit

Permalink
Rename CanonicalUserTypeAnnotation -> CanonicalUserType
Browse files Browse the repository at this point in the history
We want the name `CanonicalUserTypeAnnotation` for our own use.
  • Loading branch information
matthewjasper committed Jan 19, 2019
1 parent ab7bc3a commit 5ca6bd5
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
12 changes: 6 additions & 6 deletions src/librustc/ty/context.rs
Expand Up @@ -350,7 +350,7 @@ pub struct TypeckTables<'tcx> {
/// canonical substitutions would include only `for<X> { Vec<X> }`.
///
/// See also `AscribeUserType` statement in MIR.
user_provided_types: ItemLocalMap<CanonicalUserTypeAnnotation<'tcx>>,
user_provided_types: ItemLocalMap<CanonicalUserType<'tcx>>,

/// Stores the canonicalized types provided by the user. See also
/// `AscribeUserType` statement in MIR.
Expand Down Expand Up @@ -493,7 +493,7 @@ impl<'tcx> TypeckTables<'tcx> {

pub fn user_provided_types(
&self
) -> LocalTableInContext<'_, CanonicalUserTypeAnnotation<'tcx>> {
) -> LocalTableInContext<'_, CanonicalUserType<'tcx>> {
LocalTableInContext {
local_id_root: self.local_id_root,
data: &self.user_provided_types
Expand All @@ -502,7 +502,7 @@ impl<'tcx> TypeckTables<'tcx> {

pub fn user_provided_types_mut(
&mut self
) -> LocalTableInContextMut<'_, CanonicalUserTypeAnnotation<'tcx>> {
) -> LocalTableInContextMut<'_, CanonicalUserType<'tcx>> {
LocalTableInContextMut {
local_id_root: self.local_id_root,
data: &mut self.user_provided_types
Expand Down Expand Up @@ -807,12 +807,12 @@ newtype_index! {

/// Mapping of type annotation indices to canonical user type annotations.
pub type CanonicalUserTypeAnnotations<'tcx> =
IndexVec<UserTypeAnnotationIndex, (Span, CanonicalUserTypeAnnotation<'tcx>)>;
IndexVec<UserTypeAnnotationIndex, (Span, CanonicalUserType<'tcx>)>;

/// Canonicalized user type annotation.
pub type CanonicalUserTypeAnnotation<'gcx> = Canonical<'gcx, UserType<'gcx>>;
pub type CanonicalUserType<'gcx> = Canonical<'gcx, UserType<'gcx>>;

impl CanonicalUserTypeAnnotation<'gcx> {
impl CanonicalUserType<'gcx> {
/// Returns `true` if this represents a substitution of the form `[?0, ?1, ?2]`,
/// i.e. each thing is mapped to a canonical variable with the same index.
pub fn is_identity(&self) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/mod.rs
Expand Up @@ -73,7 +73,7 @@ pub use self::binding::BindingMode::*;
pub use self::context::{TyCtxt, FreeRegionInfo, GlobalArenas, AllArenas, tls, keep_local};
pub use self::context::{Lift, TypeckTables, CtxtInterners};
pub use self::context::{
UserTypeAnnotationIndex, UserType, CanonicalUserTypeAnnotation,
UserTypeAnnotationIndex, UserType, CanonicalUserType,
CanonicalUserTypeAnnotations,
};

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/hair/cx/expr.rs
Expand Up @@ -797,7 +797,7 @@ fn user_substs_applied_to_def(
cx: &mut Cx<'a, 'gcx, 'tcx>,
hir_id: hir::HirId,
def: &Def,
) -> Option<ty::CanonicalUserTypeAnnotation<'tcx>> {
) -> Option<ty::CanonicalUserType<'tcx>> {
debug!("user_substs_applied_to_def: def={:?}", def);
let user_provided_type = match def {
// A reference to something callable -- e.g., a fn, method, or
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_mir/hair/pattern/mod.rs
Expand Up @@ -15,7 +15,7 @@ use rustc::mir::{fmt_const_val, Field, BorrowKind, Mutability};
use rustc::mir::{ProjectionElem, UserTypeProjection};
use rustc::mir::interpret::{Scalar, GlobalId, ConstValue, sign_extend};
use rustc::ty::{self, Region, TyCtxt, AdtDef, Ty, Lift};
use rustc::ty::{CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, UserType};
use rustc::ty::{CanonicalUserType, CanonicalUserTypeAnnotations, UserType};
use rustc::ty::subst::{Substs, Kind};
use rustc::ty::layout::VariantIdx;
use rustc::hir::{self, PatKind, RangeEnd};
Expand Down Expand Up @@ -60,12 +60,12 @@ pub struct Pattern<'tcx> {

#[derive(Clone, Debug)]
pub struct PatternTypeProjection<'tcx> {
pub base: CanonicalUserTypeAnnotation<'tcx>,
pub base: CanonicalUserType<'tcx>,
pub projs: Vec<ProjectionElem<'tcx, (), ()>>,
}

impl<'tcx> PatternTypeProjection<'tcx> {
pub(crate) fn from_user_type(user_annotation: CanonicalUserTypeAnnotation<'tcx>) -> Self {
pub(crate) fn from_user_type(user_annotation: CanonicalUserType<'tcx>) -> Self {
Self {
base: user_annotation,
projs: Vec::new(),
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/hair/util.rs
@@ -1,5 +1,5 @@
use rustc::hir;
use rustc::ty::{self, CanonicalUserTypeAnnotation, TyCtxt, UserType};
use rustc::ty::{self, CanonicalUserType, TyCtxt, UserType};

crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'_, 'gcx, 'tcx>;
Expand All @@ -12,7 +12,7 @@ crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> {
fn user_substs_applied_to_ty_of_hir_id(
&self,
hir_id: hir::HirId,
) -> Option<CanonicalUserTypeAnnotation<'tcx>> {
) -> Option<CanonicalUserType<'tcx>> {
let user_provided_types = self.tables().user_provided_types();
let mut user_ty = *user_provided_types.get(hir_id)?;
debug!("user_subts_applied_to_ty_of_hir_id: user_ty={:?}", user_ty);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -103,7 +103,7 @@ use rustc::middle::region;
use rustc::mir::interpret::{ConstValue, GlobalId};
use rustc::traits::{self, ObligationCause, ObligationCauseCode, TraitEngine};
use rustc::ty::{
self, AdtKind, CanonicalUserTypeAnnotation, Ty, TyCtxt, GenericParamDefKind, Visibility,
self, AdtKind, CanonicalUserType, Ty, TyCtxt, GenericParamDefKind, Visibility,
ToPolyTraitRef, ToPredicate, RegionKind, UserType
};
use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
Expand Down Expand Up @@ -2252,7 +2252,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
pub fn write_user_type_annotation(
&self,
hir_id: hir::HirId,
canonical_user_type_annotation: CanonicalUserTypeAnnotation<'tcx>,
canonical_user_type_annotation: CanonicalUserType<'tcx>,
) {
debug!(
"write_user_type_annotation: hir_id={:?} canonical_user_type_annotation={:?} tag={}",
Expand Down

0 comments on commit 5ca6bd5

Please sign in to comment.