Skip to content

Commit b4bc65d

Browse files
committed
---
yaml --- r: 149146 b: refs/heads/try2 c: 2ca02ea h: refs/heads/master v: v3
1 parent 1a98f47 commit b4bc65d

File tree

156 files changed

+5620
-3693
lines changed

Some content is hidden

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

156 files changed

+5620
-3693
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: 314b02b373becea44ebaf194ce6c49ff408e0dba
8+
refs/heads/try2: 2ca02eae1cbd69d6dbf9fec04a043ead890a8db3
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
[submodule "src/gyp"]
1010
path = src/gyp
1111
url = https://github.com/rust-lang/gyp.git
12+
[submodule "src/compiler-rt"]
13+
path = src/compiler-rt
14+
url = https://github.com/rust-lang/compiler-rt.git

branches/try2/Makefile.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,8 @@ endif
355355
# Prerequisites for using the stageN compiler to build target artifacts
356356
TSREQ$(1)_T_$(2)_H_$(3) = \
357357
$$(HSREQ$(1)_H_$(3)) \
358-
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
358+
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a \
359+
$$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a
359360

360361
# Prerequisites for a working stageN compiler and libraries, for a specific
361362
# target

branches/try2/mk/clean.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ clean-generic-$(2)-$(1):
5454
$(1)/rt \
5555
$(1)/test \
5656
$(1)/stage* \
57+
-type f \( \
5758
-name '*.[odasS]' -o \
5859
-name '*.so' -o \
5960
-name '*.dylib' -o \
@@ -62,6 +63,7 @@ clean-generic-$(2)-$(1):
6263
-name '*.dll' -o \
6364
-name '*.def' -o \
6465
-name '*.bc' \
66+
\) \
6567
| xargs rm -f
6668
$(Q)find $(1)\
6769
-name '*.dSYM' \
@@ -96,6 +98,7 @@ clean$(1)_T_$(2)_H_$(3): \
9698
$$(foreach crate,$$(CRATES),clean$(1)_T_$(2)_H_$(3)-lib-$$(crate)) \
9799
$$(foreach tool,$$(TOOLS),clean$(1)_T_$(2)_H_$(3)-tool-$$(tool))
98100
$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
101+
$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a
99102
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass_stage* # For unix
100103
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/run_pass_stage* # For windows
101104

branches/try2/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ HOST_CRATES := syntax rustc rustdoc fourcc
5555
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5656
TOOLS := compiletest rustdoc rustc
5757

58-
DEPS_std := native:rustrt
58+
DEPS_std := native:rustrt native:compiler-rt
5959
DEPS_extra := std term sync serialize getopts collections
6060
DEPS_green := std
6161
DEPS_rustuv := std native:uv native:uv_support

branches/try2/mk/install.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ install-target-$(1)-host-$(2): \
9696
$$(call INSTALL_LIB,$$(call CFG_LIB_GLOB_$(1),$$(crate)));\
9797
$$(call INSTALL_LIB,$$(call CFG_RLIB_GLOB,$$(crate)));)
9898
$$(Q)$$(call INSTALL_LIB,libmorestack.a)
99+
$$(Q)$$(call INSTALL_LIB,libcompiler-rt.a)
99100

100101
endef
101102

@@ -110,6 +111,7 @@ install-target-$(1)-host-$(2): $$(CSREQ$$(ISTAGE)_T_$(1)_H_$(2))
110111
$$(Q)$$(foreach crate,$$(TARGET_CRATES),\
111112
$$(call INSTALL_LIB,$$(call CFG_RLIB_GLOB,$$(crate)));)
112113
$$(Q)$$(call INSTALL_LIB,libmorestack.a)
114+
$$(Q)$$(call INSTALL_LIB,libcompiler-rt.a)
113115
endef
114116

115117
$(foreach target,$(CFG_TARGET), \

branches/try2/mk/rt.mk

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,37 @@ $$(LIBUV_DIR_$(1))/Release/libuv.a: $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)) \
217217

