update for latest rustc nightly: type_needs_drop_given_env() and type_contents() are gone
This commit is contained in:
parent
9a32772f92
commit
d666bd7e62
3 changed files with 8 additions and 4 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)?;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue