Skip to content

update for latest rustc nightly #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1944,13 +1944,13 @@ pub fn needs_drop_glue<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, t: Ty<'tcx>) -> bo
// code quality is unknown at this time.)

let env = tcx.empty_parameter_environment();
if !tcx.type_needs_drop_given_env(t, &env) {
if !t.needs_drop(tcx, &env) {
return false;
}
match t.sty {
ty::TyAdt(def, _) if def.is_box() => {
let typ = t.boxed_ty();
if !tcx.type_needs_drop_given_env(typ, &env) && type_is_sized(tcx, typ) {
if !typ.needs_drop(tcx, &env) && type_is_sized(tcx, typ) {
tcx.infer_ctxt((), traits::Reveal::All).enter(|infcx| {
let layout = t.layout(&infcx).unwrap();
if layout.size(&tcx.data_layout).bytes() == 0 {
Expand Down
6 changes: 5 additions & 1 deletion src/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ impl<'a, 'b, 'tcx> ConstantExtractor<'a, 'b, 'tcx> {
self.try(|this| {
let mir = this.ecx.load_mir(instance.def)?;
this.ecx.globals.insert(cid, Global::uninitialized(mir.return_ty));
let mutable = !shared || mir.return_ty.type_contents(this.ecx.tcx).interior_unsafe();
let mutable = !shared ||
!mir.return_ty.is_freeze(
this.ecx.tcx,
&this.ecx.tcx.empty_parameter_environment(),
span);
let cleanup = StackPopCleanup::MarkStatic(mutable);
let name = ty::tls::with(|tcx| tcx.item_path_str(def_id));
trace!("pushing stack frame for global: {}", name);
Expand Down
2 changes: 1 addition & 1 deletion src/terminator/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
"needs_drop" => {
let ty = substs.type_at(0);
let env = self.tcx.empty_parameter_environment();
let needs_drop = self.tcx.type_needs_drop_given_env(ty, &env);
let needs_drop = ty.needs_drop(self.tcx, &env);
self.write_primval(dest, PrimVal::from_bool(needs_drop), dest_ty)?;
}

Expand Down