- debug!(?annotation);
- match annotation {
- UserType::Ty(mut ty) => {
- ty = self.normalize(ty, Locations::All(span));
-
- if let Err(terr) = self.eq_types(
- ty,
- inferred_ty,
- Locations::All(span),
- ConstraintCategory::BoringNoLocation,
- ) {
- span_mirbug!(
- self,
- user_annotation,
- "bad user type ({:?} = {:?}): {:?}",
- ty,
- inferred_ty,
- terr
- );
- }
-
- self.prove_predicate(
- ty::Binder::dummy(ty::PredicateKind::WellFormed(inferred_ty.into())),
- Locations::All(span),
- ConstraintCategory::TypeAnnotation,
- );
- }
- UserType::TypeOf(def_id, user_substs) => {
- if let Err(terr) = self.fully_perform_op(
- Locations::All(span),
- ConstraintCategory::BoringNoLocation,
- self.param_env.and(type_op::ascribe_user_type::AscribeUserType::new(
- inferred_ty,
- def_id,
- user_substs,
- )),
- ) {
- span_mirbug!(
- self,
- user_annotation,
- "bad user type AscribeUserType({:?}, {:?} {:?}, type_of={:?}): {:?}",
- inferred_ty,
- def_id,
- user_substs,
- self.tcx().type_of(def_id),
- terr,
- );
- }
- }
- }