Rename CanonicalUserTypeAnnotation -> CanonicalUserType

We want the name `CanonicalUserTypeAnnotation` for our own use.
This commit is contained in:
Matthew Jasper 2019-01-06 16:04:00 +00:00
parent ab7bc3a23d
commit 5ca6bd50b5
6 changed files with 15 additions and 15 deletions

View file

@ -350,7 +350,7 @@ pub struct TypeckTables<'tcx> {
/// canonical substitutions would include only `for<X> { Vec<X> }`. /// canonical substitutions would include only `for<X> { Vec<X> }`.
/// ///
/// See also `AscribeUserType` statement in MIR. /// 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 /// Stores the canonicalized types provided by the user. See also
/// `AscribeUserType` statement in MIR. /// `AscribeUserType` statement in MIR.
@ -493,7 +493,7 @@ impl<'tcx> TypeckTables<'tcx> {
pub fn user_provided_types( pub fn user_provided_types(
&self &self
) -> LocalTableInContext<'_, CanonicalUserTypeAnnotation<'tcx>> { ) -> LocalTableInContext<'_, CanonicalUserType<'tcx>> {
LocalTableInContext { LocalTableInContext {
local_id_root: self.local_id_root, local_id_root: self.local_id_root,
data: &self.user_provided_types data: &self.user_provided_types
@ -502,7 +502,7 @@ impl<'tcx> TypeckTables<'tcx> {
pub fn user_provided_types_mut( pub fn user_provided_types_mut(
&mut self &mut self
) -> LocalTableInContextMut<'_, CanonicalUserTypeAnnotation<'tcx>> { ) -> LocalTableInContextMut<'_, CanonicalUserType<'tcx>> {
LocalTableInContextMut { LocalTableInContextMut {
local_id_root: self.local_id_root, local_id_root: self.local_id_root,
data: &mut self.user_provided_types data: &mut self.user_provided_types
@ -807,12 +807,12 @@ newtype_index! {
/// Mapping of type annotation indices to canonical user type annotations. /// Mapping of type annotation indices to canonical user type annotations.
pub type CanonicalUserTypeAnnotations<'tcx> = pub type CanonicalUserTypeAnnotations<'tcx> =
IndexVec<UserTypeAnnotationIndex, (Span, CanonicalUserTypeAnnotation<'tcx>)>; IndexVec<UserTypeAnnotationIndex, (Span, CanonicalUserType<'tcx>)>;
/// Canonicalized user type annotation. /// 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]`, /// 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. /// i.e. each thing is mapped to a canonical variable with the same index.
pub fn is_identity(&self) -> bool { pub fn is_identity(&self) -> bool {

View file

@ -73,7 +73,7 @@ pub use self::binding::BindingMode::*;
pub use self::context::{TyCtxt, FreeRegionInfo, GlobalArenas, AllArenas, tls, keep_local}; pub use self::context::{TyCtxt, FreeRegionInfo, GlobalArenas, AllArenas, tls, keep_local};
pub use self::context::{Lift, TypeckTables, CtxtInterners}; pub use self::context::{Lift, TypeckTables, CtxtInterners};
pub use self::context::{ pub use self::context::{
UserTypeAnnotationIndex, UserType, CanonicalUserTypeAnnotation, UserTypeAnnotationIndex, UserType, CanonicalUserType,
CanonicalUserTypeAnnotations, CanonicalUserTypeAnnotations,
}; };

View file

@ -797,7 +797,7 @@ fn user_substs_applied_to_def(
cx: &mut Cx<'a, 'gcx, 'tcx>, cx: &mut Cx<'a, 'gcx, 'tcx>,
hir_id: hir::HirId, hir_id: hir::HirId,
def: &Def, def: &Def,
) -> Option<ty::CanonicalUserTypeAnnotation<'tcx>> { ) -> Option<ty::CanonicalUserType<'tcx>> {
debug!("user_substs_applied_to_def: def={:?}", def); debug!("user_substs_applied_to_def: def={:?}", def);
let user_provided_type = match def { let user_provided_type = match def {
// A reference to something callable -- e.g., a fn, method, or // A reference to something callable -- e.g., a fn, method, or

View file

@ -15,7 +15,7 @@ use rustc::mir::{fmt_const_val, Field, BorrowKind, Mutability};
use rustc::mir::{ProjectionElem, UserTypeProjection}; use rustc::mir::{ProjectionElem, UserTypeProjection};
use rustc::mir::interpret::{Scalar, GlobalId, ConstValue, sign_extend}; use rustc::mir::interpret::{Scalar, GlobalId, ConstValue, sign_extend};
use rustc::ty::{self, Region, TyCtxt, AdtDef, Ty, Lift}; 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::subst::{Substs, Kind};
use rustc::ty::layout::VariantIdx; use rustc::ty::layout::VariantIdx;
use rustc::hir::{self, PatKind, RangeEnd}; use rustc::hir::{self, PatKind, RangeEnd};
@ -60,12 +60,12 @@ pub struct Pattern<'tcx> {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct PatternTypeProjection<'tcx> { pub struct PatternTypeProjection<'tcx> {
pub base: CanonicalUserTypeAnnotation<'tcx>, pub base: CanonicalUserType<'tcx>,
pub projs: Vec<ProjectionElem<'tcx, (), ()>>, pub projs: Vec<ProjectionElem<'tcx, (), ()>>,
} }
impl<'tcx> PatternTypeProjection<'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 { Self {
base: user_annotation, base: user_annotation,
projs: Vec::new(), projs: Vec::new(),

View file

@ -1,5 +1,5 @@
use rustc::hir; use rustc::hir;
use rustc::ty::{self, CanonicalUserTypeAnnotation, TyCtxt, UserType}; use rustc::ty::{self, CanonicalUserType, TyCtxt, UserType};
crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> { crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'_, 'gcx, 'tcx>; fn tcx(&self) -> TyCtxt<'_, 'gcx, 'tcx>;
@ -12,7 +12,7 @@ crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> {
fn user_substs_applied_to_ty_of_hir_id( fn user_substs_applied_to_ty_of_hir_id(
&self, &self,
hir_id: hir::HirId, hir_id: hir::HirId,
) -> Option<CanonicalUserTypeAnnotation<'tcx>> { ) -> Option<CanonicalUserType<'tcx>> {
let user_provided_types = self.tables().user_provided_types(); let user_provided_types = self.tables().user_provided_types();
let mut user_ty = *user_provided_types.get(hir_id)?; let mut user_ty = *user_provided_types.get(hir_id)?;
debug!("user_subts_applied_to_ty_of_hir_id: user_ty={:?}", user_ty); debug!("user_subts_applied_to_ty_of_hir_id: user_ty={:?}", user_ty);

View file

@ -103,7 +103,7 @@ use rustc::middle::region;
use rustc::mir::interpret::{ConstValue, GlobalId}; use rustc::mir::interpret::{ConstValue, GlobalId};
use rustc::traits::{self, ObligationCause, ObligationCauseCode, TraitEngine}; use rustc::traits::{self, ObligationCause, ObligationCauseCode, TraitEngine};
use rustc::ty::{ use rustc::ty::{
self, AdtKind, CanonicalUserTypeAnnotation, Ty, TyCtxt, GenericParamDefKind, Visibility, self, AdtKind, CanonicalUserType, Ty, TyCtxt, GenericParamDefKind, Visibility,
ToPolyTraitRef, ToPredicate, RegionKind, UserType ToPolyTraitRef, ToPredicate, RegionKind, UserType
}; };
use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
@ -2252,7 +2252,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
pub fn write_user_type_annotation( pub fn write_user_type_annotation(
&self, &self,
hir_id: hir::HirId, hir_id: hir::HirId,
canonical_user_type_annotation: CanonicalUserTypeAnnotation<'tcx>, canonical_user_type_annotation: CanonicalUserType<'tcx>,
) { ) {
debug!( debug!(
"write_user_type_annotation: hir_id={:?} canonical_user_type_annotation={:?} tag={}", "write_user_type_annotation: hir_id={:?} canonical_user_type_annotation={:?} tag={}",