diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 78e6e9ae1533..7bc9760b059d 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -480,16 +480,16 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { { assert!(!value.needs_subst()); let value = self.erase_late_bound_regions(value); - self.normalize_associated_type_in(&value) + self.trans_normalize_associated_types_in(&value) } /// Fully normalizes any associated types in `value`, using an /// empty environment and `Reveal::All` mode (therefore, suitable /// only for monomorphized code during trans, basically). - pub fn normalize_associated_type_in(self, value: &T) -> T + pub fn trans_normalize_associated_types_in(self, value: &T) -> T where T: TransNormalize<'tcx> { - debug!("normalize_associated_type_in(t={:?})", value); + debug!("trans_normalize_associated_types_in(t={:?})", value); let param_env = ty::ParamEnv::empty(Reveal::All); let value = self.erase_regions(value); diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index b5f04a91203e..2a3b445ba31c 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -2323,6 +2323,6 @@ pub fn provide(providers: &mut ty::maps::Providers) { tcx.sess.features.borrow().clone_closures }; providers.normalize_ty = |tcx, ty| { - tcx.normalize_associated_type_in(&ty) + tcx.trans_normalize_associated_types_in(&ty) }; } diff --git a/src/librustc/ty/maps/plumbing.rs b/src/librustc/ty/maps/plumbing.rs index 5f93c3de336c..cce968177175 100644 --- a/src/librustc/ty/maps/plumbing.rs +++ b/src/librustc/ty/maps/plumbing.rs @@ -697,6 +697,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>, DepKind::FulfillObligation | DepKind::VtableMethods | DepKind::EraseRegionsTy | + DepKind::NormalizeTy | // These are just odd DepKind::Null | diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 0baa65508b52..5beb23c8b82f 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -431,7 +431,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { // fields are actually safe. let mut all_phantom = true; for field in &def.struct_variant().fields { - let field_ty = cx.normalize_associated_type_in(&field.ty(cx, substs)); + let field_ty = cx.trans_normalize_associated_types_in(&field.ty(cx, substs)); let r = self.check_type_for_ffi(cache, field_ty); match r { FfiSafe => { @@ -463,7 +463,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { let mut all_phantom = true; for field in &def.struct_variant().fields { - let field_ty = cx.normalize_associated_type_in(&field.ty(cx, substs)); + let field_ty = cx.trans_normalize_associated_types_in(&field.ty(cx, substs)); let r = self.check_type_for_ffi(cache, field_ty); match r { FfiSafe => { @@ -516,7 +516,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { // Check the contained variants. for variant in &def.variants { for field in &variant.fields { - let arg = cx.normalize_associated_type_in(&field.ty(cx, substs)); + let arg = cx.trans_normalize_associated_types_in(&field.ty(cx, substs)); let r = self.check_type_for_ffi(cache, arg); match r { FfiSafe => {} @@ -629,7 +629,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { fn check_type_for_ffi_and_report_errors(&mut self, sp: Span, ty: Ty<'tcx>) { // it is only OK to use this function because extern fns cannot have // any generic types right now: - let ty = self.cx.tcx.normalize_associated_type_in(&ty); + let ty = self.cx.tcx.trans_normalize_associated_types_in(&ty); match self.check_type_for_ffi(&mut FxHashSet(), ty) { FfiResult::FfiSafe => {} diff --git a/src/librustc_trans/adt.rs b/src/librustc_trans/adt.rs index 6fd406037cde..91adfe139fa1 100644 --- a/src/librustc_trans/adt.rs +++ b/src/librustc_trans/adt.rs @@ -80,7 +80,7 @@ pub fn compute_fields<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>, ty::TyGenerator(def_id, substs, _) => { if variant_index > 0 { bug!("{} is a generator, which only has one variant", t);} substs.field_tys(def_id, cx.tcx()).map(|t| { - cx.tcx().normalize_associated_type_in(&t) + cx.tcx().trans_normalize_associated_types_in(&t) }).collect() }, _ => bug!("{} is not a type that can have fields.", t) diff --git a/src/librustc_trans/context.rs b/src/librustc_trans/context.rs index a1bf64681c00..d326cfe02fc2 100644 --- a/src/librustc_trans/context.rs +++ b/src/librustc_trans/context.rs @@ -642,7 +642,7 @@ impl<'a, 'tcx> LayoutTyper<'tcx> for &'a SharedCrateContext<'a, 'tcx> { } fn normalize_projections(self, ty: Ty<'tcx>) -> Ty<'tcx> { - self.tcx().normalize_associated_type_in(&ty) + self.tcx().trans_normalize_associated_types_in(&ty) } } diff --git a/src/librustc_trans/debuginfo/metadata.rs b/src/librustc_trans/debuginfo/metadata.rs index a6827abd41b2..4f23152fed1c 100644 --- a/src/librustc_trans/debuginfo/metadata.rs +++ b/src/librustc_trans/debuginfo/metadata.rs @@ -582,7 +582,7 @@ pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, } ty::TyGenerator(def_id, substs, _) => { let upvar_tys : Vec<_> = substs.field_tys(def_id, cx.tcx()).map(|t| { - cx.tcx().normalize_associated_type_in(&t) + cx.tcx().trans_normalize_associated_types_in(&t) }).collect(); prepare_tuple_metadata(cx, t, diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_trans/debuginfo/mod.rs index 0fe5b8f4ca26..631d6b8143ea 100644 --- a/src/librustc_trans/debuginfo/mod.rs +++ b/src/librustc_trans/debuginfo/mod.rs @@ -376,7 +376,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, name_to_append_suffix_to.push_str(","); } - let actual_type = cx.tcx().normalize_associated_type_in(&actual_type); + let actual_type = cx.tcx().trans_normalize_associated_types_in(&actual_type); // Add actual type name to <...> clause of function name let actual_type_name = compute_debuginfo_type_name(cx, actual_type, @@ -389,7 +389,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, let template_params: Vec<_> = if cx.sess().opts.debuginfo == FullDebugInfo { let names = get_type_parameter_names(cx, generics); substs.types().zip(names).map(|(ty, name)| { - let actual_type = cx.tcx().normalize_associated_type_in(&ty); + let actual_type = cx.tcx().trans_normalize_associated_types_in(&ty); let actual_type_metadata = type_metadata(cx, actual_type, syntax_pos::DUMMY_SP); let name = CString::new(name.as_str().as_bytes()).unwrap(); unsafe { diff --git a/src/librustc_trans_utils/monomorphize.rs b/src/librustc_trans_utils/monomorphize.rs index 079b7ee3eaba..31d51dce6ea4 100644 --- a/src/librustc_trans_utils/monomorphize.rs +++ b/src/librustc_trans_utils/monomorphize.rs @@ -131,6 +131,6 @@ pub fn field_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, f: &'tcx ty::FieldDef) -> Ty<'tcx> { - tcx.normalize_associated_type_in(&f.ty(tcx, param_substs)) + tcx.trans_normalize_associated_types_in(&f.ty(tcx, param_substs)) }