remove AdjustAddEnv
This commit is contained in:
parent
714a5b7f5e
commit
4e9c50e081
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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) => {
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user