Skip to content

Commit 8c17fce

Browse files
committed
---
yaml --- r: 193991 b: refs/heads/beta c: a7a28d7 h: refs/heads/master i: 193989: 67254d2 193987: 1c4c7f3 193983: 7599770 v: v3
1 parent 771ac7e commit 8c17fce

File tree

115 files changed

+3798
-1922
lines changed

Some content is hidden

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

115 files changed

+3798
-1922
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: dbe084b5bffae155b83f9229d04d83e7273bec4f
34+
refs/heads/beta: a7a28d709170f5dd14439c83d115e16a11c53c06
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
# make check-stage1-rpass TESTNAME=my-shiny-new-test
9898
#
9999
# // Having trouble figuring out which test is failing? Turn off parallel tests
100-
# make check-stage1-std RUST_TEST_THREADS=1
100+
# make check-stage1-std RUST_TEST_TASKS=1
101101
#
102102
# This is hardly all there is to know of The Rust Build System's
103103
# mysteries. The tale continues on the wiki[1].

branches/beta/src/compiletest/compiletest.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#![feature(unboxed_closures)]
2020
#![feature(std_misc)]
2121
#![feature(test)]
22+
#![feature(core)]
2223
#![feature(path_ext)]
2324

2425
#![deny(warnings)]
@@ -224,15 +225,15 @@ pub fn run_tests(config: &Config) {
224225
// android debug-info test uses remote debugger
225226
// so, we test 1 task at once.
226227
// also trying to isolate problems with adb_run_wrapper.sh ilooping
227-
env::set_var("RUST_TEST_THREADS","1");
228+
env::set_var("RUST_TEST_TASKS","1");
228229
}
229230

230231
match config.mode {
231232
DebugInfoLldb => {
232233
// Some older versions of LLDB seem to have problems with multiple
233234
// instances running in parallel, so only run one test task at a
234235
// time.
235-
env::set_var("RUST_TEST_THREADS", "1");
236+
env::set_var("RUST_TEST_TASKS", "1");
236237
}
237238
_ => { /* proceed */ }
238239
}

branches/beta/src/compiletest/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
131131
true
132132
});
133133

