Skip to content

Commit 8f0f6d2

Browse files
committed
---
yaml --- r: 138355 b: refs/heads/auto c: a572b74 h: refs/heads/master i: 138353: e3bc732 138351: 2234a3e v: v3
1 parent d49c33c commit 8f0f6d2

Some content is hidden

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

81 files changed

+1300
-333
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 88de96178fd4d4eb214b5dce38759672ac15ec81
16+
refs/heads/auto: a572b74cc0ba20b700645ca967df2c89335b0d24
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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/auto/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/auto/src/doc/guide.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,8 +1255,9 @@ 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 hand side
1259-
of a `let` binding. We could also implement the previous line like this:
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:
12601261

12611262
```{rust}
12621263
fn cmp(a: int, b: int) -> Ordering {
@@ -1269,18 +1270,15 @@ fn main() {
12691270
let x = 5i;
12701271
let y = 10i;
12711272
1272-
let result = match cmp(x, y) {
1273+
println!("{}", match cmp(x, y) {
12731274
Less => "less",
12741275
Greater => "greater",
12751276
Equal => "equal",
1276-
};
1277-
1278-
println!("{}", result);
1277+
});
12791278
}
12801279
```
12811280

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.
1281+
Sometimes, it's a nice pattern.
12841282

12851283
# Looping
12861284

branches/auto/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/auto/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/auto/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/auto/src/librustc/middle/borrowck/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,10 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
618618
self.tcx.sess.span_end_note(s, m);
619619
}
620620

621+
pub fn span_help(&self, s: Span, m: &str) {
622+
self.tcx.sess.span_help(s, m);
623+
}
624+
621625
pub fn bckerr_to_string(&self, err: &BckError) -> String {
622626
match err.code {
623627
err_mutbl => {

branches/auto/src/librustc/middle/traits/select.rs

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,17 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
608608
* unified during the confirmation step.
609609
*/
610610

611+
let tcx = self.tcx();
612+
let kind = if Some(obligation.trait_ref.def_id) == tcx.lang_items.fn_trait() {
613+
ty::FnUnboxedClosureKind
614+
} else if Some(obligation.trait_ref.def_id) == tcx.lang_items.fn_mut_trait() {
615+
ty::FnMutUnboxedClosureKind
616+
} else if Some(obligation.trait_ref.def_id) == tcx.lang_items.fn_once_trait() {
617+
ty::FnOnceUnboxedClosureKind
618+
} else {
619+
return Ok(()); // not a fn trait, ignore
620+
};
621+
611622
let self_ty = self.infcx.shallow_resolve(obligation.self_ty());
612623
let closure_def_id = match ty::get(self_ty).sty {
613624
ty::ty_unboxed_closure(id, _) => id,
@@ -622,37 +633,17 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
622633
self_ty.repr(self.tcx()),
623634
obligation.repr(self.tcx()));
624635

625-
let tcx = self.tcx();
626-
let fn_traits = [
627-
(ty::FnUnboxedClosureKind, tcx.lang_items.fn_trait()),
628-
(ty::FnMutUnboxedClosureKind, tcx.lang_items.fn_mut_trait()),
629-
(ty::FnOnceUnboxedClosureKind, tcx.lang_items.fn_once_trait()),
630-
];
631-
for tuple in fn_traits.iter() {
632-
let kind = match tuple {
633-
&(kind, Some(ref fn_trait))
634-
if *fn_trait == obligation.trait_ref.def_id =>
635-
{
636-
kind
637-
}
638-
_ => continue,
639-
};
640-
641-
// Check to see whether the argument and return types match.
642-
let closure_kind = match self.typer.unboxed_closures().borrow().find(&closure_def_id) {
643-
Some(closure) => closure.kind,
644-
None => {
645-
self.tcx().sess.span_bug(
646-
obligation.cause.span,
647-
format!("No entry for unboxed closure: {}",
648-
closure_def_id.repr(self.tcx())).as_slice());
649-
}
650-
};
651-
652-
if closure_kind != kind {
653-
continue;
636+
let closure_kind = match self.typer.unboxed_closures().borrow().find(&closure_def_id) {
637+
Some(closure) => closure.kind,
638+
None => {
639+
self.tcx().sess.span_bug(
640+
obligation.cause.span,
641+
format!("No entry for unboxed closure: {}",
642+
closure_def_id.repr(self.tcx())).as_slice());
654643
}
644+
};
655645

646+
if closure_kind == kind {
656647
candidates.vec.push(UnboxedClosureCandidate(closure_def_id));
657648
}
658649

branches/auto/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, 0) // Placeholder for when not using a switch
1093+
C_int(ccx, 0i) // 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)