Skip to content

Commit 7d749a7

Browse files
committed
---
yaml --- r: 152926 b: refs/heads/try2 c: a208842 h: refs/heads/master v: v3
1 parent f35ff87 commit 7d749a7

32 files changed

+202
-520
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: e6d6c8beaa6a0b77334bdbed7105b3c3c17420be
8+
refs/heads/try2: a208842b9d2e62ffeaa8d6b7e02ce523efae033c
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/guide-macros.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,6 @@ macro_rules! biased_match_rec (
355355
_ => { $err }
356356
}
357357
);
358-
// Produce the requested values
359358
( binds $( $bind_res:ident ),* ) => ( ($( $bind_res ),*) )
360359
)
361360
@@ -365,7 +364,7 @@ macro_rules! biased_match (
365364
( $( ($e:expr) ~ ($p:pat) else $err:stmt ; )*
366365
binds $bind_res:ident
367366
) => (
368-
let $bind_res = biased_match_rec!(
367+
let ( $( $bind_res ),* ) = biased_match_rec!(
369368
$( ($e) ~ ($p) else $err ; )*
370369
binds $bind_res
371370
);

branches/try2/src/doc/guide.md

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -411,64 +411,3 @@ rest of your Rust career.
411411

412412
Next, we'll learn more about Rust itself, by starting to write a more complicated
413413
program. We hope you want to do more with Rust than just print "Hello, world!"
414-
415-
## If
416-
417-
## Functions
418-
419-
return
420-
421-
comments
422-
423-
## Testing
424-
425-
attributes
426-
427-
stability markers
428-
429-
## Crates and Modules
430-
431-
visibility
432-
433-
## Compound Data Types
434-
435-
Tuples
436-
437-
Structs
438-
439-
Enums
440-
441-
## Match
442-
443-
## Looping
444-
445-
for
446-
447-
while
448-
449-
loop
450-
451-
break/continue
452-
453-
iterators
454-
455-
## Lambdas
456-
457-
## Generics
458-
459-
## Traits
460-
461-
## Operators and built-in Traits
462-
463-
## Ownership and Lifetimes
464-
465-
Move vs. Copy
466-
467-
Allocation
468-
469-
## Tasks
470-
471-
## Macros
472-
473-
## Unsafe
474-

branches/try2/src/doc/tutorial.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -493,12 +493,11 @@ by an *action* (expression). Each case is separated by commas. It is
493493
often convenient to use a block expression for each case, in which case
494494
the commas are optional as shown below. Literals are valid patterns and
495495
match only their own value. A single arm may match multiple different
496-
patterns by combining them with the pipe operator (`|`), so long as
497-
every pattern binds the same set of variables (see "destructuring"
498-
below). Ranges of numeric literal patterns can be expressed with two
499-
dots, as in `M..N`. The underscore (`_`) is a wildcard pattern that
500-
matches any single value. (`..`) is a different wildcard that can match
501-
one or more fields in an `enum` variant.
496+
patterns by combining them with the pipe operator (`|`), so long as every
497+
pattern binds the same set of variables. Ranges of numeric literal
498+
patterns can be expressed with two dots, as in `M..N`. The underscore
499+
(`_`) is a wildcard pattern that matches any single value. (`..`) is a
500+
different wildcard that can match one or more fields in an `enum` variant.
502501

503502
~~~
504503
# let my_number = 1;

branches/try2/src/libcollections/vec.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,14 +956,17 @@ impl<T> Vec<T> {
956956
///
957957
/// # Failure
958958
///
959-
/// Fails if `index` is out of bounds of the vector.
959+
/// Fails if `index` is not between `0` and the vector's length (both
960+
/// bounds inclusive).
960961
///
961962
/// # Example
962963
///
963964
/// ```rust
964965
/// let mut vec = vec!(1i, 2, 3);
965966
/// vec.insert(1, 4);
966967
/// assert_eq!(vec, vec!(1, 4, 2, 3));
968+
/// vec.insert(4, 5);
969+
/// assert_eq!(vec, vec!(1, 4, 2, 3, 5));
967970
/// ```
968971
pub fn insert(&mut self, index: uint, element: T) {
969972
let len = self.len();

branches/try2/src/librustc/lint/builtin.rs

Lines changed: 13 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -975,52 +975,14 @@ declare_lint!(UNNECESSARY_PARENS, Warn,
975975
pub struct UnnecessaryParens;
976976

977977
impl UnnecessaryParens {
978-
fn check_unnecessary_parens_core(&self, cx: &Context, value: &ast::Expr, msg: &str,
979-
struct_lit_needs_parens: bool) {
978+
fn check_unnecessary_parens_core(&self, cx: &Context, value: &ast::Expr, msg: &str) {
980979
match value.node {
981-
ast::ExprParen(ref inner) => {
982-
let necessary = struct_lit_needs_parens && contains_exterior_struct_lit(&**inner);
983-
if !necessary {
984-
cx.span_lint(UNNECESSARY_PARENS, value.span,
985-
format!("unnecessary parentheses around {}",
986-
msg).as_slice())
987-
}
980+
ast::ExprParen(_) => {
981+
cx.span_lint(UNNECESSARY_PARENS, value.span,
982+
format!("unnecessary parentheses around {}", msg).as_slice())
988983
}
989984
_ => {}
990985
}
991-
992-
/// Expressions that syntatically contain an "exterior" struct
993-
/// literal i.e. not surrounded by any parens or other
994-
/// delimiters, e.g. `X { y: 1 }`, `X { y: 1 }.method()`, `foo
995-
/// == X { y: 1 }` and `X { y: 1 } == foo` all do, but `(X {
996-
/// y: 1 }) == foo` does not.
997-
fn contains_exterior_struct_lit(value: &ast::Expr) -> bool {
998-
match value.node {
999-
ast::ExprStruct(..) => true,
1000-
1001-
ast::ExprAssign(ref lhs, ref rhs) |
1002-
ast::ExprAssignOp(_, ref lhs, ref rhs) |
1003-
ast::ExprBinary(_, ref lhs, ref rhs) => {
1004-
// X { y: 1 } + X { y: 2 }
1005-
contains_exterior_struct_lit(&**lhs) ||
1006-
contains_exterior_struct_lit(&**rhs)
1007-
}
1008-
ast::ExprUnary(_, ref x) |
1009-
ast::ExprCast(ref x, _) |
1010-
ast::ExprField(ref x, _, _) |
1011-
ast::ExprIndex(ref x, _) => {
1012-
// &X { y: 1 }, X { y: 1 }.y
1013-
contains_exterior_struct_lit(&**x)
1014-
}
1015-
1016-
ast::ExprMethodCall(_, _, ref exprs) => {
1017-
// X { y: 1 }.bar(...)
1018-
contains_exterior_struct_lit(&**exprs.get(0))
1019-
}
1020-
1021-
_ => false
1022-
}
1023-
}
1024986
}
1025987
}
1026988

@@ -1030,16 +992,16 @@ impl LintPass for UnnecessaryParens {
1030992
}
1031993

1032994
fn check_expr(&mut self, cx: &Context, e: &ast::Expr) {
1033-
let (value, msg, struct_lit_needs_parens) = match e.node {
1034-
ast::ExprIf(cond, _, _) => (cond, "`if` condition", true),
1035-
ast::ExprWhile(cond, _) => (cond, "`while` condition", true),
1036-
ast::ExprMatch(head, _) => (head, "`match` head expression", true),
1037-
ast::ExprRet(Some(value)) => (value, "`return` value", false),
1038-
ast::ExprAssign(_, value) => (value, "assigned value", false),
1039-
ast::ExprAssignOp(_, _, value) => (value, "assigned value", false),
995+
let (value, msg) = match e.node {
996+
ast::ExprIf(cond, _, _) => (cond, "`if` condition"),
997+
ast::ExprWhile(cond, _) => (cond, "`while` condition"),
998+
ast::ExprMatch(head, _) => (head, "`match` head expression"),
999+
ast::ExprRet(Some(value)) => (value, "`return` value"),
1000+
ast::ExprAssign(_, value) => (value, "assigned value"),
1001+
ast::ExprAssignOp(_, _, value) => (value, "assigned value"),
10401002
_ => return
10411003
};
1042-
self.check_unnecessary_parens_core(cx, &*value, msg, struct_lit_needs_parens);
1004+
self.check_unnecessary_parens_core(cx, &*value, msg);
10431005
}
10441006

10451007
fn check_stmt(&mut self, cx: &Context, s: &ast::Stmt) {
@@ -1053,7 +1015,7 @@ impl LintPass for UnnecessaryParens {
10531015
},
10541016
_ => return
10551017
};
1056-
self.check_unnecessary_parens_core(cx, &*value, msg, false);
1018+
self.check_unnecessary_parens_core(cx, &*value, msg);
10571019
}
10581020
}
10591021

branches/try2/src/librustc/middle/trans/expr.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,19 +277,15 @@ fn apply_adjustments<'a>(bcx: &'a Block<'a>,
277277
auto_ref(bcx, datum, expr)
278278
}
279279

280-
fn auto_borrow_obj<'a>(mut bcx: &'a Block<'a>,
280+
fn auto_borrow_obj<'a>(bcx: &'a Block<'a>,
281281
expr: &ast::Expr,
282282
source_datum: Datum<Expr>)
283283
-> DatumBlock<'a, Expr> {
284284
let tcx = bcx.tcx();
285285
let target_obj_ty = expr_ty_adjusted(bcx, expr);
286286
debug!("auto_borrow_obj(target={})", target_obj_ty.repr(tcx));
287287

288-
// Arrange cleanup, if not already done. This is needed in
289-
// case we are auto-borrowing a Box<Trait> to &Trait
290-
let datum = unpack_datum!(
291-
bcx, source_datum.to_lvalue_datum(bcx, "autoborrowobj", expr.id));
292-
let mut datum = datum.to_expr_datum();
288+
let mut datum = source_datum.to_expr_datum();
293289
datum.ty = target_obj_ty;
294290
DatumBlock::new(bcx, datum)
295291
}

branches/try2/src/libsyntax/ast.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,6 @@ pub enum Decl_ {
401401
DeclItem(Gc<Item>),
402402
}
403403

404-
/// represents one arm of a 'match'
405404
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
406405
pub struct Arm {
407406
pub attrs: Vec<Attribute>,

0 commit comments

Comments
 (0)