Skip to content

Commit d168e3d

Browse files
committed
---
yaml --- r: 273695 b: refs/heads/beta c: 2bfc470 h: refs/heads/master i: 273693: 9999e9b 273691: b37b092 273687: 42d969c 273679: 760ea36 273663: 1e1e71c
1 parent c3b0c99 commit d168e3d

File tree

281 files changed

+1906
-2145
lines changed

Some content is hidden

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

281 files changed

+1906
-2145
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 3602f34e9cfe542210b6ac4302ae8d0f0799965b
26+
refs/heads/beta: 2bfc47075a9c2e7f0824bac0beb4d471a309312b
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/mk/crates.mk

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ TARGET_CRATES := libc std term \
5757
RUSTC_CRATES := rustc rustc_typeck rustc_mir rustc_borrowck rustc_resolve rustc_driver \
5858
rustc_trans rustc_back rustc_llvm rustc_privacy rustc_lint \
5959
rustc_data_structures rustc_front rustc_platform_intrinsics \
60-
rustc_plugin rustc_metadata rustc_passes rustc_save_analysis
60+
rustc_plugin rustc_metadata rustc_passes
6161
HOST_CRATES := syntax syntax_ext $(RUSTC_CRATES) rustdoc fmt_macros \
6262
flate arena graphviz rbml log serialize
6363
TOOLS := compiletest rustdoc rustc rustbook error_index_generator
@@ -102,7 +102,7 @@ DEPS_rustc_data_structures := std log serialize
102102
DEPS_rustc_driver := arena flate getopts graphviz libc rustc rustc_back rustc_borrowck \
103103
rustc_typeck rustc_mir rustc_resolve log syntax serialize rustc_llvm \
104104
rustc_trans rustc_privacy rustc_lint rustc_front rustc_plugin \
105-
rustc_metadata syntax_ext rustc_passes rustc_save_analysis
105+
rustc_metadata syntax_ext rustc_passes
106106
DEPS_rustc_front := std syntax log serialize
107107
DEPS_rustc_lint := rustc log syntax
108108
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
@@ -116,14 +116,13 @@ DEPS_rustc_privacy := rustc rustc_front log syntax
116116
DEPS_rustc_trans := arena flate getopts graphviz libc rustc rustc_back rustc_mir \
117117
log syntax serialize rustc_llvm rustc_front rustc_platform_intrinsics \
118118
rustc_const_eval
119-
DEPS_rustc_save_analysis := rustc log syntax rustc_front
120119
DEPS_rustc_typeck := rustc syntax rustc_front rustc_platform_intrinsics rustc_const_eval
121120

122121
DEPS_rustdoc := rustc rustc_driver native:hoedown serialize getopts \
123122
test rustc_lint rustc_front
124123

125124

126-
TOOL_DEPS_compiletest := test getopts log
125+
TOOL_DEPS_compiletest := test getopts
127126
TOOL_DEPS_rustdoc := rustdoc
128127
TOOL_DEPS_rustc := rustc_driver
129128
TOOL_DEPS_rustbook := std rustdoc

branches/beta/mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ endif
493493
LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \
494494
$$(CURDIR)/$$(HLIB$(1)_H_$(3)):$$(CFG_LLVM_INST_DIR_$(3))/lib
495495
LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3) := \
496-
$$(CURDIR)/$$(TLIB$(1)_T_$(2)_H_$(CFG_BUILD))
496+
$$(CURDIR)/$$(TLIB1_T_$(2)_H_$(CFG_BUILD))
497497

498498
HOST_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
499499
$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))

