mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 14:10:03 +03:00
Merge pull request #159 from dwrensha/is-freeze-needs-drop
update for latest rustc nightly
This commit is contained in:
+2
-2
@@ -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 {
|
||||
|
||||
+5
-1
@@ -163,7 +163,11 @@ fn global_item(
|
||||
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);
|
||||
|
||||
@@ -292,7 +292,7 @@ pub(super) fn call_intrinsic(
|
||||
"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)?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user