218218
endif
219219

220+
################################################################################
221+
# compiler-rt
222+
################################################################################
223+
224+
ifdef CFG_ENABLE_FAST_MAKE
225+
COMPRT_DEPS := $(S)/.gitmodules
226+
else
227+
COMPRT_DEPS := $(wildcard \
228+
$(S)src/compiler-rt/* \
229+
$(S)src/compiler-rt/*/* \
230+
$(S)src/compiler-rt/*/*/* \
231+
$(S)src/compiler-rt/*/*/*/*)
232+
endif
233+
234+
COMPRT_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),compiler-rt)
235+
COMPRT_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(COMPRT_NAME_$(1))
236+
COMPRT_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/compiler-rt
237+
238+
$$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS)
239+
@$$(call E, make: compiler-rt)
240+
$$(Q)$$(MAKE) -C "$(S)src/compiler-rt" \
241+
ProjSrcRoot="$(S)src/compiler-rt" \
242+
ProjObjRoot="$$(abspath $$(COMPRT_BUILD_DIR_$(1)))" \
243+
CC="$$(CC_$(1))" \
244+
AR="$$(AR_$(1))" \
245+
RANLIB="$$(AR_$(1)) s" \
246+
CFLAGS="$$(CFG_GCCISH_CFLAGS_$(1))" \
247+
TargetTriple=$(1) \
248+
triple-runtime
249+
$$(Q)cp $$(COMPRT_BUILD_DIR_$(1))/triple/runtime/libcompiler_rt.a $$(COMPRT_LIB_$(1))
250+
220251
endef
221252

222253
# Instantiate template for all stages/targets

branches/try2/mk/target.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/:
138138
$$(TLIB$(1)_T_$(2)_H_$(3))/:
139139
mkdir -p $$@
140140

141+
$$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a: \
142+
$$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),compiler-rt) \
143+
| $$(TLIB$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
144+
@$$(call E, cp: $$@)
145+
$$(Q)cp $$< $$@
146+
141147
$$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a: \
142148
$$(RT_OUTPUT_DIR_$(2))/$$(call CFG_STATIC_LIB_NAME_$(2),morestack) \
143149
| $$(TLIB$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)

branches/try2/mk/tests.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ tidy:
262262
| grep '^$(S)src/gyp' -v \
263263
| grep '^$(S)src/etc' -v \
264264
| grep '^$(S)src/doc' -v \
265+
| grep '^$(S)src/compiler-rt' -v \
265266
| xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
266267

267268
endif

branches/try2/src/compiler-rt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit d4606f1818dd8dfeaa3e509cd1cbac4482c3513e

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

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,19 +181,25 @@ never call its underlying iterator again once `None` has been returned:
181181
~~~
182182
let xs = [1,2,3,4,5];
183183
let mut calls = 0;
184-
let it = xs.iter().scan((), |_, x| {
185-
calls += 1;
186-
if *x < 3 { Some(x) } else { None }});
187-
// the iterator will only yield 1 and 2 before returning None
188-
// If we were to call it 5 times, calls would end up as 5, despite only 2 values
189-
// being yielded (and therefore 3 unique calls being made). The fuse() adaptor
190-
// can fix this.
191-
let mut it = it.fuse();
192-
it.next();
193-
it.next();
194-
it.next();
195-
it.next();
196-
it.next();
184+
185+
{
186+
let it = xs.iter().scan((), |_, x| {
187+
calls += 1;
188+
if *x < 3 { Some(x) } else { None }});
189+
190+
// the iterator will only yield 1 and 2 before returning None
191+
// If we were to call it 5 times, calls would end up as 5, despite
192+
// only 2 values being yielded (and therefore 3 unique calls being
193+
// made). The fuse() adaptor can fix this.
194+
195+
let mut it = it.fuse();
196+
it.next();
197+
it.next();
198+
it.next();
199+
it.next();
200+
it.next();
201+
}
202+
197203
assert_eq!(calls, 3);
198204
~~~
199205

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Instead we can use a `SharedChan`, a type that allows a single
232232
~~~
233233
# use std::task::spawn;
234234
235-
let (port, chan) = SharedChan::new();
235+
let (port, chan) = Chan::new();
236236
237237
for init_val in range(0u, 3) {
238238
// Create a new channel handle to distribute to the child task

branches/try2/src/doc/index.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ li {list-style-type: none; }
1818
* [Tasks and Communication](guide-tasks.html)
1919
* [Foreign Function Interface](guide-ffi.html)
2020
* [Macros](guide-macros.html)
21-
* [Packaging](guide-rustpkg.html)
2221
* [Testing](guide-testing.html)
2322
* [Conditions](guide-conditions.html)
2423
* [Rust's Runtime](guide-runtime.html)
@@ -32,7 +31,6 @@ li {list-style-type: none; }
3231
* [The 1:1 runtime library, `libnative`](native/index.html)
3332

3433
* [The Rust libuv library, `librustuv`](rustuv/index.html)
35-
* [The Rust packaging library, `librustpkg`](rustpkg/index.html)
3634

3735
* [The Rust parser, `libsyntax`](syntax/index.html)
3836
* [The Rust compiler, `librustc`](rustc/index.html)

branches/try2/src/doc/tutorial.md

Lines changed: 34 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2679,25 +2679,24 @@ manual.
26792679

26802680
## Files and modules
26812681

2682-
One important aspect about Rusts module system is that source files are not important:
2683-
You define a module hierarchy, populate it with all your definitions, define visibility,
2684-
maybe put in a `fn main()`, and that's it: No need to think about source files.
2682+
One important aspect of Rust's module system is that source files and modules are not the same thing. You define a module hierarchy, populate it with all your definitions, define visibility, maybe put in a `fn main()`, and that's it.
26852683

2686-
The only file that's relevant is the one that contains the body of your crate root,
2687-
and it's only relevant because you have to pass that file to `rustc` to compile your crate.
2684+
The only file that's relevant when compiling is the one that contains the body
2685+
of your crate root, and it's only relevant because you have to pass that file
2686+
to `rustc` to compile your crate.
26882687

2689-
And in principle, that's all you need: You can write any Rust program as one giant source file that contains your
2690-
crate root and everything below it in `mod ... { ... }` declarations.
2688+
In principle, that's all you need: You can write any Rust program as one giant source file that contains your
2689+
crate root and everything else in `mod ... { ... }` declarations.
26912690

2692-
However, in practice you usually want to split you code up into multiple source files to make it more manageable.
2693-
In order to do that, Rust allows you to move the body of any module into it's own source file, which works like this:
2691+
However, in practice you usually want to split up your code into multiple
2692+
source files to make it more manageable. Rust allows you to move the body of
2693+
any module into its own source file. If you declare a module without its body,
2694+
like `mod foo;`, the compiler will look for the files `foo.rs` and `foo/mod.rs`
2695+
inside some directory (usually the same as of the source file containing the
2696+
`mod foo;` declaration). If it finds either, it uses the content of that file
2697+
as the body of the module. If it finds both, that's a compile error.
26942698

2695-
If you declare a module without its body, like `mod foo;`, the compiler will look for the
2696-
files `foo.rs` and `foo/mod.rs` inside some directory (usually the same as of the source file containing
2697-
the `mod foo;`). If it finds either, it uses the content of that file as the body of the module.
2698-
If it finds both, that's a compile error.
2699-
2700-
So, if we want to move the content of `mod farm` into it's own file, it would look like this:
2699+
To move the content of `mod farm` into its own file, you can write:
27012700

27022701
~~~~ {.ignore}
27032702
// `main.rs` - contains body of the crate root
@@ -2722,17 +2721,13 @@ pub mod barn {
27222721

27232722
In short, `mod foo;` is just syntactic sugar for `mod foo { /* content of <...>/foo.rs or <...>/foo/mod.rs */ }`.
27242723

2725-
This also means that having two or more identical `mod foo;` somewhere
2726-
in your crate hierarchy is generally a bad idea,
2727-
just like copy-and-paste-ing a module into two or more places is one.
2724+
This also means that having two or more identical `mod foo;` declarations somewhere in your crate hierarchy is generally a bad idea,
2725+
just like copy-and-paste-ing a module into multiple places is a bad idea.
27282726
Both will result in duplicate and mutually incompatible definitions.
27292727

2730-
The directory the compiler looks in for those two files is determined by starting with
2731-
the same directory as the source file that contains the `mod foo;` declaration, and concatenating to that a
2732-
path equivalent to the relative path of all nested `mod { ... }` declarations the `mod foo;`
2733-
is contained in, if any.
2734-
2735-
For example, given a file with this module body:
2728+
When `rustc` resolves these module declarations, it starts by looking in the
2729+
parent directory of the file containing the `mod foo` declaration. For example,
2730+
given a file with the module body:
27362731

27372732
~~~ {.ignore}
27382733
// `src/main.rs`
@@ -2745,7 +2740,7 @@ mod animals {
27452740
}
27462741
~~~
27472742

2748-
The compiler would then try all these files:
2743+
The compiler will look for these files, in this order:
27492744

27502745
~~~ {.notrust}
27512746
src/plants.rs
@@ -2758,9 +2753,9 @@ src/animals/mammals/humans.rs
27582753
src/animals/mammals/humans/mod.rs
27592754
~~~
27602755

2761-
Keep in mind that identical module hierachies can still lead to different path lookups
2762-
depending on how and where you've moved a module body to its own file.
2763-
For example, if we move the `animals` module above into its own file...
2756+
Keep in mind that identical module hierarchies can still lead to different path
2757+
lookups depending on how and where you've moved a module body to its own file.
2758+
For example, if you move the `animals` module into its own file:
27642759

27652760
~~~ {.ignore}
27662761
// `src/main.rs`
@@ -2776,21 +2771,21 @@ mod mammals {
27762771
}
27772772
~~~
27782773

2779-
...then the source files of `mod animals`'s submodules can
2780-
either be placed right next to that of its parents, or in a subdirectory if `animals` source file is:
2774+
...then the source files of `mod animals`'s submodules can either be in the same directory as the animals source file or in a subdirectory of its directory. If the animals file is `src/animals.rs`, `rustc` will look for:
27812775

27822776
~~~ {.notrust}
2783-
src/plants.rs
2784-
src/plants/mod.rs
2785-
2786-
src/animals.rs - if file sits next to that of parent module's:
2777+
src/animals.rs
27872778
src/fish.rs
27882779
src/fish/mod.rs
27892780
27902781
src/mammals/humans.rs
27912782
src/mammals/humans/mod.rs
2783+
~~
2784+
2785+
If the animals file is `src/animals/mod.rs`, `rustc` will look for:
27922786
2793-
src/animals/mod.rs - if file is in it's own subdirectory:
2787+
~~ {.notrust}
2788+
src/animals/mod.rs
27942789
src/animals/fish.rs
27952790
src/animals/fish/mod.rs
27962791
@@ -2799,11 +2794,11 @@ src/animals/mod.rs - if file is in it's own subdirectory:
27992794
28002795
~~~
28012796

2802-
These rules allow you to have both small modules that only need
2803-
to consist of one source file each and can be conveniently placed right next to each other,
2804-
and big complicated modules that group the source files of submodules in subdirectories.
2797+
These rules allow you to write small modules consisting of single source files which can live in the same directory as well as large modules which group submodule source files in subdirectories.
28052798

2806-
If you need to circumvent the defaults, you can also overwrite the path a `mod foo;` would take:
2799+
If you need to override where `rustc` will look for the file containing a
2800+
module's source code, use the `path` compiler directive. For example, to load a
2801+
`classified` module from a different file:
28072802

28082803
~~~ {.ignore}
28092804
#[path="../../area51/alien.rs"]

0 commit comments

Comments
 (0)