branches/beta/src/bootstrap/build/native.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ pub fn llvm(build: &Build, target: &str) {
3939

4040
let _ = fs::remove_dir_all(&dst.join("build"));
4141
t!(fs::create_dir_all(&dst.join("build")));
42-
let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
42+
let mut assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
43+
44+
// Disable LLVM assertions on ARM compilers until #32360 is fixed
45+
if target.contains("arm") && target.contains("gnu") {
46+
assertions = "OFF";
47+
}
4348

4449
// http://llvm.org/docs/CMake.html
4550
let mut cfg = cmake::Config::new(build.src.join("src/llvm"));

branches/beta/src/bootstrap/mk/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ standalone-docs:
3838
$(Q)$(BOOTSTRAP) --step doc-standalone
3939
check:
4040
$(Q)$(BOOTSTRAP) --step check
41-
check-cargotest:
42-
$(Q)$(BOOTSTRAP) --step check-cargotest
41+
cargotest:
42+
$(Q)$(BOOTSTRAP) --step cargotest
4343
dist:
4444
$(Q)$(BOOTSTRAP) --step dist
4545

branches/beta/src/compiletest/runtest.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,11 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testpaths: &TestP
727727
script_str.push_str("type category enable Rust\n");
728728

729729
// Set breakpoints on every line that contains the string "#break"
730+
let source_file_name = testpaths.file.file_name().unwrap().to_string_lossy();
730731
for line in &breakpoint_lines {
731-
script_str.push_str(&format!("breakpoint set --line {}\n", line));
732+
script_str.push_str(&format!("breakpoint set --file '{}' --line {}\n",
733+
source_file_name,
734+
line));
732735
}
733736

734737
// Append the other commands

branches/beta/src/doc/book/concurrency.md

Lines changed: 18 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -94,54 +94,6 @@ fn main() {
9494
}
9595
```
9696

97-
As closures can capture variables from their environment, we can also try to
98-
bring some data into the other thread:
99-
100-
```rust,ignore
101-
use std::thread;
102-
103-
fn main() {
104-
let x = 1;
105-
thread::spawn(|| {
106-
println!("x is {}", x);
107-
});
108-
}
109-
```
110-
111-
However, this gives us an error:
112-
113-
```text
114-
5:19: 7:6 error: closure may outlive the current function, but it
115-
borrows `x`, which is owned by the current function
116-
...
117-
5:19: 7:6 help: to force the closure to take ownership of `x` (and any other referenced variables),
118-
use the `move` keyword, as shown:
119-
thread::spawn(move || {
120-
println!("x is {}", x);
121-
});
122-
```
123-
124-
This is because by default closures capture variables by reference, and thus the
125-
closure only captures a _reference to `x`_. This is a problem, because the
126-
thread may outlive the scope of `x`, leading to a dangling pointer.
127-
128-
To fix this, we use a `move` closure as mentioned in the error message. `move`
129-
closures are explained in depth [here](closures.html#move-closures); basically
130-
they move variables from their environment into themselves. This means that `x`
131-
is now owned by the closure, and cannot be used in `main()` after the call to
132-
`spawn()`.
133-
134-
```rust
135-
use std::thread;
136-
137-
fn main() {
138-
let x = 1;
139-
thread::spawn(move || {
140-
println!("x is {}", x);
141-
});
142-
}
143-
```
144-
14597
Many languages have the ability to execute threads, but it's wildly unsafe.
14698
There are entire books about how to prevent errors that occur from shared
14799
mutable state. Rust helps out with its type system here as well, by preventing
@@ -193,64 +145,23 @@ This gives us an error:
193145
```
194146

195147
Rust knows this wouldn't be safe! If we had a reference to `data` in each
196-
thread, and the thread takes ownership of the reference, we'd have three owners!
197-
`data` gets moved out of `main` in the first call to `spawn()`, so subsequent
198-
calls in the loop cannot use this variable.
199-
200-
So, we need some type that lets us have more than one owning reference to a
201-
value. Usually, we'd use `Rc<T>` for this, which is a reference counted type
202-
that provides shared ownership. It has some runtime bookkeeping that keeps track
203-
of the number of references to it, hence the "reference count" part of its name.
204-
205-
Calling `clone()` on an `Rc<T>` will return a new owned reference and bump the
206-
internal reference count. We create one of these for each thread:
148+
thread, and the thread takes ownership of the reference, we'd have three
149+
owners!
207150

151+
So, we need some type that lets us have more than one reference to a value and
152+
that we can share between threads, that is it must implement `Sync`.
208153

209-
```ignore
210-
use std::thread;
211-
use std::time::Duration;
212-
use std::rc::Rc;
154+
We'll use `Arc<T>`, Rust's standard atomic reference count type, which
155+
wraps a value up with some extra runtime bookkeeping which allows us to
156+
share the ownership of the value between multiple references at the same time.
213157

214-
fn main() {
215-
let mut data = Rc::new(vec![1, 2, 3]);
216-
217-
for i in 0..3 {
218-
// create a new owned reference
219-
let data_ref = data.clone();
220-
221-
// use it in a thread
222-
thread::spawn(move || {
223-
data_ref[i] += 1;
224-
});
225-
}
226-
227-
thread::sleep(Duration::from_millis(50));
228-
}
229-
```
230-
231-
This won't work, however, and will give us the error:
232-
233-
```text
234-
13:9: 13:22 error: the trait `core::marker::Send` is not
235-
implemented for the type `alloc::rc::Rc<collections::vec::Vec<i32>>`
236-
...
237-
13:9: 13:22 note: `alloc::rc::Rc<collections::vec::Vec<i32>>`
238-
cannot be sent between threads safely
239-
```
240-
241-
As the error message mentions, `Rc` cannot be sent between threads safely. This
242-
is because the internal reference count is not maintained in a thread safe
243-
matter and can have a data race.
244-
245-
To solve this, we'll use `Arc<T>`, Rust's standard atomic reference count type.
158+
The bookkeeping consists of a count of how many of these references exist to
159+
the value, hence the reference count part of the name.
246160

247161
The Atomic part means `Arc<T>` can safely be accessed from multiple threads.
248162
To do this the compiler guarantees that mutations of the internal count use
249163
indivisible operations which can't have data races.
250164

251-
In essence, `Arc<T>` is a type that lets us share ownership of data _across
252-
threads_.
253-
254165

255166
```ignore
256167
use std::thread;
@@ -271,7 +182,7 @@ fn main() {
271182
}
272183
```
273184

274-
Similarly to last time, we use `clone()` to create a new owned handle.
185+
We now call `clone()` on our `Arc<T>`, which increases the internal count.
275186
This handle is then moved into the new thread.
276187

277188
And... still gives us an error.
@@ -282,21 +193,14 @@ And... still gives us an error.
282193
^~~~
283194
```
284195

285-
`Arc<T>` by default has immutable contents. It allows the _sharing_ of data
286-
between threads, but shared mutable data is unsafe and when threads are
287-
involved can cause data races!
288-
196+
`Arc<T>` assumes one more property about its contents to ensure that it is safe
197+
to share across threads: it assumes its contents are `Sync`. This is true for
198+
our value if it's immutable, but we want to be able to mutate it, so we need
199+
something else to persuade the borrow checker we know what we're doing.
289200

290-
Usually when we wish to make something in an immutable position mutable, we use
291-
`Cell<T>` or `RefCell<T>` which allow safe mutation via runtime checks or
292-
otherwise (see also: [Choosing Your Guarantees](choosing-your-guarantees.html)).
293-
However, similar to `Rc`, these are not thread safe. If we try using these, we
294-
will get an error about these types not being `Sync`, and the code will fail to
295-
compile.
296-
297-
It looks like we need some type that allows us to safely mutate a shared value
298-
across threads, for example a type that can ensure only one thread at a time is
299-
able to mutate the value inside it at any one time.
201+
It looks like we need some type that allows us to safely mutate a shared value,
202+
for example a type that can ensure only one thread at a time is able to
203+
mutate the value inside it at any one time.
300204

301205
For that, we can use the `Mutex<T>` type!
302206

@@ -325,17 +229,7 @@ fn main() {
325229
Note that the value of `i` is bound (copied) to the closure and not shared
326230
among the threads.
327231

328-
We're "locking" the mutex here. A mutex (short for "mutual exclusion"), as
329-
mentioned, only allows one thread at a time to access a value. When we wish to
330-
access the value, we use `lock()` on it. This will "lock" the mutex, and no
331-
other thread will be able to lock it (and hence, do anything with the value)
332-
until we're done with it. If a thread attempts to lock a mutex which is already
333-
locked, it will wait until the other thread releases the lock.
334-
335-
The lock "release" here is implicit; when the result of the lock (in this case,
336-
`data`) goes out of scope, the lock is automatically released.
337-
338-
Note that [`lock`](../std/sync/struct.Mutex.html#method.lock) method of
232+
Also note that [`lock`](../std/sync/struct.Mutex.html#method.lock) method of
339233
[`Mutex`](../std/sync/struct.Mutex.html) has this signature:
340234

341235
```ignore

branches/beta/src/doc/book/strings.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ let s = "foo\
4444
assert_eq!("foobar", s);
4545
```
4646

47-
Note that you normally cannot access a `str` directly, but only through a `&str`
48-
reference. This is because `str` is an unsized type which requires additional
49-
runtime information to be usable. For more information see the chapter on
50-
[unsized types][ut].
51-
5247
Rust has more than only `&str`s though. A `String` is a heap-allocated string.
5348
This string is growable, and is also guaranteed to be UTF-8. `String`s are
5449
commonly created by converting from a string slice using the `to_string`
@@ -190,6 +185,5 @@ let hello_world = hello + &world;
190185
This is because `&String` can automatically coerce to a `&str`. This is a
191186
feature called ‘[`Deref` coercions][dc]’.
192187

193-
[ut]: unsized-types.html
194188
[dc]: deref-coercions.html
195189
[connect]: ../std/net/struct.TcpStream.html#method.connect

branches/beta/src/doc/reference.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3911,9 +3911,6 @@ The _heap_ is a general term that describes boxes. The lifetime of an
39113911
allocation in the heap depends on the lifetime of the box values pointing to
39123912
it. Since box values may themselves be passed in and out of frames, or stored
39133913
in the heap, heap allocations may outlive the frame they are allocated within.
3914-
An allocation in the heap is guaranteed to reside at a single location in the
3915-
heap for the whole lifetime of the allocation - it will never be relocated as
3916-
a result of moving a box value.
39173914

39183915
### Memory ownership
39193916

branches/beta/src/etc/CONFIGS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ These are some links to repos with configs which ease the use of rust.
1010
* [kate-config](https://github.com/rust-lang/kate-config)
1111
* [nano-config](https://github.com/rust-lang/nano-config)
1212
* [zsh-config](https://github.com/rust-lang/zsh-config)
13+
14+
## Community-maintained Configs
15+
16+
* [.editorconfig](https://gist.github.com/derhuerst/c9d1b9309e308d9851fa) ([what is this?](http://editorconfig.org/))

branches/beta/src/librustc/dep_graph/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use self::thread::{DepGraphThreadData, DepMessage};
1212
use middle::def_id::DefId;
1313
use syntax::ast::NodeId;
14-
use ty::TyCtxt;
14+
use middle::ty::TyCtxt;
1515
use rustc_front::hir;
1616
use rustc_front::intravisit::Visitor;
1717
use std::rc::Rc;

branches/beta/src/librustc/lib.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,17 @@ pub mod back {
7878
pub use rustc_back::svh;
7979
}
8080

81-
pub mod cfg;
8281
pub mod dep_graph;
8382

8483
pub mod front {
8584
pub mod check_attr;
8685
pub mod map;
8786
}
8887

89-
pub mod infer;
90-
pub mod lint;
91-
9288
pub mod middle {
9389
pub mod astconv_util;
9490
pub mod expr_use_visitor; // STAGE0: increase glitch immunity
91+
pub mod cfg;
9592
pub mod check_match;
9693
pub mod const_eval;
9794
pub mod const_qualif;
@@ -105,6 +102,7 @@ pub mod middle {
105102
pub mod entry;
106103
pub mod free_region;
107104
pub mod intrinsicck;
105+
pub mod infer;
108106
pub mod lang_items;
109107
pub mod liveness;
110108
pub mod mem_categorization;
@@ -115,6 +113,9 @@ pub mod middle {
115113
pub mod recursion_limit;
116114
pub mod resolve_lifetime;
117115
pub mod stability;
116+
pub mod subst;
117+
pub mod traits;
118+
pub mod ty;
118119
pub mod weak_lang_items;
119120
}
120121

@@ -127,8 +128,8 @@ pub mod mir {
127128
}
128129

129130
pub mod session;
130-
pub mod traits;
131-
pub mod ty;
131+
132+
pub mod lint;
132133

133134
pub mod util {
134135
pub use rustc_back::sha2;

branches/beta/src/librustc/lint/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use self::TargetLint::*;
2727

2828
use dep_graph::DepNode;
2929
use middle::privacy::AccessLevels;
30-
use ty::TyCtxt;
30+
use middle::ty::TyCtxt;
3131
use session::{config, early_error, Session};
3232
use lint::{Level, LevelSource, Lint, LintId, LintArray, LintPass};
3333
use lint::{EarlyLintPass, EarlyLintPassObject, LateLintPass, LateLintPassObject};

branches/beta/src/librustc/middle/astconv_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
use middle::def::Def;
18-
use ty::{Ty, TyCtxt};
18+
use middle::ty::{Ty, TyCtxt};
1919

2020
use syntax::codemap::Span;
2121
use rustc_front::hir as ast;

0 commit comments

Comments
 (0)