Skip to content

Commit b565501

Browse files
committed
auto merge of #21213 : alexcrichton/rust/rollup, r=alexcrichton
2 parents 8903c21 + 42198c1 commit b565501

File tree

114 files changed

+1520
-878
lines changed

Some content is hidden

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

114 files changed

+1520
-878
lines changed

AUTHORS.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ Robert Knight <[email protected]>
581581
Robert Millar <[email protected]>
582582
Robin Gloster <[email protected]>
583583
Robin Stocker <[email protected]>
584-
Rohit Joshi <rohit.joshi@capitalone.com>
584+
Rohit Joshi <rohit.c.joshi@gmail.com>
585585
Roland Tanglao <[email protected]>
586586
Rolf Timmermans <[email protected]>
587587
Rolf van de Krol <[email protected]>

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ please do two things:
2727

2828
Pull requests will be treated as "review requests", and we will give
2929
feedback we expect to see corrected on
30-
[style](https://github.com/rust-lang/rust/wiki/Note-style-guide) and
30+
[style](http://aturon.github.io/) and
3131
substance before pulling. Changes contributed via pull request should
3232
focus on a single issue at a time, like any other. We will not accept
3333
pull-requests that try to "sneak" unrelated changes in.

Makefile.in

+2-3
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@
9797
# make check-stage1-std RUST_TEST_TASKS=1
9898
#
9999
# This is hardly all there is to know of The Rust Build System's
100-
# mysteries. The tale continues on the wiki[1][2].
100+
# mysteries. The tale continues on the wiki[1].
101101
#
102-
# [1]: https://github.com/rust-lang/rust/wiki/Note-getting-started-developing-Rust
103-
# [2]: https://github.com/rust-lang/rust/wiki/Note-testsuite
102+
# [1]: https://github.com/rust-lang/rust/wiki/Note-testsuite
104103
#
105104
# If you really feel like getting your hands dirty, then:
106105
#

README.md

+11-4
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,23 @@ documentation.
5858

5959
### Building on Windows
6060

61-
To easily build on windows we can use [MSYS2](http://sourceforge.net/projects/msys2/):
61+
To easily build on windows we can use [MSYS2](http://msys2.github.io/):
6262

6363
1. Grab the latest MSYS2 installer and go through the installer.
6464
2. Now from the MSYS2 terminal we want to install the mingw64 toolchain and the other
6565
tools we need.
6666

67-
$ pacman -S mingw-w64-i686-toolchain
68-
$ pacman -S base-devel
67+
```bash
68+
# choose one based on platform
69+
$ pacman -S mingw-w64-i686-toolchain
70+
$ pacman -S mingw-w64-x86_64-toolchain
6971

70-
3. With that now start `mingw32_shell.bat` from where you installed MSYS2 (i.e. `C:\msys`).
72+
$ pacman -S base-devel
73+
```
74+
75+
3. With that now start `mingw32_shell.bat` or `mingw64_shell.bat`
76+
from where you installed MSYS2 (i.e. `C:\msys`). Which one you
77+
choose depends on if you want 32 or 64 bit Rust.
7178
4. From there just navigate to where you have Rust's source code, configure and build it:
7279

7380
$ ./configure

mk/cfg/aarch64-apple-ios.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ AR_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
1111
endif
1212
CFG_LIB_NAME_aarch64-apple-ios = lib$(1).a
1313
CFG_LIB_GLOB_aarch64-apple-ios = lib$(1)-*.a
14-
CFG_LIB_SKIP_INSTALL_aarch64-apple-ios = 1 #lib$(1)-*.a
14+
CFG_INSTALL_ONLY_RLIB_aarch64-apple-ios = 1
1515
CFG_STATIC_LIB_NAME_aarch64-apple-ios=lib$(1).a
1616
CFG_LIB_DSYM_GLOB_aarch64-apple-ios = lib$(1)-*.a.dSYM
1717
CFG_CFLAGS_aarch64-apple-ios := $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios)

mk/cfg/armv7-apple-ios.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ AR_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
1111
endif
1212
CFG_LIB_NAME_armv7-apple-ios = lib$(1).a
1313
CFG_LIB_GLOB_armv7-apple-ios = lib$(1)-*.a
14-
CFG_LIB_SKIP_INSTALL_armv7-apple-ios = 1 #lib$(1)-*.a
14+
CFG_INSTALL_ONLY_RLIB_armv7-apple-ios = 1
1515
CFG_STATIC_LIB_NAME_armv7-apple-ios=lib$(1).a
1616
CFG_LIB_DSYM_GLOB_armv7-apple-ios = lib$(1)-*.a.dSYM
1717
CFG_JEMALLOC_CFLAGS_armv7-apple-ios := -arch armv7 -mfpu=vfp3 $(CFG_IOS_SDK_FLAGS_armv7-apple-ios)

mk/cfg/armv7s-apple-ios.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ AR_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
1111
endif
1212
CFG_LIB_NAME_armv7s-apple-ios = lib$(1).a
1313
CFG_LIB_GLOB_armv7s-apple-ios = lib$(1)-*.a
14-
CFG_LIB_SKIP_INSTALL_armv7s-apple-ios = 1 #lib$(1)-*.a
14+
CFG_INSTALL_ONLY_RLIB_armv7s-apple-ios = 1
1515
CFG_STATIC_LIB_NAME_armv7s-apple-ios=lib$(1).a
1616
CFG_LIB_DSYM_GLOB_armv7s-apple-ios = lib$(1)-*.a.dSYM
1717
CFG_JEMALLOC_CFLAGS_armv7s-apple-ios := -arch armv7s -mfpu=vfp4 $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios)

mk/cfg/i386-apple-ios.mk

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ AR_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator ar)
1111
endif
1212
CFG_LIB_NAME_i386-apple-ios = lib$(1).a
1313
CFG_LIB_GLOB_i386-apple-ios = lib$(1)-*.dylib
14+
CFG_INSTALL_ONLY_RLIB_i386-apple-ios = 1
1415
CFG_STATIC_LIB_NAME_i386-apple-ios=lib$(1).a
1516
CFG_LIB_DSYM_GLOB_i386-apple-ios = lib$(1)-*.dylib.dSYM
1617
CFG_GCCISH_CFLAGS_i386-apple-ios := -Wall -Werror -g -fPIC -m32 $(CFG_IOSSIM_FLAGS_i386-apple-ios)

mk/cfg/x86_64-apple-ios.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ AR_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator ar)
1111
endif
1212
CFG_LIB_NAME_x86_64-apple-ios = lib$(1).a
1313
CFG_LIB_GLOB_x86_64-apple-ios = lib$(1)-*.a
14-
CFG_LIB_SKIP_INSTALL_x86_64-apple-ios = 1 #lib$(1)-*.a
14+
CFG_INSTALL_ONLY_RLIB_x86_64-apple-ios = 1
1515
CFG_STATIC_LIB_NAME_x86_64-apple-ios=lib$(1).a
1616
CFG_LIB_DSYM_GLOB_x86_64-apple-ios = lib$(1)-*.a.dSYM
1717
CFG_CFLAGS_x86_64-apple-ios := $(CFG_IOSSIM_FLAGS_x86_64-apple-ios)

