Skip to content

Commit 8d36081

Browse files
steveklabnikManishearth
authored andcommitted
---
yaml --- r: 190873 b: refs/heads/master c: 71321ff h: refs/heads/master i: 190871: 05893e9 v: v3
1 parent 54d5009 commit 8d36081

File tree

37 files changed

+111
-399
lines changed

37 files changed

+111
-399
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 0711006694a2e7e79f7fc819b3b04af016a8bf93
2+
refs/heads/master: 71321ff33fa3fe71cc1df541b3d0547b4e208923
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c64d671671aea2e44ee7fc6eb00ee75fc30ed7b9
55
refs/heads/try: 1c28ab65017d74fc13d003f7c7a73d1a48e5406f

trunk/Makefile.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@
9999
# // Having trouble figuring out which test is failing? Turn off parallel tests
100100
# make check-stage1-std RUST_TEST_THREADS=1
101101
#
102+
# This is hardly all there is to know of The Rust Build System's
103+
# mysteries. The tale continues on the wiki[1].
104+
#
105+
# [1]: https://github.com/rust-lang/rust/wiki/Note-testsuite
106+
#
102107
# If you really feel like getting your hands dirty, then:
103108
#
104109
# run `make nitty-gritty`

trunk/man/rustc.1

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -242,28 +242,6 @@ full debug info with variable and type information.
242242
\fBopt\-level\fR=\fIVAL\fR
243243
Optimize with possible levels 0\[en]3
244244

245-
.SH ENVIRONMENT VARIABLES
246-
247-
Some of these affect the output of the compiler, while others affect programs
248-
which link to the standard library.
249-
250-
.TP
251-
\fBRUST_TEST_THREADS\fR
252-
The test framework Rust provides executes tests in parallel. This variable sets
253-
the maximum number of threads used for this purpose.
254-
255-
.TP
256-
\fBRUST_TEST_NOCAPTURE\fR
257-
A synonym for the --nocapture flag.
258-
259-
.TP
260-
\fBRUST_MIN_STACK\fR
261-
Sets the minimum stack size for new threads.
262-
263-
.TP
264-
\fBRUST_BACKTRACE\fR
265-
If set, produces a backtrace in the output of a program which panics.
266-
267245
.SH "EXAMPLES"
268246
To build an executable from a source file with a main function:
269247
$ rustc \-o hello hello.rs

trunk/src/doc/trpl/ffi.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ Foreign libraries often hand off ownership of resources to the calling code.
170170
When this occurs, we must use Rust's destructors to provide safety and guarantee
171171
the release of these resources (especially in the case of panic).
172172

173-
For more about destructors, see the [Drop trait](../std/ops/trait.Drop.html).
174-
175173
# Callbacks from C code to Rust functions
176174

177175
Some external libraries require the usage of callbacks to report back their

trunk/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

trunk/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

trunk/src/libcore/num/mod.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -345,16 +345,6 @@ pub trait Int
345345

