Skip to content

Commit 22e86bc

Browse files
committed
---
yaml --- r: 211822 b: refs/heads/auto c: 613e57b h: refs/heads/master v: v3
1 parent e04e15d commit 22e86bc

File tree

80 files changed

+1291
-191
lines changed

Some content is hidden

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

80 files changed

+1291
-191
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: 0ad019f4e86d68682dacb90f1d0d03cddba31bac
13+
refs/heads/auto: 613e57b448c88591b6076a8cea9799f1f3876687
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/configure

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ opt rpath 0 "build rpaths into rustc itself"
565565
# This is used by the automation to produce single-target nightlies
566566
opt dist-host-only 0 "only install bins for the host architecture"
567567
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
568-
opt llvm-version-check 1 "don't check if the LLVM version is supported, build anyway"
568+
opt llvm-version-check 1 "check if the LLVM version is supported, build anyway"
569569

570570
# Optimization and debugging options. These may be overridden by the release channel, etc.
571571
opt_nosave optimize 1 "build optimized rust code"
@@ -593,6 +593,7 @@ valopt musl-root "/usr/local" "MUSL root installation directory"
593593
opt_nosave manage-submodules 1 "let the build manage the git submodules"
594594
opt_nosave clang 0 "prefer clang to gcc for building the runtime"
595595
opt_nosave jemalloc 1 "build liballoc with jemalloc"
596+
opt elf-tls 1 "elf thread local storage on platforms where supported"
596597

597598
valopt_nosave prefix "/usr/local" "set installation prefix"
598599
valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary"

branches/auto/mk/crates.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,7 @@ TOOL_INPUTS_$(1) := $$(call rwildcard,$$(dir $$(TOOL_SOURCE_$(1))),*.rs)
150150
endef
151151

152152
$(foreach crate,$(TOOLS),$(eval $(call RUST_TOOL,$(crate))))
153+
154+
ifdef CFG_DISABLE_ELF_TLS
155+
RUSTFLAGS_std := --cfg no_elf_tls
156+
endif

branches/auto/src/doc/style/features/functions-and-methods/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ for any operation that is clearly associated with a particular
2020
type.
2121

2222
Methods have numerous advantages over functions:
23+
2324
* They do not need to be imported or qualified to be used: all you
2425
need is a value of the appropriate type.
2526
* Their invocation performs autoborrowing (including mutable borrows).

