Skip to content

Commit 23b2e69

Browse files
committed
---
yaml --- r: 193679 b: refs/heads/beta c: 0a74387 h: refs/heads/master i: 193677: 8a3f183 193675: 741ed49 193671: 3a3f946 193663: 980a132 v: v3
1 parent 1295fd2 commit 23b2e69

File tree

8 files changed

+29
-78
lines changed

8 files changed

+29
-78
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 64ab111b5387e9985df188a970350c9e6c7f1451
34+
refs/heads/beta: 0a74387b642bfc6ba0c8de723942eafae440bc4a
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ mod prelude {
175175
}
176176

177177
/// An endpoint of a range of keys.
178+
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
178179
pub enum Bound<T> {
179180
/// An inclusive bound.
180181
Included(T),

branches/beta/src/librustc_trans/trans/consts.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,10 @@ fn const_expr_unadjusted<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
505505
// pass. Reporting here is a bit late.
506506
cx.sess().span_err(e.span,
507507
"const index-expr is out of bounds");
508+
C_undef(type_of::type_of(cx, bt).element_type())
509+
} else {
510+
const_get_elt(cx, arr, &[iv as c_uint])
508511
}
509-
const_get_elt(cx, arr, &[iv as c_uint])
510512
}
511513
ast::ExprCast(ref base, _) => {
512514
let llty = type_of::type_of(cx, ety);

branches/beta/src/libsyntax/parse/obsolete.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ use ptr::P;
2424
pub enum ObsoleteSyntax {
2525
Sized,
2626
ForSized,
27-
ProcType,
28-
ProcExpr,
2927
ClosureType,
3028
ClosureKind,
3129
EmptyIndex,
@@ -57,16 +55,6 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
5755
by default",
5856
true,
5957
),
60-
ObsoleteSyntax::ProcType => (
61-
"the `proc` type",
62-
"use unboxed closures instead",
63-
true,
64-
),
65-
ObsoleteSyntax::ProcExpr => (
66-
"`proc` expression",
67-
"use a `move ||` expression instead",
68-
true,
69-
),
7058
ObsoleteSyntax::ClosureType => (
7159
"`|usize| -> bool` closure type",
7260
"use unboxed closures instead, no type annotation needed",

branches/beta/src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,9 +1051,7 @@ impl<'a> Parser<'a> {
10511051
let lifetime_defs = self.parse_late_bound_lifetime_defs();
10521052

10531053
// examine next token to decide to do
1054-
if self.eat_keyword_noexpect(keywords::Proc) {
1055-
self.parse_proc_type(lifetime_defs)
1056-
} else if self.token_is_bare_fn_keyword() || self.token_is_closure_keyword() {
1054+
if self.token_is_bare_fn_keyword() || self.token_is_closure_keyword() {
10571055
self.parse_ty_bare_fn_or_ty_closure(lifetime_defs)
10581056
} else if self.check(&token::ModSep) ||
10591057
self.token.is_ident() ||
@@ -1121,35 +1119,6 @@ impl<'a> Parser<'a> {
11211119
}))
11221120
}
11231121

1124-
/// Parses a procedure type (`proc`). The initial `proc` keyword must
1125-
/// already have been parsed.
1126-
pub fn parse_proc_type(&mut self, lifetime_defs: Vec<ast::LifetimeDef>) -> Ty_ {
1127-
/*
1128-
1129-
proc <'lt> (S) [:Bounds] -> T
1130-
^~~^ ^~~~^ ^ ^~~~~~~~^ ^
1131-
| | | | |
1132-
| | | | Return type
1133-
| | | Bounds
1134-
| | Argument types
1135-
| Legacy lifetimes
1136-
the `proc` keyword (already consumed)
1137-
1138-
*/
1139-
1140-
let proc_span = self.last_span;
1141-
1142-
// To be helpful, parse the proc as ever
1143-
let _ = self.parse_legacy_lifetime_defs(lifetime_defs);
1144-
let _ = self.parse_fn_args(false, false);
1145-
let _ = self.parse_colon_then_ty_param_bounds(BoundParsingMode::Bare);
1146-
let _ = self.parse_ret_ty();
1147-
1148-
self.obsolete(proc_span, ObsoleteSyntax::ProcType);
1149-
1150-
TyInfer
1151-
}
1152-
11531122
/// Parses an obsolete closure kind (`&:`, `&mut:`, or `:`).
11541123
pub fn parse_obsolete_closure_kind(&mut self) {
11551124
let lo = self.span.lo;
@@ -1522,8 +1491,6 @@ impl<'a> Parser<'a> {
15221491
let e = self.parse_expr();
15231492
self.expect(&token::CloseDelim(token::Paren));
15241493
TyTypeof(e)
1525-
} else if self.eat_keyword_noexpect(keywords::Proc) {
1526-
self.parse_proc_type(Vec::new())
15271494
} else if self.eat_lt() {
15281495
// QUALIFIED PATH `<TYPE as TRAIT_REF>::item`
15291496
let self_type = self.parse_ty_sum();
@@ -2285,12 +2252,6 @@ impl<'a> Parser<'a> {
22852252
if self.eat_keyword(keywords::Move) {
22862253
return self.parse_lambda_expr(CaptureByValue);
22872254
}
2288-
if self.eat_keyword_noexpect(keywords::Proc) {
2289-
let span = self.last_span;
2290-
let _ = self.parse_proc_decl();
2291-
let _ = self.parse_expr();
2292-
return self.obsolete_expr(span, ObsoleteSyntax::ProcExpr);
2293-
}
22942255
if self.eat_keyword(keywords::If) {
22952256
return self.parse_if_expr();
22962257
}
@@ -4645,23 +4606,6 @@ impl<'a> Parser<'a> {
46454606
})
46464607
}
46474608

4648-
/// Parses the `(arg, arg) -> return_type` header on a procedure.
4649-
fn parse_proc_decl(&mut self) -> P<FnDecl> {
4650-
let inputs =
4651-
self.parse_unspanned_seq(&token::OpenDelim(token::Paren),
4652-
&token::CloseDelim(token::Paren),
4653-
seq_sep_trailing_allowed(token::Comma),
4654-
|p| p.parse_fn_block_arg());
4655-
4656-
let output = self.parse_ret_ty();
4657-
4658-
P(FnDecl {
4659-
inputs: inputs,
4660-
output: output,
4661-
variadic: false
4662-
})
4663-
}
4664-
46654609
/// Parse the name and optional generic types of a function header.
46664610
fn parse_fn_header(&mut self) -> (Ident, ast::Generics) {
46674611
let id = self.parse_ident();

branches/beta/src/libsyntax/parse/token.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,11 +561,11 @@ declare_special_idents_and_keywords! {
561561
(39, Virtual, "virtual");
562562
(40, While, "while");
563563
(41, Continue, "continue");
564-
(42, Proc, "proc");
565-
(43, Box, "box");
566-
(44, Const, "const");
567-
(45, Where, "where");
564+
(42, Box, "box");
565+
(43, Const, "const");
566+
(44, Where, "where");
568567
'reserved:
568+
(45, Proc, "proc");
569569
(46, Alignof, "alignof");
570570
(47, Become, "become");
571571
(48, Offsetof, "offsetof");
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
const FOO: [u32; 3] = [1, 2, 3];
12+
const BAR: u32 = FOO[5]; //~ ERROR const index-expr is out of bounds
13+
14+
fn main() {
15+
let _ = BAR;
16+
}

branches/beta/src/test/parse-fail/obsolete-proc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
// Test that we generate obsolete syntax errors around usages of `proc`.
1212

13-
fn foo(p: proc()) { } //~ ERROR obsolete syntax: the `proc` type
13+
fn foo(p: proc()) { } //~ ERROR `proc` is a reserved keyword
1414

15-
fn bar() { proc() 1; } //~ ERROR obsolete syntax: `proc` expression
15+
fn bar() { proc() 1; }
1616

17-
fn main() { }
17+
fn main() { }

0 commit comments

Comments
 (0)