Skip to content

Commit 8647dad

Browse files
committed
---
yaml --- r: 138302 b: refs/heads/master c: 2a66814 h: refs/heads/master v: v3
1 parent c087a5c commit 8647dad

34 files changed

+165
-512
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 18062c1e96a7f62194de2a851bf3c779aa71cb7d
2+
refs/heads/master: 2a668149c26744e906018f13c33a315a1ba79bbd
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5

trunk/src/doc/guide.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ but it will still print "Hello, world!":
482482
Compiling hello_world v0.0.1 (file:///home/you/projects/hello_world)
483483
src/main.rs:2:9: 2:10 warning: unused variable: `x`, #[warn(unused_variable)] on by default
484484
src/main.rs:2 let x: int;
485-
^
485+
^
486486
```
487487

488488
Rust warns us that we never use the variable binding, but since we never use it,
@@ -1255,9 +1255,8 @@ version, if we had forgotten the `Greater` case, for example, our program would
12551255
have happily compiled. If we forget in the `match`, it will not. Rust helps us
12561256
make sure to cover all of our bases.
12571257

1258-
`match` is also an expression, which means we can use it on the right
1259-
hand side of a `let` binding or directly where an expression is
1260-
used. We could also implement the previous line like this:
1258+
`match` is also an expression, which means we can use it on the right hand side
1259+
of a `let` binding. We could also implement the previous line like this:
12611260

12621261
```{rust}
12631262
fn cmp(a: int, b: int) -> Ordering {
@@ -1270,15 +1269,18 @@ fn main() {
12701269
let x = 5i;
12711270
let y = 10i;
12721271
1273-
println!("{}", match cmp(x, y) {
1272+
let result = match cmp(x, y) {
12741273
Less => "less",
12751274
Greater => "greater",
12761275
Equal => "equal",
1277-
});
1276+
};
1277+
1278+
println!("{}", result);
12781279
}
12791280
```
12801281

1281-
Sometimes, it's a nice pattern.
1282+
In this case, it doesn't make a lot of sense, as we are just making a temporary
1283+
string where we don't need to, but sometimes, it's a nice pattern.
12821284

12831285
# Looping
12841286

@@ -4363,7 +4365,7 @@ element, `find` returns an `Option` rather than the element itself.
43634365
Another important consumer is `fold`. Here's what it looks like:
43644366

43654367
```{rust}
4366-
let sum = range(1i, 100i)
4368+
let sum = range(1i, 4i)
43674369
.fold(0i, |sum, x| sum + x);
43684370
```
43694371

@@ -4387,7 +4389,7 @@ in this iterator:
43874389
We called `fold()` with these arguments:
43884390

43894391
```{rust}
4390-
# range(1i, 5i)
4392+
# range(1i, 4i)
43914393
.fold(0i, |sum, x| sum + x);
43924394
```
43934395

trunk/src/libcore/cmp.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ pub trait PartialOrd: PartialEq {
209209
fn partial_cmp(&self, other: &Self) -> Option<Ordering>;
210210

211211
/// This method tests less than (for `self` and `other`) and is used by the `<` operator.
212-
#[inline]
213212
fn lt(&self, other: &Self) -> bool {
214213
match self.partial_cmp(other) {
215214
Some(Less) => true,

trunk/src/librustc/middle/check_static.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,13 @@ struct GlobalChecker {
5757
static_consumptions: NodeSet,
5858
const_borrows: NodeSet,
5959
static_interior_borrows: NodeSet,
60-
static_local_borrows: NodeSet,
6160
}
6261

6362
pub fn check_crate(tcx: &ty::ctxt) {
6463
let mut checker = GlobalChecker {
6564
static_consumptions: NodeSet::new(),
6665
const_borrows: NodeSet::new(),
6766
static_interior_borrows: NodeSet::new(),
68-
static_local_borrows: NodeSet::new(),
6967
};
7068
{
7169
let visitor = euv::ExprUseVisitor::new(&mut checker, tcx);
@@ -202,14 +200,6 @@ impl<'a, 'tcx, 'v> Visitor<'v> for CheckStaticVisitor<'a, 'tcx> {
202200
}
203201
}
204202

205-
// local variables in a block expression in a static context (i.e. being
206-
// assigned to a static variable) cannot be borrowed.
207-
if self.checker.static_local_borrows.remove(&e.id) {
208-
self.tcx.sess.span_err(e.span, "cannot borrow a local variable inside \
209-
a static block, define a separate static \
210-
instead");
211-
}
212-
213203
match e.node {
214204
ast::ExprAddrOf(ast::MutMutable, _) => {
215205
if self.mode != InStaticMut {
@@ -308,12 +298,8 @@ impl euv::Delegate for GlobalChecker {
308298

309299
mc::cat_downcast(..) |
310300
mc::cat_discr(..) |
311-
mc::cat_upvar(..) => unreachable!(),
312-
313-
mc::cat_local(..) => {
314-
self.static_local_borrows.insert(borrow_id);
315-
break
316-
}
301+
mc::cat_upvar(..) |
302+
mc::cat_local(..) => unreachable!(),
317303
}
318304
}
319305
}

trunk/src/librustc/middle/trans/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ fn compile_submatch_continue<'a, 'p, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
10901090
let sw = if kind == Switch {
10911091
build::Switch(bcx, test_val, else_cx.llbb, opts.len())
10921092
} else {
1093-
C_int(ccx, 0i) // Placeholder for when not using a switch
1093+
C_int(ccx, 0) // Placeholder for when not using a switch
10941094
};
10951095

10961096
let defaults = enter_default(else_cx, dm, m, col, val);

0 commit comments

Comments
 (0)