@@ -379,7 +379,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
379
379
pub ( super ) fn type_is_sized ( & self , ty : Ty < ' tcx > ) -> bool {
380
380
// generics are weird, don't run this function on a generic
381
381
assert ! ( !ty. needs_subst( ) ) ;
382
- ty. is_sized ( self . tcx , ty:: ParamEnv :: empty ( ) , DUMMY_SP )
382
+ ty. is_sized ( self . tcx , ty:: ParamEnv :: empty ( Reveal :: All ) , DUMMY_SP )
383
383
}
384
384
385
385
pub fn load_mir ( & self , instance : ty:: InstanceDef < ' tcx > ) -> EvalResult < ' tcx , & ' tcx mir:: Mir < ' tcx > > {
@@ -438,9 +438,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
438
438
// TODO(solson): Is this inefficient? Needs investigation.
439
439
let ty = self . monomorphize ( ty, substs) ;
440
440
441
- self . tcx . infer_ctxt ( ( ) , Reveal :: All ) . enter ( |infcx| {
442
- ty. layout ( & infcx) . map_err ( EvalError :: Layout )
443
- } )
441
+ ty. layout ( self . tcx , ty:: ParamEnv :: empty ( Reveal :: All ) ) . map_err ( EvalError :: Layout )
444
442
}
445
443
446
444
pub fn push_stack_frame (
@@ -2033,19 +2031,17 @@ pub fn needs_drop_glue<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, t: Ty<'tcx>) -> bo
2033
2031
// returned `false` does not appear unsound. The impact on
2034
2032
// code quality is unknown at this time.)
2035
2033
2036
- let env = ty:: ParamEnv :: empty ( ) ;
2034
+ let env = ty:: ParamEnv :: empty ( Reveal :: All ) ;
2037
2035
if !t. needs_drop ( tcx, env) {
2038
2036
return false ;
2039
2037
}
2040
2038
match t. sty {
2041
2039
ty:: TyAdt ( def, _) if def. is_box ( ) => {
2042
2040
let typ = t. boxed_ty ( ) ;
2043
2041
if !typ. needs_drop ( tcx, env) && type_is_sized ( tcx, typ) {
2044
- tcx. infer_ctxt ( ( ) , traits:: Reveal :: All ) . enter ( |infcx| {
2045
- let layout = t. layout ( & infcx) . unwrap ( ) ;
2046
- // `Box<ZeroSizeType>` does not allocate.
2047
- layout. size ( & tcx. data_layout ) . bytes ( ) != 0
2048
- } )
2042
+ let layout = t. layout ( tcx, ty:: ParamEnv :: empty ( Reveal :: All ) ) . unwrap ( ) ;
2043
+ // `Box<ZeroSizeType>` does not allocate.
2044
+ layout. size ( & tcx. data_layout ) . bytes ( ) != 0
2049
2045
} else {
2050
2046
true
2051
2047
}
@@ -2157,7 +2153,7 @@ impl<'a, 'tcx> ::rustc::ty::fold::TypeFolder<'tcx, 'tcx> for AssociatedTypeNorma
2157
2153
fn type_is_sized < ' a , ' tcx > ( tcx : TyCtxt < ' a , ' tcx , ' tcx > , ty : Ty < ' tcx > ) -> bool {
2158
2154
// generics are weird, don't run this function on a generic
2159
2155
assert ! ( !ty. needs_subst( ) ) ;
2160
- ty. is_sized ( tcx, ty:: ParamEnv :: empty ( ) , DUMMY_SP )
2156
+ ty. is_sized ( tcx, ty:: ParamEnv :: empty ( Reveal :: All ) , DUMMY_SP )
2161
2157
}
2162
2158
2163
2159
/// Attempts to resolve an obligation. The result is a shallow vtable resolution -- meaning that we
@@ -2176,13 +2172,14 @@ fn fulfill_obligation<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
2176
2172
2177
2173
// Do the initial selection for the obligation. This yields the
2178
2174
// shallow result we are looking for -- that is, what specific impl.
2179
- tcx. infer_ctxt ( ( ) , Reveal :: All ) . enter ( |infcx| {
2175
+ tcx. infer_ctxt ( ( ) ) . enter ( |infcx| {
2180
2176
let mut selcx = traits:: SelectionContext :: new ( & infcx) ;
2181
2177
2182
2178
let obligation_cause = traits:: ObligationCause :: misc ( span,
2183
2179
ast:: DUMMY_NODE_ID ) ;
2184
2180
let obligation = traits:: Obligation :: new ( obligation_cause,
2185
- trait_ref. to_poly_trait_predicate ( ) ) ;
2181
+ ty:: ParamEnv :: empty ( Reveal :: All ) ,
2182
+ trait_ref. to_poly_trait_predicate ( ) ) ;
2186
2183
2187
2184
let selection = match selcx. select ( & obligation) {
2188
2185
Ok ( Some ( selection) ) => selection,
0 commit comments