]> git.lizzy.rs Git - rust.git/commitdiff
remove AdjustAddEnv
authorJorge Aparicio <japaricious@gmail.com>
Sun, 4 Jan 2015 14:53:08 +0000 (09:53 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Mon, 5 Jan 2015 22:22:15 +0000 (17:22 -0500)
src/librustc/middle/astencode.rs
src/librustc/middle/expr_use_visitor.rs
src/librustc/middle/mem_categorization.rs
src/librustc/middle/ty.rs
src/librustc_trans/trans/consts.rs
src/librustc_trans/trans/expr.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/writeback.rs

index 269b09a5f2ed8abd94189d775c41ffa942669c1d..93a19a01f668fb26d65d2b8b07ba29c40dfed7fd 100644 (file)
@@ -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);
index ed5e8e31b7bb59ec6c3e934c3ee2e665bb2f4ca2..df2a4e4c2532a988616508c89bab76516f8a1c73 100644 (file)
@@ -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
index f5ab4e80945ad9b65743268ecb77033a4d47248c..dd61db4270ce3499bf2642edd8779d37a38578fa 100644 (file)
@@ -413,8 +413,8 @@ pub fn cat_expr(&self, expr: &ast::Expr) -> McResult<cmt<'tcx>> {
 
             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.
index 31916848f5dc8b0a631e87631972e2d161d6b6a1..bc6ac8abe38f536c765eab7453c8c03e16282b63 100644 (file)
@@ -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<T, F>(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)
index b17e852d7cbc44e7408e9107a0ebea6c81321880..2738f1bca6e1e48e169a6e31cfc58765192b20fe 100644 (file)
@@ -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
index 68557289d52ce30db9e01a3678f3ce6248f4ce12..1bf96b7d180e23c734846f5ec37874cb0e993afc 100644 (file)
@@ -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
index 8b62c55ba31eb31a7e8899618fbdadd50d7dcbed..2940d556169686ddde78225def60113568f3fd54 100644 (file)
@@ -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) => {
index 4154937b3fdcd2b77b4cd561889e4ff5b101d260..70644b6e7de5d5386b9822c655205263188547aa 100644 (file)
@@ -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)
                     }