Skip to content

Commit b40e622

Browse files
---
yaml --- r: 156438 b: refs/heads/snap-stage3 c: cef0b55 h: refs/heads/master v: v3
1 parent 94c1b60 commit b40e622

Some content is hidden

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

58 files changed

+192
-929
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: c29a7520e7fb4a5b4d4eccfc594e05793ef6688d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: a572b74cc0ba20b700645ca967df2c89335b0d24
4+
refs/heads/snap-stage3: cef0b55c787bb8b827e0111e1c6ccc1373b663da
55
refs/heads/try: 6601b0501e31d08d3892a2d5a7d8a57ab120bf75
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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/snap-stage3/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/snap-stage3/src/libcore/ops.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ shr_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64)
626626
* struct Foo;
627627
*
628628
* impl Index<Foo, Foo> for Foo {
629-
* fn index<'a>(&'a self, _index: &Foo) -> &'a Foo {
629+
* fn index<'a>(&'a self, _rhs: &Foo) -> &'a Foo {
630630
* println!("Indexing!");
631631
* self
632632
* }
@@ -657,7 +657,7 @@ pub trait Index<Index, Result> {
657657
* struct Foo;
658658
*
659659
* impl IndexMut<Foo, Foo> for Foo {
660-
* fn index_mut<'a>(&'a mut self, _index: &Foo) -> &'a mut Foo {
660+
* fn index_mut<'a>(&'a mut self, _rhs: &Foo) -> &'a mut Foo {
661661
* println!("Indexing!");
662662
* self
663663
* }
@@ -687,20 +687,20 @@ pub trait IndexMut<Index, Result> {
687687
* ```ignore
688688
* struct Foo;
689689
*
690-
* impl Slice<Foo, Foo> for Foo {
690+
* impl ::core::ops::Slice<Foo, Foo> for Foo {
691691
* fn as_slice_<'a>(&'a self) -> &'a Foo {
692692
* println!("Slicing!");
693693
* self
694694
* }
695-
* fn slice_from_or_fail<'a>(&'a self, _from: &Foo) -> &'a Foo {
695+
* fn slice_from_or_fail<'a>(&'a self, from: &Foo) -> &'a Foo {
696696
* println!("Slicing!");
697697
* self
698698
* }
699-
* fn slice_to_or_fail<'a>(&'a self, _to: &Foo) -> &'a Foo {
699+
* fn slice_to_or_fail<'a>(&'a self, to: &Foo) -> &'a Foo {
700700
* println!("Slicing!");
701701
* self
702702
* }
703-
* fn slice_or_fail<'a>(&'a self, _from: &Foo, _to: &Foo) -> &'a Foo {
703+
* fn slice_or_fail<'a>(&'a self, from: &Foo, to: &Foo) -> &'a Foo {
704704
* println!("Slicing!");
705705
* self
706706
* }
@@ -736,20 +736,20 @@ pub trait Slice<Idx, Sized? Result> for Sized? {
736736
* ```ignore
737737
* struct Foo;
738738
*
739-
* impl SliceMut<Foo, Foo> for Foo {
739+
* impl ::core::ops::SliceMut<Foo, Foo> for Foo {
740740
* fn as_mut_slice_<'a>(&'a mut self) -> &'a mut Foo {
741741
* println!("Slicing!");
742742
* self
743743
* }
744-
* fn slice_from_or_fail_mut<'a>(&'a mut self, _from: &Foo) -> &'a mut Foo {
744+
* fn slice_from_or_fail_mut<'a>(&'a mut self, from: &Foo) -> &'a mut Foo {
745745
* println!("Slicing!");
746746
* self
747747
* }
748-
* fn slice_to_or_fail_mut<'a>(&'a mut self, _to: &Foo) -> &'a mut Foo {
748+
* fn slice_to_or_fail_mut<'a>(&'a mut self, to: &Foo) -> &'a mut Foo {
749749
* println!("Slicing!");
750750
* self
751751
* }
752-
* fn slice_or_fail_mut<'a>(&'a mut self, _from: &Foo, _to: &Foo) -> &'a mut Foo {
752+
* fn slice_or_fail_mut<'a>(&'a mut self, from: &Foo, to: &Foo) -> &'a mut Foo {
753753
* println!("Slicing!");
754754
* self
755755
* }
@@ -901,3 +901,4 @@ def_fn_mut!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12)
901901
def_fn_mut!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13)
902902
def_fn_mut!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14)
903903
def_fn_mut!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15)
904+

branches/snap-stage3/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/snap-stage3/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)