346346
/// Saturating integer addition. Computes `self + other`, saturating at
347347
/// the numeric bounds instead of overflowing.
348-
///
349-
/// # Examples
350-
///
351-
/// ```
352-
/// use std::num::Int;
353-
///
354-
/// assert_eq!(5u16.saturating_add(65534), 65535);
355-
/// assert_eq!((-5i16).saturating_add(-32767), -32768);
356-
/// assert_eq!(100u32.saturating_add(4294967294), 4294967295);
357-
/// ```
358348
#[stable(feature = "rust1", since = "1.0.0")]
359349
#[inline]
360350
fn saturating_add(self, other: Self) -> Self {
@@ -367,16 +357,6 @@ pub trait Int
367357

368358
/// Saturating integer subtraction. Computes `self - other`, saturating at
369359
/// the numeric bounds instead of overflowing.
370-
///
371-
/// # Examples
372-
///
373-
/// ```
374-
/// use std::num::Int;
375-
///
376-
/// assert_eq!(5u16.saturating_sub(65534), 0);
377-
/// assert_eq!(5i16.saturating_sub(-32767), 32767);
378-
/// assert_eq!(100u32.saturating_sub(4294967294), 0);
379-
/// ```
380360
#[stable(feature = "rust1", since = "1.0.0")]
381361
#[inline]
382362
fn saturating_sub(self, other: Self) -> Self {

trunk/src/librustc/middle/astencode.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -235,27 +235,12 @@ impl<'a, 'b, 'tcx> DecodeContext<'a, 'b, 'tcx> {
235235
pub fn tr_span(&self, span: Span) -> Span {
236236
let imported_filemaps = &self.cdata.codemap_import_info[..];
237237

238-
let span = if span.lo > span.hi {
239-
// Currently macro expansion sometimes produces invalid Span values
240-
// where lo > hi. In order not to crash the compiler when trying to
241-
// translate these values, let's transform them into something we
242-
// can handle (and which will produce useful debug locations at
243-
// least some of the time).
244-
// This workaround is only necessary as long as macro expansion is
245-
// not fixed. FIXME(#23480)
246-
codemap::mk_sp(span.lo, span.lo)
247-
} else {
248-
span
249-
};
250-
251238
let filemap_index = {
252239
// Optimize for the case that most spans within a translated item
253240
// originate from the same filemap.
254241
let last_filemap_index = self.last_filemap_index.get();
255242

256243
if span.lo >= imported_filemaps[last_filemap_index].original_start_pos &&
257-
span.lo <= imported_filemaps[last_filemap_index].original_end_pos &&
258-
span.hi >= imported_filemaps[last_filemap_index].original_start_pos &&
259244
span.hi <= imported_filemaps[last_filemap_index].original_end_pos {
260245
last_filemap_index
261246
} else {

trunk/src/librustc_back/tempdir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ impl TempDir {
6161
let path = tmpdir.join(&leaf);
6262
match fs::create_dir(&path) {
6363
Ok(_) => return Ok(TempDir { path: Some(path) }),
64-
Err(ref e) if e.kind() == ErrorKind::AlreadyExists => {}
64+
Err(ref e) if e.kind() == ErrorKind::PathAlreadyExists => {}
6565
Err(e) => return Err(e)
6666
}
6767
}
6868

69-
Err(Error::new(ErrorKind::AlreadyExists,
69+
Err(Error::new(ErrorKind::PathAlreadyExists,
7070
"too many temporary directories already exist",
7171
None))
7272
}

trunk/src/librustdoc/html/render.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -692,23 +692,16 @@ fn shortty(item: &clean::Item) -> ItemType {
692692

693693
/// Takes a path to a source file and cleans the path to it. This canonicalizes
694694
/// things like ".." to components which preserve the "top down" hierarchy of a
695-
/// static HTML tree. Each component in the cleaned path will be passed as an
696-
/// argument to `f`. The very last component of the path (ie the file name) will
697-
/// be passed to `f` if `keep_filename` is true, and ignored otherwise.
695+
/// static HTML tree.
698696
// FIXME (#9639): The closure should deal with &[u8] instead of &str
699697
// FIXME (#9639): This is too conservative, rejecting non-UTF-8 paths
700-
fn clean_srcpath<F>(src_root: &Path, p: &Path, keep_filename: bool, mut f: F) where
698+
fn clean_srcpath<F>(src_root: &Path, p: &Path, mut f: F) where
701699
F: FnMut(&str),
702700
{
703701
// make it relative, if possible
704702
let p = p.relative_from(src_root).unwrap_or(p);
705703

706-
let mut iter = p.iter().map(|x| x.to_str().unwrap()).peekable();
707-
while let Some(c) = iter.next() {
708-
if !keep_filename && iter.peek().is_none() {
709-
break;
710-
}
711-
704+
for c in p.iter().map(|x| x.to_str().unwrap()) {
712705
if ".." == c {
713706
f("up");
714707
} else {
@@ -810,7 +803,7 @@ impl<'a> SourceCollector<'a> {
810803
// Create the intermediate directories
811804
let mut cur = self.dst.clone();
812805
let mut root_path = String::from_str("../../");
813-
clean_srcpath(&self.cx.src_root, &p, false, |component| {
806+
clean_srcpath(&self.cx.src_root, &p, |component| {
814807
cur.push(component);
815808
mkdir(&cur).unwrap();
816809
root_path.push_str("../");
@@ -1375,7 +1368,7 @@ impl<'a> Item<'a> {
13751368
if ast_util::is_local(self.item.def_id) {
13761369
let mut path = Vec::new();
13771370
clean_srcpath(&cx.src_root, Path::new(&self.item.source.filename),
1378-
true, |component| {
1371+
|component| {
13791372
path.push(component.to_string());
13801373
});
13811374
let href = if self.item.source.loline == self.item.source.hiline {

trunk/src/librustdoc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#![feature(test)]
3636
#![feature(unicode)]
3737
#![feature(str_words)]
38+
#![feature(io)]
3839
#![feature(file_path)]
3940
#![feature(path_ext)]
4041
#![feature(path_relative_from)]

trunk/src/libserialize/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Core encoding and decoding interfaces.
3131
#![feature(collections)]
3232
#![feature(core)]
3333
#![feature(int_uint)]
34+
#![feature(io)]
3435
#![feature(old_path)]
3536
#![feature(rustc_private)]
3637
#![feature(staged_api)]

trunk/src/libstd/fs/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ pub struct Metadata(fs_imp::FileAttr);
7373
/// will yield instances of `io::Result<DirEntry>`. Through a `DirEntry`
7474
/// information like the entry's path and possibly other metadata can be
7575
/// learned.
76-
///
77-
/// # Failure
78-
///
79-
/// This `io::Result` will be an `Err` if there's some sort of intermittent
80-
/// IO error during iteration.
8176
#[stable(feature = "rust1", since = "1.0.0")]
8277
pub struct ReadDir(fs_imp::ReadDir);
8378

@@ -498,7 +493,7 @@ pub fn copy<P: AsPath, Q: AsPath>(from: P, to: Q) -> io::Result<u64> {
498493
let from = from.as_path();
499494
let to = to.as_path();
500495
if !from.is_file() {
501-
return Err(Error::new(ErrorKind::InvalidInput,
496+
return Err(Error::new(ErrorKind::MismatchedFileTypeForOperation,
502497
"the source path is not an existing file",
503498
None))
504499
}
@@ -1139,7 +1134,7 @@ mod tests {
11391134
let dir = &tmpdir.join("mkdir_error_twice");
11401135
check!(fs::create_dir(dir));
11411136
let e = fs::create_dir(dir).err().unwrap();
1142-
assert_eq!(e.kind(), ErrorKind::AlreadyExists);
1137+
assert_eq!(e.kind(), ErrorKind::PathAlreadyExists);
11431138
}
11441139

11451140
#[test]

trunk/src/libstd/fs/tempdir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ impl TempDir {
6868
let path = tmpdir.join(&leaf);
6969
match fs::create_dir(&path) {
7070
Ok(_) => return Ok(TempDir { path: Some(path) }),
71-
Err(ref e) if e.kind() == ErrorKind::AlreadyExists => {}
71+
Err(ref e) if e.kind() == ErrorKind::PathAlreadyExists => {}
7272
Err(e) => return Err(e)
7373
}
7474
}
7575

76-
Err(Error::new(ErrorKind::AlreadyExists,
76+
Err(Error::new(ErrorKind::PathAlreadyExists,
7777
"too many temporary directories already exist",
7878
None))
7979
}

0 commit comments

Comments
 (0)