@@ -55,7 +55,7 @@ impl<'tcx> PlaceTy<'tcx> {
5555 /// `PlaceElem`, where we can just use the `Ty` that is already
5656 /// stored inline on field projection elems.
5757 pub fn projection_ty ( self , tcx : TyCtxt < ' tcx > , elem : PlaceElem < ' tcx > ) -> PlaceTy < ' tcx > {
58- self . projection_ty_core ( tcx, ty :: ParamEnv :: empty ( ) , & elem, |_, _, ty| ty, |_, ty| ty)
58+ self . projection_ty_core ( tcx, & elem, |_, _, ty| ty, |_, ty| ty)
5959 }
6060
6161 /// `place_ty.projection_ty_core(tcx, elem, |...| { ... })`
@@ -66,7 +66,6 @@ impl<'tcx> PlaceTy<'tcx> {
6666 pub fn projection_ty_core < V , T > (
6767 self ,
6868 tcx : TyCtxt < ' tcx > ,
69- param_env : ty:: ParamEnv < ' tcx > ,
7069 elem : & ProjectionElem < V , T > ,
7170 mut handle_field : impl FnMut ( & Self , FieldIdx , T ) -> Ty < ' tcx > ,
7271 mut handle_opaque_cast_and_subtype : impl FnMut ( & Self , T ) -> Ty < ' tcx > ,
@@ -93,7 +92,9 @@ impl<'tcx> PlaceTy<'tcx> {
9392 ty:: Slice ( ..) => self . ty ,
9493 ty:: Array ( inner, _) if !from_end => Ty :: new_array ( tcx, * inner, to - from) ,
9594 ty:: Array ( inner, size) if from_end => {
96- let size = size. eval_target_usize ( tcx, param_env) ;
95+ let size = size
96+ . try_to_target_usize ( tcx)
97+ . expect ( "expected subslice projection on fixed-size array" ) ;
9798 let len = size - from - to;
9899 Ty :: new_array ( tcx, * inner, len)
99100 }
0 commit comments