mk/main.mk

+3-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CFG_RELEASE_NUM=1.0.0
1818
# An optional number to put after the label, e.g. '.2' -> '-beta.2'
1919
# NB Make sure it starts with a dot to conform to semver pre-release
2020
# versions (section 9)
21-
CFG_PRERELEASE_VERSION=
21+
CFG_PRERELEASE_VERSION=.1
2222

2323
CFG_FILENAME_EXTRA=4e7c5e5c
2424

@@ -30,9 +30,8 @@ CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)
3030
CFG_DISABLE_UNSTABLE_FEATURES=1
3131
endif
3232
ifeq ($(CFG_RELEASE_CHANNEL),beta)
33-
# The beta channel is temporarily called 'alpha'
34-
CFG_RELEASE=$(CFG_RELEASE_NUM)-alpha$(CFG_PRERELEASE_VERSION)
35-
CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-alpha$(CFG_PRERELEASE_VERSION)
33+
CFG_RELEASE=$(CFG_RELEASE_NUM)-beta(CFG_PRERELEASE_VERSION)
34+
CFG_PACKAGE_VERS=$(CFG_RELEASE_NUM)-beta(CFG_PRERELEASE_VERSION)
3635
CFG_DISABLE_UNSTABLE_FEATURES=1
3736
endif
3837
ifeq ($(CFG_RELEASE_CHANNEL),nightly)

