Skip to content

Commit 72d2aba

Browse files
committed
---
yaml --- r: 150341 b: refs/heads/try2 c: 080d210 h: refs/heads/master i: 150339: 4dee2ad v: v3
1 parent 7e28029 commit 72d2aba

File tree

159 files changed

+1091
-1875
lines changed

Some content is hidden

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

159 files changed

+1091
-1875
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 7e987c3490fe79ebd02ce8dc105c6e6be8a43869
8+
refs/heads/try2: 080d2104ff3b1637f919129bc40a99203a198a08
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ include config.mk
177177

178178
# Just a few macros used everywhere
179179
include $(CFG_SRC_DIR)mk/util.mk
180-
# Reconfiguring when the makefiles or submodules change
181-
include $(CFG_SRC_DIR)mk/reconfig.mk
182180
# All crates and their dependencies
183181
include $(CFG_SRC_DIR)mk/crates.mk
182+
# Reconfiguring when the makefiles or submodules change
183+
include $(CFG_SRC_DIR)mk/reconfig.mk
184184
# Various bits of setup, common macros, and top-level rules
185185
include $(CFG_SRC_DIR)mk/main.mk
186186
# C and assembly components that are not LLVM

branches/try2/mk/crates.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ COMPILER_DOC_CRATES := rustc syntax
105105
# $(1) is the crate to generate variables for
106106
define RUST_CRATE
107107
CRATEFILE_$(1) := $$(S)src/lib$(1)/lib.rs
108-
RSINPUTS_$(1) := $$(call rwildcard,$(S)src/lib$(1)/,*.rs)
108+
RSINPUTS_$(1) := $$(wildcard $$(addprefix $(S)src/lib$(1), \
109+
*.rs */*.rs */*/*.rs */*/*/*.rs))
109110
RUST_DEPS_$(1) := $$(filter-out native:%,$$(DEPS_$(1)))
110111
NATIVE_DEPS_$(1) := $$(patsubst native:%,%,$$(filter native:%,$$(DEPS_$(1))))
111112
endef
@@ -116,7 +117,8 @@ $(foreach crate,$(CRATES),$(eval $(call RUST_CRATE,$(crate))))
116117
#
117118
# $(1) is the crate to generate variables for
118119
define RUST_TOOL
119-
TOOL_INPUTS_$(1) := $$(call rwildcard,$$(dir $$(TOOL_SOURCE_$(1))),*.rs)
120+
TOOL_INPUTS_$(1) := $$(wildcard $$(addprefix $$(dir $$(TOOL_SOURCE_$(1))), \
121+
*.rs */*.rs */*/*.rs */*/*/*.rs))
120122
endef
121123

122124
$(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate))))

branches/try2/mk/rt.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ $$(LIBUV_DIR_$(1))/Release/libuv.a: $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)) \
215215
BUILDTYPE=Release \
216216
NO_LOAD="$$(LIBUV_NO_LOAD)" \
217217
V=$$(VERBOSE)
218+
$$(Q)touch $$@
218219

219220
endif
220221

branches/try2/src/compiletest/compiletest.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ pub mod common;
4343
pub mod errors;
4444

4545
#[start]
46-
fn start(argc: int, argv: **u8) -> int {
47-
green::start(argc, argv, rustuv::event_loop, main)
48-
}
46+
fn start(argc: int, argv: **u8) -> int { green::start(argc, argv, main) }
4947

5048
pub fn main() {
5149
let args = os::args();

branches/try2/src/doc/guide-lifetimes.md

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -559,14 +559,9 @@ points at a static constant).
559559

560560
# Named lifetimes
561561

562-
Lifetimes can be named and referenced. For example, the special lifetime
563-
`'static`, which does not go out of scope, can be used to create global
564-
variables and communicate between tasks (see the manual for usecases).
565-
566-
## Parameter Lifetimes
567-
568-
Named lifetimes allow for grouping of parameters by lifetime.
569-
For example, consider this function:
562+
Let's look at named lifetimes in more detail. Named lifetimes allow
563+
for grouping of parameters by lifetime. For example, consider this
564+
function:
570565

571566
~~~
572567
# struct Point {x: f64, y: f64}; // as before
@@ -660,25 +655,6 @@ fn select<'r, T>(shape: &Shape, threshold: f64,
660655

661656
This is equivalent to the previous definition.
662657

663-
## Labeled Control Structures
664-
665-
Named lifetime notation can also be used to control the flow of execution:
666-
667-
~~~
668-
'h: for i in range(0,10) {
669-
'g: loop {
670-
if i % 2 == 0 { continue 'h; }
671-
if i == 9 { break 'h; }
672-
break 'g;
673-
}
674-
}
675-
~~~
676-
677-
> ***Note:*** Labelled breaks are not currently supported within `while` loops.
678-
679-
Named labels are hygienic and can be used safely within macros.
680-
See the macros guide section on hygiene for more details.
681-
682658
# Conclusion
683659

684660
So there you have it: a (relatively) brief tour of the lifetime

branches/try2/src/doc/guide-macros.md

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -398,38 +398,6 @@ position (in particular, not as an argument to yet another macro invocation),
398398
the expander will then proceed to evaluate `m2!()` (along with any other macro
399399
invocations `m1!(m2!())` produced).
400400

401-
# Hygiene
402-
403-
To prevent clashes, rust implements
404-
[hygienic macros](http://en.wikipedia.org/wiki/Hygienic_macro).
405-
406-
As an example, `loop` and `for-loop` labels (discussed in the lifetimes guide)
407-
will not clash. The following code will print "Hello!" only once:
408-
409-
~~~
410-
#[feature(macro_rules)];
411-
412-
macro_rules! loop_x (
413-
($e: expr) => (
414-
// $e will not interact with this 'x
415-
'x: loop {
416-
println!("Hello!");
417-
$e
418-
}
419-
);
420-
)
421-
422-
fn main() {
423-
'x: loop {
424-
loop_x!(break 'x);
425-
println!("I am never printed.");
426-
}
427-
}
428-
~~~
429-
430-
The two `'x` names did not clash, which would have caused the loop
431-
to print "I am never printed" and to run forever.
432-
433401
# A final note
434402

435403
Macros, as currently implemented, are not for the faint of heart. Even

branches/try2/src/doc/guide-runtime.md

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -223,49 +223,27 @@ Having a default decision made in the compiler is done out of necessity and
223223
convenience. The compiler's decision of runtime to link to is *not* an
224224
endorsement of one over the other. As always, this decision can be overridden.
225225

226-
For example, this program will be linked to "the default runtime". The current
227-
default runtime is to use libnative.
226+
For example, this program will be linked to "the default runtime"
228227

229228
~~~{.rust}
230229
fn main() {}
231230
~~~
232231

233-
### Force booting with libgreen
234-
235-
In this example, the `main` function will be booted with I/O support powered by
236-
libuv. This is done by linking to the `rustuv` crate and specifying the
237-
`rustuv::event_loop` function as the event loop factory.
238-
239-
To create a pool of green tasks which have no I/O support, you may shed the
240-
`rustuv` dependency and use the `green::basic::event_loop` function instead of
241-
`rustuv::event_loop`. All tasks will have no I/O support, but they will still be
242-
able to deschedule/reschedule (use channels, locks, etc).
232+
Whereas this program explicitly opts into using a particular runtime
243233

244234
~~~{.rust}
245235
extern crate green;
246-
extern crate rustuv;
247236
248237
#[start]
249238
fn start(argc: int, argv: **u8) -> int {
250-
green::start(argc, argv, rustuv::event_loop, main)
239+
green::start(argc, argv, main)
251240
}
252241
253242
fn main() {}
254243
~~~
255244

256-
### Force booting with libnative
257-
258-
This program's `main` function will always be booted with libnative, running
259-
inside of an OS thread.
260-
261-
~~~{.rust}
262-
extern crate native;
263-
264-
#[start]
265-
fn start(argc: int, argv: **u8) -> int { native::start(argc, argv, main) }
266-
267-
fn main() {}
268-
~~~
245+
Both libgreen/libnative provide a top-level `start` function which is used to
246+
boot an initial Rust task in that specified runtime.
269247

270248
# Finding the runtime
271249

branches/try2/src/doc/tutorial.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2103,8 +2103,7 @@ a `&T` pointer. `MutexArc` is an example of a *sharable* type with internal muta
21032103
These are types that do not contain any data whose lifetime is bound to
21042104
a particular stack frame. These are types that do not contain any
21052105
references, or types where the only contained references
2106-
have the `'static` lifetime. (For more on named lifetimes and their uses,
2107-
see the [references and lifetimes guide][lifetimes].)
2106+
have the `'static` lifetime.
21082107
21092108
> ***Note:*** These two traits were referred to as 'kinds' in earlier
21102109
> iterations of the language, and often still are.
@@ -2430,25 +2429,23 @@ select the method to call at runtime.
24302429
24312430
This usage of traits is similar to Java interfaces.
24322431
2433-
There are some built-in bounds, such as `Send` and `Share`, which are properties
2434-
of the components of types. By design, trait objects don't know the exact type
2435-
of their contents and so the compiler cannot reason about those properties.
2432+
By default, each of the three storage classes for traits enforce a
2433+
particular set of built-in kinds that their contents must fulfill in
2434+
order to be packaged up in a trait object of that storage class.
24362435
2437-
You can instruct the compiler, however, that the contents of a trait object must
2438-
acribe to a particular bound with a trailing colon (`:`). These are examples of
2439-
valid types:
2436+
* The contents of owned traits (`~Trait`) must fulfill the `Send` bound.
2437+
* The contents of reference traits (`&Trait`) are not constrained by any bound.
24402438
2441-
~~~rust
2442-
trait Foo {}
2443-
trait Bar<T> {}
2439+
Consequently, the trait objects themselves automatically fulfill their
2440+
respective kind bounds. However, this default behavior can be overridden by
2441+
specifying a list of bounds on the trait type, for example, by writing `~Trait:`
2442+
(which indicates that the contents of the owned trait need not fulfill any
2443+
bounds), or by writing `~Trait:Send+Share`, which indicates that in addition
2444+
to fulfilling `Send`, contents must also fulfill `Share`, and as a consequence,
2445+
the trait itself fulfills `Share`.
24442446
2445-
fn sendable_foo(f: ~Foo:Send) { /* ... */ }
2446-
fn shareable_bar<T: Share>(b: &Bar<T>: Share) { /* ... */ }
2447-
~~~
2448-
2449-
When no colon is specified (such as the type `~Foo`), it is inferred that the
2450-
value ascribes to no bounds. They must be added manually if any bounds are
2451-
necessary for usage.
2447+
* `~Trait:Send` is equivalent to `~Trait`.
2448+
* `&Trait:` is equivalent to `&Trait`.
24522449
24532450
Builtin kind bounds can also be specified on closure types in the same way (for
24542451
example, by writing `fn:Send()`), and the default behaviours are the same as

branches/try2/src/libcollections/dlist.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,16 +582,16 @@ impl<A> DoubleEndedIterator<A> for MoveItems<A> {
582582
}
583583

584584
impl<A> FromIterator<A> for DList<A> {
585-
fn from_iterator<T: Iterator<A>>(iterator: T) -> DList<A> {
585+
fn from_iterator<T: Iterator<A>>(iterator: &mut T) -> DList<A> {
586586
let mut ret = DList::new();
587587
ret.extend(iterator);
588588
ret
589589
}
590590
}
591591

592592
impl<A> Extendable<A> for DList<A> {
593-
fn extend<T: Iterator<A>>(&mut self, mut iterator: T) {
594-
for elt in iterator { self.push_back(elt); }
593+
fn extend<T: Iterator<A>>(&mut self, iterator: &mut T) {
594+
for elt in *iterator { self.push_back(elt); }
595595
}
596596
}
597597

branches/try2/src/libcollections/hashmap.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ pub type Values<'a, K, V> =
13561356
iter::Map<'static, (&'a K, &'a V), &'a V, Entries<'a, K, V>>;
13571357

13581358
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> for HashMap<K, V, H> {
1359-
fn from_iterator<T: Iterator<(K, V)>>(iter: T) -> HashMap<K, V, H> {
1359+
fn from_iterator<T: Iterator<(K, V)>>(iter: &mut T) -> HashMap<K, V, H> {
13601360
let (lower, _) = iter.size_hint();
13611361
let mut map = HashMap::with_capacity_and_hasher(lower, Default::default());
13621362
map.extend(iter);
@@ -1365,8 +1365,8 @@ impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S> + Default> FromIterator<(K, V)> fo
13651365
}
13661366

13671367
impl<K: TotalEq + Hash<S>, V, S, H: Hasher<S> + Default> Extendable<(K, V)> for HashMap<K, V, H> {
1368-
fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) {
1369-
for (k, v) in iter {
1368+
fn extend<T: Iterator<(K, V)>>(&mut self, iter: &mut T) {
1369+
for (k, v) in *iter {
13701370
self.insert(k, v);
13711371
}
13721372
}
@@ -1540,7 +1540,7 @@ impl<T: TotalEq + Hash<S> + fmt::Show, S, H: Hasher<S>> fmt::Show for HashSet<T,
15401540
}
15411541

15421542
impl<T: TotalEq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSet<T, H> {
1543-
fn from_iterator<I: Iterator<T>>(iter: I) -> HashSet<T, H> {
1543+
fn from_iterator<I: Iterator<T>>(iter: &mut I) -> HashSet<T, H> {
15441544
let (lower, _) = iter.size_hint();
15451545
let mut set = HashSet::with_capacity_and_hasher(lower, Default::default());
15461546
set.extend(iter);
@@ -1549,8 +1549,8 @@ impl<T: TotalEq + Hash<S>, S, H: Hasher<S> + Default> FromIterator<T> for HashSe
15491549
}
15501550

15511551
impl<T: TotalEq + Hash<S>, S, H: Hasher<S> + Default> Extendable<T> for HashSet<T, H> {
1552-
fn extend<I: Iterator<T>>(&mut self, mut iter: I) {
1553-
for k in iter {
1552+
fn extend<I: Iterator<T>>(&mut self, iter: &mut I) {
1553+
for k in *iter {
15541554
self.insert(k);
15551555
}
15561556
}

branches/try2/src/libcollections/priority_queue.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,21 +193,22 @@ impl<'a, T> Iterator<&'a T> for Items<'a, T> {
193193
}
194194

195195
impl<T: Ord> FromIterator<T> for PriorityQueue<T> {
196-
fn from_iterator<Iter: Iterator<T>>(iter: Iter) -> PriorityQueue<T> {
196+
fn from_iterator<Iter: Iterator<T>>(iter: &mut Iter) -> PriorityQueue<T> {
197197
let mut q = PriorityQueue::new();
198198
q.extend(iter);
199+
199200
q
200201
}
201202
}
202203

203204
impl<T: Ord> Extendable<T> for PriorityQueue<T> {
204-
fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) {
205+
fn extend<Iter: Iterator<T>>(&mut self, iter: &mut Iter) {
205206
let (lower, _) = iter.size_hint();
206207

207208
let len = self.capacity();
208209
self.reserve(len + lower);
209210

210-
for elem in iter {
211+
for elem in *iter {
211212
self.push(elem);
212213
}
213214
}

branches/try2/src/libcollections/ringbuf.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ impl<A: Eq> Eq for RingBuf<A> {
386386
}
387387

388388
impl<A> FromIterator<A> for RingBuf<A> {
389-
fn from_iterator<T: Iterator<A>>(iterator: T) -> RingBuf<A> {
389+
fn from_iterator<T: Iterator<A>>(iterator: &mut T) -> RingBuf<A> {
390390
let (lower, _) = iterator.size_hint();
391391
let mut deq = RingBuf::with_capacity(lower);
392392
deq.extend(iterator);
@@ -395,8 +395,8 @@ impl<A> FromIterator<A> for RingBuf<A> {
395395
}
396396

397397
impl<A> Extendable<A> for RingBuf<A> {
398-
fn extend<T: Iterator<A>>(&mut self, mut iterator: T) {
399-
for elt in iterator {
398+
fn extend<T: Iterator<A>>(&mut self, iterator: &mut T) {
399+
for elt in *iterator {
400400
self.push_back(elt);
401401
}
402402
}

branches/try2/src/libcollections/treemap.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ fn remove<K: TotalOrd, V>(node: &mut Option<~TreeNode<K, V>>,
971971
}
972972

973973
impl<K: TotalOrd, V> FromIterator<(K, V)> for TreeMap<K, V> {
974-
fn from_iterator<T: Iterator<(K, V)>>(iter: T) -> TreeMap<K, V> {
974+
fn from_iterator<T: Iterator<(K, V)>>(iter: &mut T) -> TreeMap<K, V> {
975975
let mut map = TreeMap::new();
976976
map.extend(iter);
977977
map
@@ -980,15 +980,15 @@ impl<K: TotalOrd, V> FromIterator<(K, V)> for TreeMap<K, V> {
980980

981981
impl<K: TotalOrd, V> Extendable<(K, V)> for TreeMap<K, V> {
982982
#[inline]
983-
fn extend<T: Iterator<(K, V)>>(&mut self, mut iter: T) {
984-
for (k, v) in iter {
983+
fn extend<T: Iterator<(K, V)>>(&mut self, iter: &mut T) {
984+
for (k, v) in *iter {
985985
self.insert(k, v);
986986
}
987987
}
988988
}
989989

990990
impl<T: TotalOrd> FromIterator<T> for TreeSet<T> {
991-
fn from_iterator<Iter: Iterator<T>>(iter: Iter) -> TreeSet<T> {
991+
fn from_iterator<Iter: Iterator<T>>(iter: &mut Iter) -> TreeSet<T> {
992992
let mut set = TreeSet::new();
993993
set.extend(iter);
994994
set
@@ -997,8 +997,8 @@ impl<T: TotalOrd> FromIterator<T> for TreeSet<T> {
997997

998998
impl<T: TotalOrd> Extendable<T> for TreeSet<T> {
999999
#[inline]
1000-
fn extend<Iter: Iterator<T>>(&mut self, mut iter: Iter) {
1001-
for elem in iter {
1000+
fn extend<Iter: Iterator<T>>(&mut self, iter: &mut Iter) {
1001+
for elem in *iter {
10021002
self.insert(elem);
10031003
}
10041004
}

0 commit comments

Comments
 (0)