Skip to content

Commit 16ae7b9

Browse files
committed
---
yaml --- r: 156431 b: refs/heads/snap-stage3 c: d8cf023 h: refs/heads/master i: 156429: 9fbac1e 156427: 5be6165 156423: 28bd3ac 156415: bc185d2 v: v3
1 parent 2ad2896 commit 16ae7b9

File tree

97 files changed

+1903
-638
lines changed

Some content is hidden

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

97 files changed

+1903
-638
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: 0e68c63f3f148309bcc5c5f1358af49db393c619
4+
refs/heads/snap-stage3: d8cf0239713aa5683dc80872c4ea1962599e75e7
55
refs/heads/try: 6601b0501e31d08d3892a2d5a7d8a57ab120bf75
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/install.mk

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,34 @@ else
1414
MAYBE_DISABLE_VERIFY=
1515
endif
1616

17-
install: dist-install-dir-$(CFG_BUILD) | tmp/empty_dir
17+
install:
18+
ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
19+
# Build the dist as the original user
20+
$(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_install
21+
else
22+
$(Q)$(MAKE) prepare_install
23+
endif
1824
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
19-
# Remove tmp files while we can because they may have been created under sudo
25+
# Remove tmp files because it's a decent amount of disk space
2026
$(Q)rm -R tmp/dist
2127

22-
uninstall: dist-install-dir-$(CFG_BUILD) | tmp/empty_dir
28+
prepare_install: dist-install-dir-$(CFG_BUILD) | tmp/empty_dir
29+
30+
uninstall:
31+
ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER)))
32+
# Build the dist as the original user
33+
$(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_uninstall
34+
else
35+
$(Q)$(MAKE) prepare_uninstall
36+
endif
2337
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
24-
# Remove tmp files while we can because they may have been created under sudo
38+
# Remove tmp files because it's a decent amount of disk space
2539
$(Q)rm -R tmp/dist
2640

41+
prepare_uninstall: dist-install-dir-$(CFG_BUILD) | tmp/empty_dir
42+
43+
.PHONY: install prepare_install uninstall prepare_uninstall
44+
2745
tmp/empty_dir:
2846
mkdir -p $@
2947

branches/snap-stage3/src/doc/guide-tasks.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ concurrency: particularly, ownership. The language leaves the implementation
4141
details to the standard library.
4242

4343
The `spawn` function has a very simple type signature: `fn spawn(f: proc():
44-
Send)`. Because it accepts only procs, and procs contain only owned data,
44+
Send)`. Because it accepts only procs, and procs contain only owned data,
4545
`spawn` can safely move the entire proc and all its associated state into an
4646
entirely different task for execution. Like any closure, the function passed to
4747
`spawn` may capture an environment that it carries across tasks.
@@ -213,7 +213,7 @@ println!("fib(50) = {}", delayed_fib.get())
213213
# }
214214
```
215215

