diff --git a/src/librustc/middle/astencode.rs b/src/librustc/middle/astencode.rs index 269b09a5f2e..93a19a01f66 100644 --- a/src/librustc/middle/astencode.rs +++ b/src/librustc/middle/astencode.rs @@ -1031,13 +1031,6 @@ fn emit_auto_adjustment<'b>(&mut self, ecx: &e::EncodeContext<'b, 'tcx>, self.emit_enum("AutoAdjustment", |this| { match *adj { - ty::AdjustAddEnv(def_id, store) => { - this.emit_enum_variant("AdjustAddEnv", 0, 2, |this| { - this.emit_enum_variant_arg(0, |this| def_id.encode(this)); - this.emit_enum_variant_arg(1, |this| store.encode(this)) - }) - } - ty::AdjustReifyFnPointer(def_id) => { this.emit_enum_variant("AdjustReifyFnPointer", 1, 2, |this| { this.emit_enum_variant_arg(0, |this| def_id.encode(this)) @@ -1678,14 +1671,6 @@ fn read_auto_adjustment<'b, 'c>(&mut self, dcx: &DecodeContext<'b, 'c, 'tcx>) let variants = ["AutoAddEnv", "AutoDerefRef"]; this.read_enum_variant(&variants, |this, i| { Ok(match i { - 0 => { - let def_id: ast::DefId = - this.read_def_id(dcx); - let store: ty::TraitStore = - this.read_enum_variant_arg(0, |this| Decodable::decode(this)).unwrap(); - - ty::AdjustAddEnv(def_id, store.tr(dcx)) - } 1 => { let def_id: ast::DefId = this.read_def_id(dcx); diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index ed5e8e31b7b..df2a4e4c253 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -823,7 +823,6 @@ fn walk_adjustment(&mut self, expr: &ast::Expr) { None => { } Some(adjustment) => { match *adjustment { - ty::AdjustAddEnv(..) | ty::AdjustReifyFnPointer(..) => { // Creating a closure/fn-pointer consumes the // input and stores it into the resulting diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index f5ab4e80945..dd61db4270c 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -413,8 +413,8 @@ pub fn cat_expr(&self, expr: &ast::Expr) -> McResult> { Some(adjustment) => { match *adjustment { - ty::AdjustAddEnv(..) | ty::AdjustReifyFnPointer(..) => { - debug!("cat_expr(AdjustAddEnv|AdjustReifyFnPointer): {}", + ty::AdjustReifyFnPointer(..) => { + debug!("cat_expr(AdjustReifyFnPointer): {}", expr.repr(self.tcx())); // Convert a bare fn to a closure by adding NULL env. // Result is an rvalue. diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 31916848f5d..bc6ac8abe38 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -293,7 +293,6 @@ pub enum Variance { #[derive(Clone, Show)] pub enum AutoAdjustment<'tcx> { - AdjustAddEnv(ast::DefId, ty::TraitStore), AdjustReifyFnPointer(ast::DefId), // go from a fn-item type to a fn-pointer type AdjustDerefRef(AutoDerefRef<'tcx>) } @@ -4315,33 +4314,6 @@ pub fn adjust_ty<'tcx, F>(cx: &ctxt<'tcx>, return match adjustment { Some(adjustment) => { match *adjustment { - AdjustAddEnv(_, store) => { - match unadjusted_ty.sty { - ty::ty_bare_fn(Some(_), ref b) => { - let bounds = ty::ExistentialBounds { - region_bound: ReStatic, - builtin_bounds: all_builtin_bounds(), - projection_bounds: vec!(), - }; - - ty::mk_closure( - cx, - ty::ClosureTy {unsafety: b.unsafety, - onceness: ast::Many, - store: store, - bounds: bounds, - sig: b.sig.clone(), - abi: b.abi}) - } - ref b => { - cx.sess.bug( - format!("add_env adjustment on non-fn-item: \ - {}", - b).as_slice()); - } - } - } - AdjustReifyFnPointer(_) => { match unadjusted_ty.sty { ty::ty_bare_fn(Some(_), b) => { @@ -6696,7 +6668,6 @@ pub fn with_freevars(tcx: &ty::ctxt, fid: ast::NodeId, f: F) -> T where impl<'tcx> AutoAdjustment<'tcx> { pub fn is_identity(&self) -> bool { match *self { - AdjustAddEnv(..) => false, AdjustReifyFnPointer(..) => false, AdjustDerefRef(ref r) => r.is_identity(), } @@ -6820,11 +6791,8 @@ pub fn shifted(&self, amount: u32) -> DebruijnIndex { impl<'tcx> Repr<'tcx> for AutoAdjustment<'tcx> { fn repr(&self, tcx: &ctxt<'tcx>) -> String { match *self { - AdjustAddEnv(def_id, ref trait_store) => { - format!("AdjustAddEnv({},{})", def_id.repr(tcx), trait_store) - } AdjustReifyFnPointer(def_id) => { - format!("AdjustAddEnv({})", def_id.repr(tcx)) + format!("AdjustReifyFnPointer({})", def_id.repr(tcx)) } AdjustDerefRef(ref data) => { data.repr(tcx) diff --git a/src/librustc_trans/trans/consts.rs b/src/librustc_trans/trans/consts.rs index b17e852d7cb..2738f1bca6e 100644 --- a/src/librustc_trans/trans/consts.rs +++ b/src/librustc_trans/trans/consts.rs @@ -189,20 +189,6 @@ pub fn const_expr<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, e: &ast::Expr) None => { } Some(adj) => { match adj { - ty::AdjustAddEnv(def_id, ty::RegionTraitStore(ty::ReStatic, _)) => { - let wrapper = closure::get_wrapper_for_bare_fn(cx, - ety_adjusted, - def_id, - llconst, - true); - llconst = C_struct(cx, &[wrapper, C_null(Type::i8p(cx))], false) - } - ty::AdjustAddEnv(_, store) => { - cx.sess() - .span_bug(e.span, - format!("unexpected static function: {}", - store)[]) - } ty::AdjustReifyFnPointer(_def_id) => { // FIXME(#19925) once fn item types are // zero-sized, we'll need to do something here diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs index 68557289d52..1bf96b7d180 100644 --- a/src/librustc_trans/trans/expr.rs +++ b/src/librustc_trans/trans/expr.rs @@ -54,7 +54,7 @@ use trans::tvec; use trans::type_of; use middle::ty::{struct_fields, tup_fields}; -use middle::ty::{AdjustDerefRef, AdjustReifyFnPointer, AdjustAddEnv, AutoUnsafe}; +use middle::ty::{AdjustDerefRef, AdjustReifyFnPointer, AutoUnsafe}; use middle::ty::{AutoPtr}; use middle::ty::{self, Ty}; use middle::ty::MethodCall; @@ -179,9 +179,6 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, datum.to_string(bcx.ccx()), adjustment.repr(bcx.tcx())); match adjustment { - AdjustAddEnv(def_id, _) => { - datum = unpack_datum!(bcx, add_env(bcx, def_id, expr, datum)); - } AdjustReifyFnPointer(_def_id) => { // FIXME(#19925) once fn item types are // zero-sized, we'll need to do something here diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 8b62c55ba31..2940d556169 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1850,7 +1850,6 @@ fn register_adjustment_obligations(&self, span: Span, adj: &ty::AutoAdjustment<'tcx>) { match *adj { - ty::AdjustAddEnv(..) | ty::AdjustReifyFnPointer(..) => { } ty::AdjustDerefRef(ref d_r) => { diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 4154937b3fd..70644b6e7de 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -266,10 +266,6 @@ fn visit_adjustments(&self, reason: ResolveReason, id: ast::NodeId) { Some(adjustment) => { let adj_object = ty::adjust_is_object(&adjustment); let resolved_adjustment = match adjustment { - ty::AdjustAddEnv(def_id, store) => { - ty::AdjustAddEnv(def_id, self.resolve(&store, reason)) - } - ty::AdjustReifyFnPointer(def_id) => { ty::AdjustReifyFnPointer(def_id) }