mk/prepare.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \
134134
$$(if $$(findstring $(3), $$(PREPARE_HOST)), \
135135
$$(call PREPARE_DIR,$$(PREPARE_WORKING_DEST_LIB_DIR)) \
136136
$$(foreach crate,$$(TARGET_CRATES), \
137-
$$(if $$(findstring 1, $$(ONLY_RLIB_$$(crate))),, \
137+
$$(if $$(or $$(findstring 1, $$(ONLY_RLIB_$$(crate))),$$(findstring 1,$$(CFG_INSTALL_ONLY_RLIB_$(2)))),, \
138138
$$(call PREPARE_LIB,$$(call CFG_LIB_GLOB_$(2),$$(crate)))) \
139139
$$(call PREPARE_LIB,$$(call CFG_RLIB_GLOB,$$(crate)))) \
140140
$$(if $$(findstring $(2),$$(CFG_HOST)), \

src/doc/complement-lang-faq.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ There aren't many large programs yet. The Rust [compiler][rustc], 60,000+ lines
1010

1111
A research browser engine called [Servo][servo], currently 30,000+ lines across more than a dozen crates, will be exercising a lot of Rust's distinctive type-system and concurrency features, and integrating many native libraries.
1212

13-
[servo]: https://github.com/mozilla/servo
13+
[servo]: https://github.com/servo/servo
1414

1515
Some examples that demonstrate different aspects of the language:
1616

src/doc/complement-project-faq.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ No. It started as a Graydon Hoare's part-time side project in 2006 and remained
3030

3131
# What will Mozilla use Rust for?
3232

33-
Mozilla intends to use Rust as a platform for prototyping experimental browser architectures. Specifically, the hope is to develop a browser that is more amenable to parallelization than existing ones, while also being less prone to common C++ coding errors that result in security exploits. The name of that project is _[Servo](http://github.com/mozilla/servo)_.
33+
Mozilla intends to use Rust as a platform for prototyping experimental browser architectures. Specifically, the hope is to develop a browser that is more amenable to parallelization than existing ones, while also being less prone to common C++ coding errors that result in security exploits. The name of that project is _[Servo](http://github.com/servo/servo)_.
3434

3535
# Why a BSD-style permissive license rather than MPL or tri-license?
3636

src/doc/intro.md

+32-31
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ accomplishes these goals by being memory safe without using garbage collection.
55

66
This introduction will give you a rough idea of what Rust is like, eliding many
77
details. It does not require prior experience with systems programming, but you
8-
may find the syntax easier if you've used a 'curly brace' programming language
8+
may find the syntax easier if you've used a "curly brace" programming language
99
before, like C or JavaScript. The concepts are more important than the syntax,
1010
so don't worry if you don't get every last detail: you can read [The
1111
Rust Programming Language](book/index.html) to get a more complete explanation.
@@ -15,7 +15,7 @@ Rust to follow along. If you'd like to anyway, check out [the
1515
homepage](http://rust-lang.org) for explanation.
1616

1717
To show off Rust, let's talk about how easy it is to get started with Rust.
18-
Then, we'll talk about Rust's most interesting feature, **ownership**, and
18+
Then, we'll talk about Rust's most interesting feature, *ownership*, and
1919
then discuss how it makes concurrency easier to reason about. Finally,
2020
we'll talk about how Rust breaks down the perceived dichotomy between speed
2121
and safety.
@@ -57,7 +57,7 @@ version = "0.0.1"
5757
authors = ["Your Name <[email protected]>"]
5858
```
5959

60-
This is called a **manifest**, and it contains all of the metadata that Cargo
60+
This is called a *manifest*, and it contains all of the metadata that Cargo
6161
needs to compile your project.
6262

6363
Here's what's in `src/main.rs`:
@@ -68,7 +68,7 @@ fn main() {
6868
}
6969
```
7070

71-
Cargo generated a 'hello world' for us. We'll talk more about the syntax here
71+
Cargo generated a "Hello World" for us. We'll talk more about the syntax here
7272
later, but that's what Rust code looks like! Let's compile and run it:
7373

7474
```{bash}
@@ -146,8 +146,8 @@ Enough about tools, let's talk code!
146146

147147
# Ownership
148148

149-
Rust's defining feature is 'memory safety without garbage collection.' Let's
150-
take a moment to talk about what that means. **Memory safety** means that the
149+
Rust's defining feature is "memory safety without garbage collection". Let's
150+
take a moment to talk about what that means. *Memory safety* means that the
151151
programming language eliminates certain kinds of bugs, such as [buffer
152152
overflows](http://en.wikipedia.org/wiki/Buffer_overflow) and [dangling
153153
pointers](http://en.wikipedia.org/wiki/Dangling_pointer). These problems occur
@@ -170,7 +170,7 @@ We make an array, `v`, and then call `push` on it. `push` is a method which
170170
adds an element to the end of an array.
171171

172172
Next, we make a new variable, `x`, that's equal to the first element of
173-
the array. Simple, but this is where the 'bug' will appear.
173+
the array. Simple, but this is where the "bug" will appear.
174174

175175
Let's keep going. We then call `push` again, pushing "world" onto the
176176
end of the array. `v` now is `["Hello", "world"]`.
@@ -222,7 +222,7 @@ its length changes, we may need to allocate more memory. In Ruby, this happens
222222
as well, we just don't think about it very often. So why does the C++ version
223223
segfault when we allocate more memory?
224224

225-
The answer is that in the C++ version, `x` is a **reference** to the memory
225+
The answer is that in the C++ version, `x` is a *reference* to the memory
226226
location where the first element of the array is stored. But in Ruby, `x` is a
227227
standalone value, not connected to the underyling array at all. Let's dig into
228228
the details for a moment. Your program has access to memory, provided to it by
@@ -332,11 +332,11 @@ error: aborting due to previous error
332332
333333
When we try to mutate the array by `push`ing it the second time, Rust throws
334334
an error. It says that we "cannot borrow v as mutable because it is also
335-
borrowed as immutable." What's up with "borrowed"?
335+
borrowed as immutable." What does it mean by "borrowed"?
336336
337-
In Rust, the type system encodes the notion of **ownership**. The variable `v`
338-
is an "owner" of the vector. When we make a reference to `v`, we let that
339-
variable (in this case, `x`) 'borrow' it for a while. Just like if you own a
337+
In Rust, the type system encodes the notion of *ownership*. The variable `v`
338+
is an *owner* of the vector. When we make a reference to `v`, we let that
339+
variable (in this case, `x`) *borrow* it for a while. Just like if you own a
340340
book, and you lend it to me, I'm borrowing the book.
341341
342342
So, when I try to modify the vector with the second call to `push`, I need
@@ -392,22 +392,23 @@ Here's an example of a concurrent Rust program:
392392
use std::thread::Thread;
393393
394394
fn main() {
395-
for _ in range(0u, 10u) {
396-
Thread::spawn(move || {
395+
let guards: Vec<_> = (0..10).map(|_| {
396+
Thread::scoped(|| {
397397
println!("Hello, world!");
398-
});
399-
}
398+
})
399+
}).collect();
400400
}
401401
```
402402
403-
This program creates ten threads, who all print `Hello, world!`. The
404-
`spawn` function takes one argument, a closure, indicated by the
405-
double bars `||`. (The `move` keyword indicates that the closure takes
406-
ownership of any data it uses; we'll have more on the significance of
407-
this shortly.) This closure is executed in a new thread created by
408-
`spawn`.
403+
This program creates ten threads, which all print `Hello, world!`. The `scoped`
404+
function takes one argument, a closure, indicated by the double bars `||`. This
405+
closure is executed in a new thread created by `scoped`. The method is called
406+
`scoped` because it returns a 'join guard', which will automatically join the
407+
child thread when it goes out of scope. Because we `collect` these guards into
408+
a `Vec<T>`, and that vector goes out of scope at the end of our program, our
409+
program will wait for every thread to finish before finishing.
409410
410-
One common form of problem in concurrent programs is a 'data race.'
411+
One common form of problem in concurrent programs is a *data race*.
411412
This occurs when two different threads attempt to access the same
412413
location in memory in a non-synchronized way, where at least one of
413414
them is a write. If one thread is attempting to read, and one thread
@@ -460,9 +461,9 @@ code tries to make three owners. This may cause a safety problem, so
460461
Rust disallows it.
461462
462463
What to do here? Rust has two types that helps us: `Arc<T>` and `Mutex<T>`.
463-
"Arc" stands for "atomically reference counted." In other words, an Arc will
464+
*Arc* stands for "atomically reference counted". In other words, an Arc will
464465
keep track of the number of references to something, and not free the
465-
associated resource until the count is zero. The 'atomic' portion refers to an
466+
associated resource until the count is zero. The *atomic* portion refers to an
466467
Arc's usage of concurrency primitives to atomically update the count, making it
467468
safe across threads. If we use an Arc, we can have our three references. But,
468469
an Arc does not allow mutable borrows of the data it holds, and we want to
@@ -525,13 +526,13 @@ give us assurance _at compile time_ that we weren't doing something incorrect
525526
with regards to concurrency. In order to share ownership, we were forced to be
526527
explicit and use a mechanism to ensure that it would be properly handled.
527528
528-
# Safety _and_ speed
529+
# Safety _and_ Speed
529530
530-
Safety and speed are always presented as a continuum. On one hand, you have
531-
maximum speed, but no safety. On the other, you have absolute safety, with no
532-
speed. Rust seeks to break out of this mode by introducing safety at compile
533-
time, ensuring that you haven't done anything wrong, while compiling to the
534-
same low-level code you'd expect without the safety.
531+
Safety and speed are always presented as a continuum. At one end of the spectrum,
532+
you have maximum speed, but no safety. On the other end, you have absolute safety
533+
with no speed. Rust seeks to break out of this paradigm by introducing safety at
534+
compile time, ensuring that you haven't done anything wrong, while compiling to
535+
the same low-level code you'd expect without the safety.
535536
536537
As an example, Rust's ownership system is _entirely_ at compile time. The
537538
safety check that makes this an error about moved values:

src/doc/not_found.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@ Looks like you've taken a wrong turn.
1212
Some things that might be helpful to you though:
1313

1414
## Search
15+
1516
* <form action="https://duckduckgo.com/">
1617
<input type="text" id="site-search" name="q" size="80"></input>
1718
<input type="submit" value="Search DuckDuckGo">
1819
</form>
1920
* Rust doc search: <span id="core-search"></span>
2021

2122
## Reference
23+
2224
* [The Rust official site](http://rust-lang.org)
23-
* [The Rust reference](http://doc.rust-lang.org/reference.html) (* [PDF](http://doc.rust-lang.org/reference.pdf))
25+
* [The Rust reference](http://doc.rust-lang.org/reference.html)
2426

2527
## Docs
28+
2629
* [The standard library](http://doc.rust-lang.org/std/)
2730

2831
<script>

0 commit comments

Comments
 (0)