216-
The call to `future::spawn` returns immediately a `future` object regardless of
216+
The call to `future::spawn` immediately returns a `future` object regardless of
217217
how long it takes to run `fib(50)`. You can then make yourself a sandwich while
218218
the computation of `fib` is running. The result of the execution of the method
219219
is obtained by calling `get` on the future. This call will block until the
@@ -297,7 +297,7 @@ let numbers_arc = Arc::new(numbers);
297297
```
298298

299299
and a clone is captured for each task via a procedure. This only copies
300-
the wrapper and not it's contents. Within the task's procedure, the captured
300+
the wrapper and not its contents. Within the task's procedure, the captured
301301
Arc reference can be used as a shared reference to the underlying vector as
302302
if it were local.
303303

@@ -323,20 +323,20 @@ Rust has a built-in mechanism for raising exceptions. The `fail!()` macro
323323
(which can also be written with an error string as an argument: `fail!(
324324
~reason)`) and the `assert!` construct (which effectively calls `fail!()` if a
325325
boolean expression is false) are both ways to raise exceptions. When a task
326-
raises an exception the task unwinds its stack---running destructors and
327-
freeing memory along the way---and then exits. Unlike exceptions in C++,
326+
raises an exception, the task unwinds its stackrunning destructors and
327+
freeing memory along the wayand then exits. Unlike exceptions in C++,
328328
exceptions in Rust are unrecoverable within a single task: once a task fails,
329329
there is no way to "catch" the exception.
330330

331331
While it isn't possible for a task to recover from failure, tasks may notify
332332
each other of failure. The simplest way of handling task failure is with the
333-
`try` function, which is similar to `spawn`, but immediately blocks waiting for
334-
the child task to finish. `try` returns a value of type `Result<T, Box<Any +
335-
Send>>`. `Result` is an `enum` type with two variants: `Ok` and `Err`. In this
336-
case, because the type arguments to `Result` are `int` and `()`, callers can
337-
pattern-match on a result to check whether it's an `Ok` result with an `int`
338-
field (representing a successful result) or an `Err` result (representing
339-
termination with an error).
333+
`try` function, which is similar to `spawn`, but immediately blocks and waits
334+
for the child task to finish. `try` returns a value of type
335+
`Result<T, Box<Any + Send>>`. `Result` is an `enum` type with two variants:
336+
`Ok` and `Err`. In this case, because the type arguments to `Result` are `int`
337+
and `()`, callers can pattern-match on a result to check whether it's an `Ok`
338+
result with an `int` field (representing a successful result) or an `Err` result
339+
(representing termination with an error).
340340

341341
```{rust}
342342
# use std::task;
@@ -369,4 +369,4 @@ the entire program (perhaps you're writing an assert which, if it trips,
369369
indicates an unrecoverable logic error); in other cases you might want to
370370
contain the failure at a certain boundary (perhaps a small piece of input from
371371
the outside world, which you happen to be processing in parallel, is malformed
372-
and its processing task can't proceed).
372+
such that the processing task cannot proceed).

branches/snap-stage3/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ following forms:
341341
escaped in order to denote its ASCII encoding `0x5C`.
342342

343343
Raw byte string literals do not process any escapes. They start with the
344-
character `U+0072` (`r`), followed by `U+0062` (`b`), followed by zero or more
344+
character `U+0062` (`b`), followed by `U+0072` (`r`), followed by zero or more
345345
of the character `U+0023` (`#`), and a `U+0022` (double-quote) character. The
346346
_raw string body_ is not defined in the EBNF grammar above: it can contain any
347347
sequence of ASCII characters and is terminated only by another `U+0022`

branches/snap-stage3/src/libcollections/bitv.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@
5959
//! println!("There are {} primes below {}", num_primes, max_prime);
6060
//! ```
6161
62-
#![allow(missing_doc)]
63-
6462
use core::prelude::*;
6563