branches/auto/src/doc/style/features/functions-and-methods/input.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ fn foo(a: u8) { ... }
159159
Note that
160160
[`ascii::Ascii`](http://static.rust-lang.org/doc/master/std/ascii/struct.Ascii.html)
161161
is a _wrapper_ around `u8` that guarantees the highest bit is zero; see
162-
[newtype patterns]() for more details on creating typesafe wrappers.
162+
[newtype patterns](../types/newtype.md) for more details on creating typesafe wrappers.
163163
164164
Static enforcement usually comes at little run-time cost: it pushes the
165165
costs to the boundaries (e.g. when a `u8` is first converted into an

branches/auto/src/doc/style/features/let.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Prefer
3434

3535
```rust
3636
let foo = match bar {
37-
Baz => 0,
37+
Baz => 0,
3838
Quux => 1
3939
};
4040
```
@@ -44,7 +44,7 @@ over
4444
```rust
4545
let foo;
4646
match bar {
47-
Baz => {
47+
Baz => {
4848
foo = 0;
4949
}
5050
Quux => {
@@ -61,8 +61,8 @@ conditional expression.
6161
Prefer
6262

6363
```rust
64-
s.iter().map(|x| x * 2)
65-
.collect::<Vec<_>>()
64+
let v = s.iter().map(|x| x * 2)
65+
.collect::<Vec<_>>();
6666
```
6767

6868
over

branches/auto/src/doc/style/ownership/builders.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If `T` is such a data structure, consider introducing a `T` _builder_:
1616
value. When possible, choose a better name: e.g. `Command` is the builder for
1717
`Process`.
1818
2. The builder constructor should take as parameters only the data _required_ to
19-
to make a `T`.
19+
make a `T`.
2020
3. The builder should offer a suite of convenient methods for configuration,
2121
including setting up compound inputs (like slices) incrementally.
2222
These methods should return `self` to allow chaining.

branches/auto/src/doc/trpl/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ language would.
1515

1616
[rust]: http://rust-lang.org
1717

18-
“The Rust Programming Language” is split into seven sections. This introduction
18+
“The Rust Programming Language” is split into eight sections. This introduction
1919
is the first. After this:
2020

2121
* [Getting started][gs] - Set up your computer for Rust development.

branches/auto/src/doc/trpl/glossary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In the example above `x` and `y` have arity 2. `z` has arity 3.
1919

2020
When a compiler is compiling your program, it does a number of different
2121
things. One of the things that it does is turn the text of your program into an
22-
‘abstract syntax tree’, or‘AST’. This tree is a representation of the
22+
‘abstract syntax tree’, or ‘AST’. This tree is a representation of the
2323
structure of your program. For example, `2 + 3` can be turned into a tree:
2424

2525
```text

branches/auto/src/doc/trpl/guessing-game.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Finally, Cargo generated a ‘Hello, world!’ for us. Check out `src/main.rs`:
3838

3939
```rust
4040
fn main() {
41-
println!("Hello, world!")
41+
println!("Hello, world!");
4242
}
4343
```
4444

@@ -362,7 +362,7 @@ everything that follows it is part of it, until the next section starts.
362362
Cargo uses the dependencies section to know what dependencies on external
363363
crates you have, and what versions you require. In this case, we’ve used version `0.3.0`.
364364
Cargo understands [Semantic Versioning][semver], which is a standard for writing version
365-
numbers. If we wanted to use the latest version we could use `*` or we could use a range
365+
numbers. If we wanted to use the latest version we could use `*` or we could use a range
366366
of versions. [Cargo’s documentation][cargodoc] contains more details.
367367

368368
[semver]: http://semver.org

branches/auto/src/doc/trpl/installing-rust.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
The first step to using Rust is to install it! There are a number of ways to
44
install Rust, but the easiest is to use the `rustup` script. If you're on Linux
5-
or a Mac, all you need to do is this (note that you don't need to type in the
6-
`$`s, they just indicate the start of each command):
5+
or a Mac, all you need to do is this:
6+
7+
> Note: you don't need to type in the `$`s, they just indicate the start of
8+
> each command. You’ll see many tutorials and examples around the web that
9+
> follow this convention: `$` for commands run as your regular user, and
10+
> `#` for commands you should be running as an administrator.
711
812
```bash
913
$ curl -sf -L https://static.rust-lang.org/rustup.sh | sh

branches/auto/src/doc/trpl/iterators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ As we've said before, an iterator is something that we can call the
213213
`.next()` method on repeatedly, and it gives us a sequence of things.
214214
Because you need to call the method, this means that iterators
215215
can be *lazy* and not generate all of the values upfront. This code,
216-
for example, does not actually generate the numbers `1-100`, instead
216+
for example, does not actually generate the numbers `1-99`, instead
217217
creating a value that merely represents the sequence:
218218

219219
```rust

branches/auto/src/doc/trpl/lifetimes.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,29 @@ x: &'a i32,
134134
# }
135135
```
136136

137-
uses it. So why do we need a lifetime here? We need to ensure that any
138-
reference to the contained `i32` does not outlive the containing `Foo`.
137+
uses it. So why do we need a lifetime here? We need to ensure that any reference
138+
to a `Foo` cannot outlive the reference to an `i32` it contains.
139+
140+
If you have multiple references, you can use the same lifetime multiple times:
141+
142+
```rust
143+
fn x_or_y<'a>(x: &'a str, y: &'a str) -> &'a str {
144+
# x
145+
# }
146+
```
147+
148+
This says that `x` and `y` both are alive for the same scope, and that the
149+
return value is also alive for that scope. If you wanted `x` and `y` to have
150+
different lifetimes, you can use multiple lifetime parameters:
151+
152+
```rust
153+
fn x_or_y<'a, 'b>(x: &'a str, y: &'b str) -> &'a str {
154+
# x
155+
# }
156+
```
157+
158+
In this example, `x` and `y` have different valid scopes, but the return value
159+
has the same lifetime as `x`.
139160

140161
## Thinking in scopes
141162

branches/auto/src/doc/trpl/method-syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Functions are great, but if you want to call a bunch of them on some data, it
44
can be awkward. Consider this code:
55

66
```rust,ignore
7-
baz(bar(foo)));
7+
baz(bar(foo));
88
```
99

1010
We would read this left-to right, and so we see ‘baz bar foo’. But this isn’t the

branches/auto/src/doc/trpl/mutability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ philosophy, memory safety, and the mechanism by which Rust guarantees it, the
8989
> * exactly one mutable reference (`&mut T`)
9090
9191
[ownership]: ownership.html
92-
[borrowing]: borrowing.html#The-Rules
92+
[borrowing]: references-and-borrowing.html#borrowing
9393

9494
So, that’s the real definition of ‘immutability’: is this safe to have two
9595
pointers to? In `Arc<T>`’s case, yes: the mutation is entirely contained inside

branches/auto/src/doc/trpl/traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ fn bar<T, K>(x: T, y: K) where T: Clone, K: Clone + Debug {
285285

286286
fn main() {
287287
foo("Hello", "world");
288-
bar("Hello", "workd");
288+
bar("Hello", "world");
289289
}
290290
```
291291

branches/auto/src/liballoc/arc.rs

Lines changed: 56 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.loa
250250
///
251251
/// Returns `None` if the `Arc<T>` is not unique.
252252
///
253+
/// This function is marked **unsafe** because it is racy if weak pointers
254+
/// are active.
255+
///
253256
/// # Examples
254257
///
255258
/// ```
@@ -258,24 +261,27 @@ pub fn strong_count<T: ?Sized>(this: &Arc<T>) -> usize { this.inner().strong.loa
258261
/// # fn main() {
259262
/// use alloc::arc::{Arc, get_mut};
260263
///
264+
/// # unsafe {
261265
/// let mut x = Arc::new(3);
262266
/// *get_mut(&mut x).unwrap() = 4;
263267
/// assert_eq!(*x, 4);
264268
///
265269
/// let _y = x.clone();
266270
/// assert!(get_mut(&mut x).is_none());
267271
/// # }
272+
/// # }
268273
/// ```
269274
#[inline]
270275
#[unstable(feature = "alloc")]
271-
pub fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
276+
pub unsafe fn get_mut<T: ?Sized>(this: &mut Arc<T>) -> Option<&mut T> {
277+
// FIXME(#24880) potential race with upgraded weak pointers here
272278
if strong_count(this) == 1 && weak_count(this) == 0 {
273279
// This unsafety is ok because we're guaranteed that the pointer
274280
// returned is the *only* pointer that will ever be returned to T. Our
275281
// reference count is guaranteed to be 1 at this point, and we required
276282
// the Arc itself to be `mut`, so we're returning the only possible
277283
// reference to the inner data.
278-
let inner = unsafe { &mut **this._ptr };
284+
let inner = &mut **this._ptr;
279285
Some(&mut inner.data)
280286
} else {
281287
None
@@ -332,19 +338,26 @@ impl<T: Clone> Arc<T> {
332338
/// This is also referred to as a copy-on-write operation because the inner
333339
/// data is cloned if the reference count is greater than one.
334340
///
341+
/// This method is marked **unsafe** because it is racy if weak pointers
342+
/// are active.
343+
///
335344
/// # Examples
336345
///
337346
/// ```
338347
/// # #![feature(alloc)]
339348
/// use std::sync::Arc;
340349
///
350+
/// # unsafe {
341351
/// let mut five = Arc::new(5);
342352
///
343353
/// let mut_five = five.make_unique();
354+
/// # }
344355
/// ```
345356
#[inline]
346357
#[unstable(feature = "alloc")]
347-
pub fn make_unique(&mut self) -> &mut T {
358+
pub unsafe fn make_unique(&mut self) -> &mut T {
359+
// FIXME(#24880) potential race with upgraded weak pointers here
360+
//
348361
// Note that we hold a strong reference, which also counts as a weak
349362
// reference, so we only clone if there is an additional reference of
350363
// either kind.
@@ -354,7 +367,7 @@ impl<T: Clone> Arc<T> {
354367
}
355368
// As with `get_mut()`, the unsafety is ok because our reference was
356369
// either unique to begin with, or became one upon cloning the contents.
357-
let inner = unsafe { &mut **self._ptr };
370+
let inner = &mut **self._ptr;
358371
&mut inner.data
359372
}
360373
}
@@ -744,39 +757,43 @@ mod tests {
744757

745758
#[test]
746759
fn test_arc_get_mut() {
747-
let mut x = Arc::new(3);
748-
*get_mut(&mut x).unwrap() = 4;
749-
assert_eq!(*x, 4);
750-
let y = x.clone();
751-
assert!(get_mut(&mut x).is_none());
752-
drop(y);
753-
assert!(get_mut(&mut x).is_some());
754-
let _w = x.downgrade();
755-
assert!(get_mut(&mut x).is_none());
760+
unsafe {
761+
let mut x = Arc::new(3);
762+
*get_mut(&mut x).unwrap() = 4;
763+
assert_eq!(*x, 4);
764+
let y = x.clone();
765+
assert!(get_mut(&mut x).is_none());
766+
drop(y);
767+
assert!(get_mut(&mut x).is_some());
768+
let _w = x.downgrade();
769+
assert!(get_mut(&mut x).is_none());
770+
}
756771
}
757772

758773
#[test]
759774
fn test_cowarc_clone_make_unique() {
760-
let mut cow0 = Arc::new(75);
761-
let mut cow1 = cow0.clone();
762-
let mut cow2 = cow1.clone();
763-
764-
assert!(75 == *cow0.make_unique());
765-
assert!(75 == *cow1.make_unique());
766-
assert!(75 == *cow2.make_unique());
767-
768-
*cow0.make_unique() += 1;
769-
*cow1.make_unique() += 2;
770-
*cow2.make_unique() += 3;
771-
772-
assert!(76 == *cow0);
773-
assert!(77 == *cow1);
774-
assert!(78 == *cow2);
775-
776-
// none should point to the same backing memory
777-
assert!(*cow0 != *cow1);
778-
assert!(*cow0 != *cow2);
779-
assert!(*cow1 != *cow2);
775+
unsafe {
776+
let mut cow0 = Arc::new(75);
777+
let mut cow1 = cow0.clone();
778+
let mut cow2 = cow1.clone();
779+
780+
assert!(75 == *cow0.make_unique());
781+
assert!(75 == *cow1.make_unique());
782+
assert!(75 == *cow2.make_unique());
783+
784+
*cow0.make_unique() += 1;
785+
*cow1.make_unique() += 2;
786+
*cow2.make_unique() += 3;
787+
788+
assert!(76 == *cow0);
789+
assert!(77 == *cow1);
790+
assert!(78 == *cow2);
791+
792+
// none should point to the same backing memory
793+
assert!(*cow0 != *cow1);
794+
assert!(*cow0 != *cow2);
795+
assert!(*cow1 != *cow2);
796+
}
780797
}
781798

782799
#[test]
@@ -789,7 +806,9 @@ mod tests {
789806
assert!(75 == *cow1);
790807
assert!(75 == *cow2);
791808

792-
*cow0.make_unique() += 1;
809+
unsafe {
810+
*cow0.make_unique() += 1;
811+
}
793812

794813
assert!(76 == *cow0);
795814
assert!(75 == *cow1);
@@ -810,7 +829,9 @@ mod tests {
810829
assert!(75 == *cow0);
811830
assert!(75 == *cow1_weak.upgrade().unwrap());
812831

813-
*cow0.make_unique() += 1;
832+
unsafe {
833+
*cow0.make_unique() += 1;
834+
}
814835

815836
assert!(76 == *cow0);
816837
assert!(cow1_weak.upgrade().is_none());

branches/auto/src/libcollections/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//! You can get a non-`'static` `&str` by taking a slice of a `String`:
3131
//!
3232
//! ```
33-
//! # let some_string = "Hello, world.".to_string();
33+
//! let some_string = "Hello, world.".to_string();
3434
//! let s = &some_string;
3535
//! ```
3636
//!

branches/auto/src/libcollectionstest/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#![feature(collections)]
1515
#![feature(collections_drain)]
1616
#![feature(core)]
17+
#![feature(const_fn)]
1718
#![feature(hash)]
1819
#![feature(rand)]
1920
#![feature(rustc_private)]

0 commit comments

Comments
 (0)