134-
for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_THREADS"] {
134+
for key in vec!["RUST_TEST_NOCAPTURE", "RUST_TEST_TASKS"] {
135135
match env::var(key) {
136136
Ok(val) =>
137137
if exec_env.iter().find(|&&(ref x, _)| *x == key.to_string()).is_none() {

branches/beta/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2068,7 +2068,7 @@ type int8_t = i8;
20682068
item](#language-items) for more details.
20692069
- `test` - indicates that this function is a test function, to only be compiled
20702070
in case of `--test`.
2071-
- `should_panic` - indicates that this test function should panic, inverting the success condition.
2071+
- `should_fail` - indicates that this test function should panic, inverting the success condition.
20722072
- `cold` - The function is unlikely to be executed, so optimize it (and calls
20732073
to it) differently.
20742074

branches/beta/src/doc/trpl/crates-and-modules.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -562,11 +562,6 @@ place in the hierarchy instead. There's one more special form of `use`: you can
562562
people like to think of `self` as `.` and `super` as `..`, from many shells'
563563
display for the current directory and the parent directory.
564564
565-
Outside of `use`, paths are relative: `foo::bar()` refers to a function inside
566-
of `foo` relative to where we are. If that's prefixed with `::`, as in
567-
`::foo::bar()`, it refers to a different `foo`, an absolute path from your
568-
crate root.
569-
570565
Also, note that we `pub use`d before we declared our `mod`s. Rust requires that
571566
`use` declarations go first.
572567

branches/beta/src/doc/trpl/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Because this function will cause a crash, it will never return, and so it has
179179
the type '`!`', which is read "diverges." A diverging function can be used
180180
as any type:
181181

182-
```should_panic
182+
```should_fail
183183
# fn diverges() -> ! {
184184
# panic!("This function never returns!");
185185
# }

branches/beta/src/doc/trpl/pointers.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -561,40 +561,38 @@ fn main() {
561561
In this case, Rust knows that `x` is being *borrowed* by the `add_one()`
562562
function, and since it's only reading the value, allows it.
563563

564-
We can borrow `x` as read-only multiple times, even simultaneously:
564+
We can borrow `x` multiple times, as long as it's not simultaneous:
565565

566566
```{rust}
567-
fn add(x: &i32, y: &i32) -> i32 {
568-
*x + *y
567+
fn add_one(x: &i32) -> i32 {
568+
*x + 1
569569
}
570570
571571
fn main() {
572572
let x = Box::new(5);
573573
574-
println!("{}", add(&x, &x));
575-
println!("{}", add(&x, &x));
574+
println!("{}", add_one(&*x));
575+
println!("{}", add_one(&*x));
576+
println!("{}", add_one(&*x));
576577
}
577578
```
578579

579-
We can mutably borrow `x` multiple times, but only if x itself is mutable, and
580-
it may not be *simultaneously* borrowed:
580+
Or as long as it's not a mutable borrow. This will error:
581581

582582
```{rust,ignore}
583-
fn increment(x: &mut i32) {
584-
*x += 1;
583+
fn add_one(x: &mut i32) -> i32 {
584+
*x + 1
585585
}
586586
587587
fn main() {
588-
// If variable x is not "mut", this will not compile
589-
let mut x = Box::new(5);
588+
let x = Box::new(5);
590589
591-
increment(&mut x);
592-
increment(&mut x);
593-
println!("{}", x);
590+
println!("{}", add_one(&*x)); // error: cannot borrow immutable dereference
591+
// of `&`-pointer as mutable
594592
}
595593
```
596594

597-
Notice the signature of `increment()` requests a mutable reference.
595+
Notice we changed the signature of `add_one()` to request a mutable reference.
598596

599597
## Best practices
600598

branches/beta/src/doc/trpl/testing.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ $ echo $?
129129

130130
This is useful if you want to integrate `cargo test` into other tooling.
131131

132-
We can invert our test's failure with another attribute: `should_panic`:
132+
We can invert our test's failure with another attribute: `should_fail`:
133133

134134
```rust
135135
#[test]
136-
#[should_panic]
136+
#[should_fail]
137137
fn it_works() {
138138
assert!(false);
139139
}
@@ -163,13 +163,13 @@ equality:
163163

164164
```rust
165165
#[test]
166-
#[should_panic]
166+
#[should_fail]
167167
fn it_works() {
168168
assert_eq!("Hello", "world");
169169
}
170170
```
171171

172-
Does this test pass or fail? Because of the `should_panic` attribute, it
172+
Does this test pass or fail? Because of the `should_fail` attribute, it
173173
passes:
174174

175175
```bash
@@ -189,15 +189,15 @@ running 0 tests
189189
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
190190
```
191191

192-
`should_panic` tests can be fragile, as it's hard to guarantee that the test
192+
`should_fail` tests can be fragile, as it's hard to guarantee that the test
193193
didn't fail for an unexpected reason. To help with this, an optional `expected`
194-
parameter can be added to the `should_panic` attribute. The test harness will
194+
parameter can be added to the `should_fail` attribute. The test harness will
195195
make sure that the failure message contains the provided text. A safer version
196196
of the example above would be:
197197

198198
```
199199
#[test]
200-
#[should_panic(expected = "assertion failed")]
200+
#[should_fail(expected = "assertion failed")]
201201
fn it_works() {
202202
assert_eq!("Hello", "world");
203203
}

branches/beta/src/doc/trpl/unsafe.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ offered by the Rust language and libraries. For example, they
9393
- are plain-old-data, that is, they don't move ownership, again unlike
9494
`Box`, hence the Rust compiler cannot protect against bugs like
9595
use-after-free;
96+
- are considered sendable (if their contents is considered sendable),
97+
so the compiler offers no assistance with ensuring their use is
98+
thread-safe; for example, one can concurrently access a `*mut i32`
99+
from two threads without synchronization.
96100
- lack any form of lifetimes, unlike `&`, and so the compiler cannot
97101
reason about dangling pointers; and
98102
- have no guarantees about aliasing or mutability other than mutation

branches/beta/src/liballoc/arc.rs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -210,21 +210,6 @@ impl<T> Arc<T> {
210210
// contents.
211211
unsafe { &**self._ptr }
212212
}
213-
214-
// Non-inlined part of `drop`.
215-
#[inline(never)]
216-
unsafe fn drop_slow(&mut self) {
217-
let ptr = *self._ptr;
218-
219-
// Destroy the data at this time, even though we may not free the box allocation itself
220-
// (there may still be weak pointers lying around).
221-
drop(ptr::read(&self.inner().data));
222-
223-
if self.inner().weak.fetch_sub(1, Release) == 1 {
224-
atomic::fence(Acquire);
225-
deallocate(ptr as *mut u8, size_of::<ArcInner<T>>(), min_align_of::<ArcInner<T>>())
226-
}
227-
}
228213
}
229214

230215
/// Get the number of weak references to this value.
@@ -340,7 +325,6 @@ impl<T: Sync + Send> Drop for Arc<T> {
340325
///
341326
/// } // implicit drop
342327
/// ```
343-
#[inline]
344328
fn drop(&mut self) {
345329
// This structure has #[unsafe_no_drop_flag], so this drop glue may run more than once (but
346330
// it is guaranteed to be zeroed after the first if it's run more than once)
@@ -369,8 +353,14 @@ impl<T: Sync + Send> Drop for Arc<T> {
369353
// [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html)
370354
atomic::fence(Acquire);
371355

372-
unsafe {
373-
self.drop_slow()
356+
// Destroy the data at this time, even though we may not free the box allocation itself
357+
// (there may still be weak pointers lying around).
358+
unsafe { drop(ptr::read(&self.inner().data)); }
359+
360+
if self.inner().weak.fetch_sub(1, Release) == 1 {
361+
atomic::fence(Acquire);
362+
unsafe { deallocate(ptr as *mut u8, size_of::<ArcInner<T>>(),
363+
min_align_of::<ArcInner<T>>()) }
374364
}
375365
}
376366
}

branches/beta/src/liballoc/boxed.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ impl BoxAny for Box<Any> {
264264
}
265265
}
266266

267+
#[cfg(not(stage0))]
267268
#[stable(feature = "rust1", since = "1.0.0")]
268269
impl BoxAny for Box<Any+Send> {
269270
#[inline]

branches/beta/src/liballoc/heap.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#[cfg(stage0)]
12+
#[cfg(not(test))]
13+
use core::ptr::PtrExt;
14+
1115
// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias`
1216

1317
/// Return a pointer to `size` bytes of memory aligned to `align`.

branches/beta/src/liballoc/rc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ use core::nonzero::NonZero;
159159
use core::ops::{Deref, Drop};
160160
use core::option::Option;
161161
use core::option::Option::{Some, None};
162+
#[cfg(stage0)]
163+
use core::ptr::{self, PtrExt};
164+
#[cfg(not(stage0))]
162165
use core::ptr;
163166
use core::result::Result;
164167
use core::result::Result::{Ok, Err};

branches/beta/src/libarena/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ extern crate alloc;
4343
use std::cell::{Cell, RefCell};
4444
use std::cmp;
4545
use std::intrinsics;
46+
#[cfg(stage0)] // SNAP 270a677
47+
use std::intrinsics::{get_tydesc, TyDesc};
4648
use std::marker;
4749
use std::mem;
50+
#[cfg(stage0)]
51+
use std::num::{Int, UnsignedInt};
4852
use std::ptr;
4953
use std::rc::Rc;
5054
use std::rt::heap::{allocate, deallocate};
@@ -186,12 +190,14 @@ fn un_bitpack_tydesc_ptr(p: usize) -> (*const TyDesc, bool) {
186190
// HACK(eddyb) TyDesc replacement using a trait object vtable.
187191
// This could be replaced in the future with a custom DST layout,
188192
// or `&'static (drop_glue, size, align)` created by a `const fn`.
193+
#[cfg(not(stage0))] // SNAP 270a677
189194
struct TyDesc {
190195
drop_glue: fn(*const i8),
191196
size: usize,
192197
align: usize
193198
}
194199

200+
#[cfg(not(stage0))] // SNAP 270a677
195201
unsafe fn get_tydesc<T>() -> *const TyDesc {
196202
use std::raw::TraitObject;
197203

branches/beta/src/libcollections/btree/node.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ struct MutNodeSlice<'a, K: 'a, V: 'a> {
105105
/// Fails if `target_alignment` is not a power of two.
106106
#[inline]
107107
fn round_up_to_next(unrounded: usize, target_alignment: usize) -> usize {
108+
#[cfg(stage0)]
109+
use core::num::UnsignedInt;
110+
108111
assert!(target_alignment.is_power_of_two());
109112
(unrounded + target_alignment - 1) & !(target_alignment - 1)
110113
}

0 commit comments

Comments
 (0)