6664
use core::cmp;
@@ -1640,7 +1638,6 @@ mod tests {
16401638
use std::prelude::*;
16411639
use std::iter::range_step;
16421640
use std::u32;
1643-
use std::uint;
16441641
use std::rand;
16451642
use std::rand::Rng;
16461643
use test::Bencher;

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: 10 additions & 11 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, _rhs: &Foo) -> &'a Foo {
629+
* fn index<'a>(&'a self, _index: &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, _rhs: &Foo) -> &'a mut Foo {
660+
* fn index_mut<'a>(&'a mut self, _index: &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 ::core::ops::Slice<Foo, Foo> for Foo {
690+
* impl 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 ::core::ops::SliceMut<Foo, Foo> for Foo {
739+
* impl 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,4 +901,3 @@ 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/driver/session.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,18 @@ impl Session {
9696
pub fn span_end_note(&self, sp: Span, msg: &str) {
9797
self.diagnostic().span_end_note(sp, msg)
9898
}
99+
pub fn span_help(&self, sp: Span, msg: &str) {
100+
self.diagnostic().span_help(sp, msg)
101+
}
99102
pub fn fileline_note(&self, sp: Span, msg: &str) {
100103
self.diagnostic().fileline_note(sp, msg)
101104
}
102105
pub fn note(&self, msg: &str) {
103106
self.diagnostic().handler().note(msg)
104107
}
108+
pub fn help(&self, msg: &str) {
109+
self.diagnostic().handler().note(msg)
110+
}
105111
pub fn span_bug(&self, sp: Span, msg: &str) -> ! {
106112
self.diagnostic().span_bug(sp, msg)
107113
}

branches/snap-stage3/src/librustc/metadata/tydecode.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ fn parse_bound_region(st: &mut PState, conv: conv_did) -> ty::BoundRegion {
277277
assert_eq!(next(st), '|');
278278
ty::BrFresh(id)
279279
}
280+
'e' => ty::BrEnv,
280281
_ => fail!("parse_bound_region: bad input")
281282
}
282283
}

branches/snap-stage3/src/librustc/metadata/tyencode.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ fn enc_bound_region(w: &mut SeekableMemWriter, cx: &ctxt, br: ty::BoundRegion) {
175175
ty::BrFresh(id) => {
176176
mywrite!(w, "f{}|", id);
177177
}
178+
ty::BrEnv => {
179+
mywrite!(w, "e|");
180+
}
178181
}
179182
}
180183

