Skip to content

Commit 14ba6d9

Browse files
authored
Merge pull request #159 from dwrensha/is-freeze-needs-drop
update for latest rustc nightly
2 parents 9a32772 + d666bd7 commit 14ba6d9

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/eval_context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,13 +1944,13 @@ pub fn needs_drop_glue<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, t: Ty<'tcx>) -> bo
19441944
// code quality is unknown at this time.)
19451945

19461946
let env = tcx.empty_parameter_environment();
1947-
if !tcx.type_needs_drop_given_env(t, &env) {
1947+
if !t.needs_drop(tcx, &env) {
19481948
return false;
19491949
}
19501950
match t.sty {
19511951
ty::TyAdt(def, _) if def.is_box() => {
19521952
let typ = t.boxed_ty();
1953-
if !tcx.type_needs_drop_given_env(typ, &env) && type_is_sized(tcx, typ) {
1953+
if !typ.needs_drop(tcx, &env) && type_is_sized(tcx, typ) {
19541954
tcx.infer_ctxt((), traits::Reveal::All).enter(|infcx| {
19551955
let layout = t.layout(&infcx).unwrap();
19561956
if layout.size(&tcx.data_layout).bytes() == 0 {

src/step.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,11 @@ impl<'a, 'b, 'tcx> ConstantExtractor<'a, 'b, 'tcx> {
163163
self.try(|this| {
164164
let mir = this.ecx.load_mir(instance.def)?;
165165
this.ecx.globals.insert(cid, Global::uninitialized(mir.return_ty));
166-
let mutable = !shared || mir.return_ty.type_contents(this.ecx.tcx).interior_unsafe();
166+
let mutable = !shared ||
167+
!mir.return_ty.is_freeze(
168+
this.ecx.tcx,
169+
&this.ecx.tcx.empty_parameter_environment(),
170+
span);
167171
let cleanup = StackPopCleanup::MarkStatic(mutable);
168172
let name = ty::tls::with(|tcx| tcx.item_path_str(def_id));
169173
trace!("pushing stack frame for global: {}", name);

src/terminator/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
292292
"needs_drop" => {
293293
let ty = substs.type_at(0);
294294
let env = self.tcx.empty_parameter_environment();
295-
let needs_drop = self.tcx.type_needs_drop_given_env(ty, &env);
295+
let needs_drop = ty.needs_drop(self.tcx, &env);
296296
self.write_primval(dest, PrimVal::from_bool(needs_drop), dest_ty)?;
297297
}
298298

0 commit comments

Comments
 (0)