Skip to content

Commit 817d7cd

Browse files
committed
---
yaml --- r: 156615 b: refs/heads/try c: 1b71633 h: refs/heads/master i: 156613: a27d795 156611: d886645 156607: 5bdbaf3 v: v3
1 parent dc6bc56 commit 817d7cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+183
-920
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: a34b8dec697014f15e725215e17ea8d956c0ab1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: d44ea720fa9dfe062ef06d0eb49a58d4e7e92344
5-
refs/heads/try: e99dd205f8442a89dd888fd88b9a7fed85e7931a
5+
refs/heads/try: 1b7163358f9750fec725d1840d1fe23f7dd93ebc
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 6601b0501e31d08d3892a2d5a7d8a57ab120bf75

branches/try/src/doc/guide.md

Lines changed: 9 additions & 7 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

branches/try/src/libcollections/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! Collection types.
1212
//!
13-
//! See [std::collections](../std/collections) for a detailed discussion of collections in Rust.
13+
//! See [../std/collections](std::collections) for a detailed discussion of collections in Rust.
1414
1515

1616
#![crate_name = "collections"]

branches/try/src/libcore/cmp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ 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]
212213
fn lt(&self, other: &Self) -> bool {
213214
match self.partial_cmp(other) {
214215
Some(Less) => true,

branches/try/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
}

branches/try/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)