branches/snap-stage3/src/librustc/middle/astencode.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,8 @@ impl tr for ty::BoundRegion {
516516
fn tr(&self, dcx: &DecodeContext) -> ty::BoundRegion {
517517
match *self {
518518
ty::BrAnon(_) |
519-
ty::BrFresh(_) => *self,
519+
ty::BrFresh(_) |
520+
ty::BrEnv => *self,
520521
ty::BrNamed(id, ident) => ty::BrNamed(dcx.tr_def_id(id),
521522
ident),
522523
}

branches/snap-stage3/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -775,21 +775,32 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
775775
}
776776

777777
// Otherwise, just a plain error.
778-
match opt_loan_path(&assignee_cmt) {
779-
Some(lp) => {
780-
self.bccx.span_err(
781-
assignment_span,
782-
format!("cannot assign to {} {} `{}`",
783-
assignee_cmt.mutbl.to_user_str(),
784-
self.bccx.cmt_to_string(&*assignee_cmt),
785-
self.bccx.loan_path_to_string(&*lp)).as_slice());
786-
}
787-
None => {
778+
match assignee_cmt.note {
779+
mc::NoteClosureEnv(upvar_id) => {
788780
self.bccx.span_err(
789781
assignment_span,
790-
format!("cannot assign to {} {}",
791-
assignee_cmt.mutbl.to_user_str(),
782+
format!("cannot assign to {}",
792783
self.bccx.cmt_to_string(&*assignee_cmt)).as_slice());
784+
self.bccx.span_note(
785+
self.tcx().map.span(upvar_id.closure_expr_id),
786+
"consider changing this closure to take self by mutable reference");
787+
}
788+
_ => match opt_loan_path(&assignee_cmt) {
789+
Some(lp) => {
790+
self.bccx.span_err(
791+
assignment_span,
792+
format!("cannot assign to {} {} `{}`",
793+
assignee_cmt.mutbl.to_user_str(),
794+
self.bccx.cmt_to_string(&*assignee_cmt),
795+
self.bccx.loan_path_to_string(&*lp)).as_slice());
796+
}
797+
None => {
798+
self.bccx.span_err(
799+
assignment_span,
800+
format!("cannot assign to {} {}",
801+
assignee_cmt.mutbl.to_user_str(),
802+
self.bccx.cmt_to_string(&*assignee_cmt)).as_slice());
803+
}
793804
}
794805
}
795806
return;
@@ -805,16 +816,12 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
805816
loop {
806817
debug!("mark_variable_as_used_mut(cmt={})", cmt.repr(this.tcx()));
807818
match cmt.cat.clone() {
808-
mc::cat_copied_upvar(mc::CopiedUpvar { upvar_id: id, .. }) |
819+
mc::cat_upvar(mc::Upvar { id: ty::UpvarId { var_id: id, .. }, .. }) |
809820
mc::cat_local(id) => {
810821
this.tcx().used_mut_nodes.borrow_mut().insert(id);
811822
return;
812823
}
813824

814-
mc::cat_upvar(..) => {
815-
return;
816-
}
817-
818825
mc::cat_rvalue(..) |
819826
mc::cat_static_item |
820827
mc::cat_deref(_, _, mc::UnsafePtr(..)) |
@@ -854,12 +861,6 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
854861
check_for_aliasability_violation(this, span, b.clone());
855862
}
856863

857-
mc::cat_copied_upvar(mc::CopiedUpvar {
858-
kind: mc::Unboxed(ty::FnUnboxedClosureKind), ..}) => {
859-
// Prohibit writes to capture-by-move upvars in non-once closures
860-
check_for_aliasability_violation(this, span, guarantor.clone());
861-
}
862-
863864
_ => {}
864865
}
865866

branches/snap-stage3/src/librustc/middle/borrowck/gather_loans/gather_moves.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,19 +133,13 @@ fn check_and_get_illegal_move_origin(bccx: &BorrowckCtxt,
133133
mc::cat_deref(_, _, mc::BorrowedPtr(..)) |
134134
mc::cat_deref(_, _, mc::Implicit(..)) |
135135
mc::cat_deref(_, _, mc::UnsafePtr(..)) |
136-
mc::cat_upvar(..) | mc::cat_static_item => {
136+
mc::cat_static_item => {
137137
Some(cmt.clone())
138138
}
139139

140-
mc::cat_copied_upvar(mc::CopiedUpvar { kind: kind, .. }) => {
141-
match kind.onceness() {
142-
ast::Once => None,
143-
ast::Many => Some(cmt.clone())
144-
}
145-
}
146-
147140
mc::cat_rvalue(..) |
148-
mc::cat_local(..) => {
141+
mc::cat_local(..) |
142+
mc::cat_upvar(..) => {
149143
None
150144
}
151145

branches/snap-stage3/src/librustc/middle/borrowck/gather_loans/lifetime.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
6767

6868
match cmt.cat {
6969
mc::cat_rvalue(..) |
70-
mc::cat_copied_upvar(..) | // L-Local
7170
mc::cat_local(..) | // L-Local
7271
mc::cat_upvar(..) |
7372
mc::cat_deref(_, _, mc::BorrowedPtr(..)) | // L-Deref-Borrowed
@@ -165,8 +164,7 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
165164
mc::cat_rvalue(temp_scope) => {
166165
temp_scope
167166
}
168-
mc::cat_upvar(..) |
169-
mc::cat_copied_upvar(_) => {
167+
mc::cat_upvar(..) => {
170168
ty::ReScope(self.item_scope_id)
171169
}
172170
mc::cat_static_item => {

branches/snap-stage3/src/librustc/middle/borrowck/gather_loans/move_error.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,7 @@ fn report_cannot_move_out_of(bccx: &BorrowckCtxt, move_from: mc::cmt) {
115115
mc::cat_deref(_, _, mc::BorrowedPtr(..)) |
116116
mc::cat_deref(_, _, mc::Implicit(..)) |
117117
mc::cat_deref(_, _, mc::UnsafePtr(..)) |
118-
mc::cat_upvar(..) | mc::cat_static_item => {
119-
bccx.span_err(
120-
move_from.span,
121-
format!("cannot move out of {}",
122-
bccx.cmt_to_string(&*move_from)).as_slice());
123-
}
124-
125-
mc::cat_copied_upvar(mc::CopiedUpvar { kind: kind, .. })
126-
if kind.onceness() == ast::Many => {
118+
mc::cat_static_item => {
127119
bccx.span_err(
128120
move_from.span,
129121
format!("cannot move out of {}",

0 commit comments

Comments
 (0)