Skip to content

Commit d258d68

Browse files
committed
Remove proc types/expressions from the parser, compiler, and
language. Recommend `move||` instead.
1 parent 9cc8453 commit d258d68

File tree

33 files changed

+91
-321
lines changed

33 files changed

+91
-321
lines changed

src/libcore/raw.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,6 @@ pub struct Closure {
4040

4141
impl Copy for Closure {}
4242

43-
/// The representation of a Rust procedure (`proc()`)
44-
#[repr(C)]
45-
pub struct Procedure {
46-
pub code: *mut (),
47-
pub env: *mut (),
48-
}
49-
50-
impl Copy for Procedure {}
51-
5243
/// The representation of a Rust trait object.
5344
///
5445
/// This struct does not have a `Repr` implementation

src/librustc/middle/cfg/construct.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,6 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
498498

499499
ast::ExprMac(..) |
500500
ast::ExprClosure(..) |
501-
ast::ExprProc(..) |
502501
ast::ExprLit(..) |
503502
ast::ExprPath(..) => {
504503
self.straightline(expr, pred, None::<ast::Expr>.iter())

src/librustc/middle/check_loop.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ impl<'a, 'v> Visitor<'v> for CheckLoopVisitor<'a> {
5252
self.visit_expr(&**e);
5353
self.with_context(Loop, |v| v.visit_block(&**b));
5454
}
55-
ast::ExprClosure(_, _, _, ref b) |
56-
ast::ExprProc(_, ref b) => {
55+
ast::ExprClosure(_, _, _, ref b) => {
5756
self.with_context(Closure, |v| v.visit_block(&**b));
5857
}
5958
ast::ExprBreak(_) => self.require_loop("break", e.span),

src/librustc/middle/expr_use_visitor.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,7 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
613613
self.consume_expr(&**count);
614614
}
615615

616-
ast::ExprClosure(..) |
617-
ast::ExprProc(..) => {
616+
ast::ExprClosure(..) => {
618617
self.walk_captures(expr)
619618
}
620619

src/librustc/middle/infer/error_reporting.rs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -587,19 +587,6 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
587587
sub,
588588
"");
589589
}
590-
infer::ProcCapture(span, id) => {
591-
self.tcx.sess.span_err(
592-
span,
593-
format!("captured variable `{}` must be 'static \
594-
to be captured in a proc",
595-
ty::local_var_name_str(self.tcx, id).get())
596-
.as_slice());
597-
note_and_explain_region(
598-
self.tcx,
599-
"captured variable is only valid for ",
600-
sup,
601-
"");
602-
}
603590
infer::IndexSlice(span) => {
604591
self.tcx.sess.span_err(span,
605592
"index of slice outside its lifetime");
@@ -625,28 +612,6 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
625612
sup,
626613
"");
627614
}
628-
infer::RelateProcBound(span, var_node_id, ty) => {
629-
self.tcx.sess.span_err(
630-
span,
631-
format!(
632-
"the type `{}` of captured variable `{}` \
633-
outlives the `proc()` it \
634-
is captured in",
635-
self.ty_to_string(ty),
636-
ty::local_var_name_str(self.tcx,
637-
var_node_id)).as_slice());
638-
note_and_explain_region(
639-
self.tcx,
640-
"`proc()` is valid for ",
641-
sub,
642-
"");
643-
note_and_explain_region(
644-
self.tcx,
645-
format!("the type `{}` is only valid for ",
646-
self.ty_to_string(ty)).as_slice(),
647-
sup,
648-
"");
649-
}
650615
infer::RelateParamBound(span, ty) => {
651616
self.tcx.sess.span_err(
652617
span,
@@ -1587,15 +1552,6 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx> {
15871552
self.tcx,
15881553
id).get().to_string()).as_slice());
15891554
}
1590-
infer::ProcCapture(span, id) => {
1591-
self.tcx.sess.span_note(
1592-
span,
1593-
format!("...so that captured variable `{}` \
1594-
is 'static",
1595-
ty::local_var_name_str(
1596-
self.tcx,
1597-
id).get()).as_slice());
1598-
}
15991555
infer::IndexSlice(span) => {
16001556
self.tcx.sess.span_note(
16011557
span,
@@ -1606,15 +1562,6 @@ impl<'a, 'tcx> ErrorReportingHelpers<'tcx> for InferCtxt<'a, 'tcx> {
16061562
span,
16071563
"...so that it can be closed over into an object");
16081564
}
1609-
infer::RelateProcBound(span, var_node_id, _ty) => {
1610-
self.tcx.sess.span_note(
1611-
span,
1612-
format!(
1613-
"...so that the variable `{}` can be captured \
1614-
into a proc",
1615-
ty::local_var_name_str(self.tcx,
1616-
var_node_id)).as_slice());
1617-
}
16181565
infer::CallRcvr(span) => {
16191566
self.tcx.sess.span_note(
16201567
span,

src/librustc/middle/infer/mod.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,13 @@ pub enum SubregionOrigin<'tcx> {
175175
// Closure bound must not outlive captured free variables
176176
FreeVariable(Span, ast::NodeId),
177177

178-
// Proc upvars must be 'static
179-
ProcCapture(Span, ast::NodeId),
180-
181178
// Index into slice must be within its lifetime
182179
IndexSlice(Span),
183180

184181
// When casting `&'a T` to an `&'b Trait` object,
185182
// relating `'a` to `'b`
186183
RelateObjectBound(Span),
187184

188-
// When closing over a variable in a closure/proc, ensure that the
189-
// type of the variable outlives the lifetime bound.
190-
RelateProcBound(Span, ast::NodeId, Ty<'tcx>),
191-
192185
// Some type parameter was instantiated with the given type,
193186
// and that type must outlive some region.
194187
RelateParamBound(Span, Ty<'tcx>),
@@ -1089,10 +1082,8 @@ impl<'tcx> SubregionOrigin<'tcx> {
10891082
InvokeClosure(a) => a,
10901083
DerefPointer(a) => a,
10911084
FreeVariable(a, _) => a,
1092-
ProcCapture(a, _) => a,
10931085
IndexSlice(a) => a,
10941086
RelateObjectBound(a) => a,
1095-
RelateProcBound(a, _, _) => a,
10961087
RelateParamBound(a, _) => a,
10971088
RelateRegionParamBound(a) => a,
10981089
RelateDefaultParamBound(a, _) => a,
@@ -1128,21 +1119,12 @@ impl<'tcx> Repr<'tcx> for SubregionOrigin<'tcx> {
11281119
FreeVariable(a, b) => {
11291120
format!("FreeVariable({}, {})", a.repr(tcx), b)
11301121
}
1131-
ProcCapture(a, b) => {
1132-
format!("ProcCapture({}, {})", a.repr(tcx), b)
1133-
}
11341122
IndexSlice(a) => {
11351123
format!("IndexSlice({})", a.repr(tcx))
11361124
}
11371125
RelateObjectBound(a) => {
11381126
format!("RelateObjectBound({})", a.repr(tcx))
11391127
}
1140-
RelateProcBound(a, b, c) => {
1141-
format!("RelateProcBound({},{},{})",
1142-
a.repr(tcx),
1143-
b,
1144-
c.repr(tcx))
1145-
}
11461128
RelateParamBound(a, b) => {
11471129
format!("RelateParamBound({},{})",
11481130
a.repr(tcx),

src/librustc/middle/liveness.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
461461
}
462462
visit::walk_expr(ir, expr);
463463
}
464-
ast::ExprClosure(..) | ast::ExprProc(..) => {
464+
ast::ExprClosure(..) => {
465465
// Interesting control flow (for loops can contain labeled
466466
// breaks or continues)
467467
ir.add_live_node_for_node(expr.id, ExprNode(expr.span));
@@ -981,9 +981,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
981981
self.propagate_through_expr(&**e, succ)
982982
}
983983

984-
ast::ExprClosure(_, _, _, ref blk) |
985-
ast::ExprProc(_, ref blk) => {
986-
debug!("{} is an ExprClosure or ExprProc",
984+
ast::ExprClosure(_, _, _, ref blk) => {
985+
debug!("{} is an ExprClosure",
987986
expr_to_string(expr));
988987

989988
/*
@@ -1502,8 +1501,7 @@ fn check_expr(this: &mut Liveness, expr: &Expr) {
15021501
ast::ExprBreak(..) | ast::ExprAgain(..) | ast::ExprLit(_) |
15031502
ast::ExprBlock(..) | ast::ExprMac(..) | ast::ExprAddrOf(..) |
15041503
ast::ExprStruct(..) | ast::ExprRepeat(..) | ast::ExprParen(..) |
1505-
ast::ExprClosure(..) | ast::ExprProc(..) |
1506-
ast::ExprPath(..) | ast::ExprBox(..) | ast::ExprSlice(..) => {
1504+
ast::ExprClosure(..) | ast::ExprPath(..) | ast::ExprBox(..) | ast::ExprSlice(..) => {
15071505
visit::walk_expr(this, expr);
15081506
}
15091507
ast::ExprIfLet(..) => {

src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
555555

556556
ast::ExprAddrOf(..) | ast::ExprCall(..) |
557557
ast::ExprAssign(..) | ast::ExprAssignOp(..) |
558-
ast::ExprClosure(..) | ast::ExprProc(..) |
559-
ast::ExprRet(..) |
558+
ast::ExprClosure(..) | ast::ExprRet(..) |
560559
ast::ExprUnary(..) | ast::ExprSlice(..) |
561560
ast::ExprMethodCall(..) | ast::ExprCast(..) |
562561
ast::ExprVec(..) | ast::ExprTup(..) | ast::ExprIf(..) |
@@ -728,7 +727,6 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
728727
};
729728

730729
match fn_expr.node {
731-
ast::ExprProc(_, ref body) |
732730
ast::ExprClosure(_, _, _, ref body) => body.id,
733731
_ => unreachable!()
734732
}

src/librustc/middle/resolve.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use util::nodemap::{NodeMap, NodeSet, DefIdSet, FnvHashMap};
5151
use syntax::ast::{Arm, BindByRef, BindByValue, BindingMode, Block, Crate, CrateNum};
5252
use syntax::ast::{DeclItem, DefId, Expr, ExprAgain, ExprBreak, ExprField};
5353
use syntax::ast::{ExprClosure, ExprForLoop, ExprLoop, ExprWhile, ExprMethodCall};
54-
use syntax::ast::{ExprPath, ExprProc, ExprStruct, FnDecl};
54+
use syntax::ast::{ExprPath, ExprStruct, FnDecl};
5555
use syntax::ast::{ForeignItem, ForeignItemFn, ForeignItemStatic, Generics};
5656
use syntax::ast::{Ident, ImplItem, Item, ItemEnum, ItemFn, ItemForeignMod};
5757
use syntax::ast::{ItemImpl, ItemMac, ItemMod, ItemStatic, ItemStruct};
@@ -64,7 +64,7 @@ use syntax::ast::{RegionTyParamBound, StmtDecl, StructField};
6464
use syntax::ast::{StructVariantKind, TraitRef, TraitTyParamBound};
6565
use syntax::ast::{TupleVariantKind, Ty, TyBool, TyChar, TyClosure, TyF32};
6666
use syntax::ast::{TyF64, TyFloat, TyI, TyI8, TyI16, TyI32, TyI64, TyInt, TyObjectSum};
67-
use syntax::ast::{TyParam, TyParamBound, TyPath, TyPtr, TyPolyTraitRef, TyProc, TyQPath};
67+
use syntax::ast::{TyParam, TyParamBound, TyPath, TyPtr, TyPolyTraitRef, TyQPath};
6868
use syntax::ast::{TyRptr, TyStr, TyU, TyU8, TyU16, TyU32, TyU64, TyUint};
6969
use syntax::ast::{TypeImplItem, UnnamedField};
7070
use syntax::ast::{Variant, ViewItem, ViewItemExternCrate};
@@ -5027,7 +5027,7 @@ impl<'a> Resolver<'a> {
50275027
self.resolve_trait_reference(ty.id, &*qpath.trait_ref, TraitQPath);
50285028
}
50295029

5030-
TyClosure(ref c) | TyProc(ref c) => {
5030+
TyClosure(ref c) => {
50315031
self.resolve_type_parameter_bounds(
50325032
ty.id,
50335033
&c.bounds,
@@ -5902,13 +5902,6 @@ impl<'a> Resolver<'a> {
59025902
&**block);
59035903
}
59045904

5905-
ExprProc(ref fn_decl, ref block) => {
5906-
self.capture_mode_map.insert(expr.id, ast::CaptureByValue);
5907-
self.resolve_function(ClosureRibKind(expr.id, block.id),
5908-
Some(&**fn_decl), NoTypeParameters,
5909-
&**block);
5910-
}
5911-
59125905
ExprStruct(ref path, _, _) => {
59135906
// Resolve the path to the structure it goes to. We don't
59145907
// check to ensure that the path is actually a structure; that

src/librustc/middle/resolve_lifetime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> {
141141

142142
fn visit_ty(&mut self, ty: &ast::Ty) {
143143
match ty.node {
144-
ast::TyClosure(ref c) | ast::TyProc(ref c) => {
144+
ast::TyClosure(ref c) => {
145145
// Careful, the bounds on a closure/proc are *not* within its binder.
146146
visit::walk_ty_param_bounds_helper(self, &c.bounds);
147147
visit::walk_lifetime_decls_helper(self, &c.lifetimes);

0 commit comments

Comments
 (0)