Skip to content

Commit 14848b3

Browse files
authored
Merge pull request rust-lang#179 from dwrensha/rustup
update for upstream ParamEnv changes
2 parents d7d11c1 + ca8347a commit 14848b3

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/eval_context.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
379379
pub(super) fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
380380
// generics are weird, don't run this function on a generic
381381
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)
383383
}
384384

385385
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> {
438438
// TODO(solson): Is this inefficient? Needs investigation.
439439
let ty = self.monomorphize(ty, substs);
440440

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)
444442
}
445443

446444
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
20332031
// returned `false` does not appear unsound. The impact on
20342032
// code quality is unknown at this time.)
20352033

2036-
let env = ty::ParamEnv::empty();
2034+
let env = ty::ParamEnv::empty(Reveal::All);
20372035
if !t.needs_drop(tcx, env) {
20382036
return false;
20392037
}
20402038
match t.sty {
20412039
ty::TyAdt(def, _) if def.is_box() => {
20422040
let typ = t.boxed_ty();
20432041
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
20492045
} else {
20502046
true
20512047
}
@@ -2157,7 +2153,7 @@ impl<'a, 'tcx> ::rustc::ty::fold::TypeFolder<'tcx, 'tcx> for AssociatedTypeNorma
21572153
fn type_is_sized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool {
21582154
// generics are weird, don't run this function on a generic
21592155
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)
21612157
}
21622158

21632159
/// 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>,
21762172

21772173
// Do the initial selection for the obligation. This yields the
21782174
// 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| {
21802176
let mut selcx = traits::SelectionContext::new(&infcx);
21812177

21822178
let obligation_cause = traits::ObligationCause::misc(span,
21832179
ast::DUMMY_NODE_ID);
21842180
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());
21862183

21872184
let selection = match selcx.select(&obligation) {
21882185
Ok(Some(selection)) => selection,

src/step.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use rustc::hir::def_id::DefId;
66
use rustc::hir;
77
use rustc::mir::visit::{Visitor, LvalueContext};
88
use rustc::mir;
9+
use rustc::traits::Reveal;
910
use rustc::ty::layout::Layout;
1011
use rustc::ty::{subst, self};
1112

@@ -197,7 +198,7 @@ impl<'a, 'b, 'tcx> ConstantExtractor<'a, 'b, 'tcx> {
197198
let mutable = !shared ||
198199
!mir.return_ty.is_freeze(
199200
this.ecx.tcx,
200-
ty::ParamEnv::empty(),
201+
ty::ParamEnv::empty(Reveal::All),
201202
span);
202203
let cleanup = StackPopCleanup::MarkStatic(mutable);
203204
let name = ty::tls::with(|tcx| tcx.item_path_str(def_id));

src/terminator/intrinsic.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use rustc::mir;
2+
use rustc::traits::Reveal;
23
use rustc::ty::layout::{Layout, Size, Align};
34
use rustc::ty::subst::Substs;
45
use rustc::ty::{self, Ty};
@@ -291,7 +292,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
291292

292293
"needs_drop" => {
293294
let ty = substs.type_at(0);
294-
let env = ty::ParamEnv::empty();
295+
let env = ty::ParamEnv::empty(Reveal::All);
295296
let needs_drop = ty.needs_drop(self.tcx, env);
296297
self.write_primval(dest, PrimVal::from_bool(needs_drop), dest_ty)?;
297298
}

src/traits.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
1616
pub(crate) fn fulfill_obligation(&self, trait_ref: ty::PolyTraitRef<'tcx>) -> traits::Vtable<'tcx, ()> {
1717
// Do the initial selection for the obligation. This yields the shallow result we are
1818
// looking for -- that is, what specific impl.
19-
self.tcx.infer_ctxt((), Reveal::All).enter(|infcx| {
19+
self.tcx.infer_ctxt(()).enter(|infcx| {
2020
let mut selcx = traits::SelectionContext::new(&infcx);
2121

2222
let obligation = traits::Obligation::new(
2323
traits::ObligationCause::misc(DUMMY_SP, ast::DUMMY_NODE_ID),
24+
ty::ParamEnv::empty(Reveal::All),
2425
trait_ref.to_poly_trait_predicate(),
2526
);
2627
let selection = selcx.select(&obligation).unwrap().unwrap();

0 commit comments

Comments
 (0)