- // Enforce that the type is `usize`/pointer-sized. For now, only those
- // can be coerced to `dyn*`, except for `dyn* -> dyn*` upcasts.
- if !a.is_dyn_star() {
- obligations.push(Obligation::new(
- self.tcx,
- self.cause.clone(),
- self.param_env,
- ty::Binder::dummy(ty::TraitRef::new(
- self.tcx.require_lang_item(hir::LangItem::PointerSized, Some(self.cause.span)),
- self.tcx.mk_substs_trait(a, &[]),
- ))
- .to_poly_trait_predicate(),
- ));
- }
+ // Enforce that the type is `usize`/pointer-sized.
+ obligations.push(Obligation::new(
+ self.tcx,
+ self.cause.clone(),
+ self.param_env,
+ ty::Binder::dummy(
+ self.tcx.at(self.cause.span).mk_trait_ref(hir::LangItem::PointerSized, [a]),
+ )
+ .to_poly_trait_predicate(),
+ ));