Skip to content

Rollup of PRs in the queue; Monday #23219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Mar 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The Rust community congregates in a few places:

## Contributing

To contribute to Rust, please see [CONTRIBUTING.md](CONTRIBUTING.md).
To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md).

Rust has an [IRC] culture and most real-time collaboration happens in a
variety of channels on Mozilla's IRC network, irc.mozilla.org. The
Expand All @@ -131,4 +131,4 @@ Rust is primarily distributed under the terms of both the MIT license
and the Apache License (Version 2.0), with portions covered by various
BSD-like licenses.

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.
See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and [COPYRIGHT](COPYRIGHT) for details.
26 changes: 13 additions & 13 deletions src/doc/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,11 @@ safe concurrent programs.
Here's an example of a concurrent Rust program:

```{rust}
use std::thread::Thread;
use std::thread;

fn main() {
let guards: Vec<_> = (0..10).map(|_| {
Thread::scoped(|| {
thread::scoped(|| {
println!("Hello, world!");
})
}).collect();
Expand Down Expand Up @@ -421,16 +421,16 @@ problem.
Let's see an example. This Rust code will not compile:

```{rust,ignore}
use std::thread::Thread;
use std::thread;

fn main() {
let mut numbers = vec![1, 2, 3];

let guards: Vec<_> = (0..3).map(|i| {
Thread::scoped(move || {
thread::scoped(move || {
numbers[i] += 1;
println!("numbers[{}] is {}", i, numbers[i]);
});
})
}).collect();
}
```
Expand All @@ -439,10 +439,10 @@ It gives us this error:

```text
7:25: 10:6 error: cannot move out of captured outer variable in an `FnMut` closure
7 Thread::scoped(move || {
7 thread::scoped(move || {
8 numbers[i] += 1;
9 println!("numbers[{}] is {}", i, numbers[i]);
10 });
10 })
error: aborting due to previous error
```

Expand Down Expand Up @@ -471,19 +471,19 @@ mutation doesn't cause a data race.
Here's what using an Arc with a Mutex looks like:

```{rust}
use std::thread::Thread;
use std::thread;
use std::sync::{Arc,Mutex};

fn main() {
let numbers = Arc::new(Mutex::new(vec![1, 2, 3]));

let guards: Vec<_> = (0..3).map(|i| {
let number = numbers.clone();
Thread::scoped(move || {
thread::scoped(move || {
let mut array = number.lock().unwrap();
array[i] += 1;
println!("numbers[{}] is {}", i, array[i]);
});
})
}).collect();
}
```
Expand Down Expand Up @@ -535,15 +535,15 @@ As an example, Rust's ownership system is _entirely_ at compile time. The
safety check that makes this an error about moved values:

```{rust,ignore}
use std::thread::Thread;
use std::thread;

fn main() {
let numbers = vec![1, 2, 3];

let guards: Vec<_> = (0..3).map(|i| {
Thread::scoped(move || {
thread::scoped(move || {
println!("{}", numbers[i]);
});
})
}).collect();
}
```
Expand Down
4 changes: 0 additions & 4 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3007,10 +3007,6 @@ A type cast expression is denoted with the binary operator `as`.
Executing an `as` expression casts the value on the left-hand side to the type
on the right-hand side.

A numeric value can be cast to any numeric type. A raw pointer value can be
cast to or from any integral type or raw pointer type. Any other cast is
unsupported and will fail to compile.

An example of an `as` expression:

```
Expand Down
3 changes: 0 additions & 3 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,9 +631,6 @@ impl<'b, T> DerefMut for RefMut<'b, T> {
///
/// Types like `Cell<T>` and `RefCell<T>` use this type to wrap their internal data.
///
/// `UnsafeCell<T>` doesn't opt-out from any marker traits, instead, types with an `UnsafeCell<T>`
/// interior are expected to opt-out from those traits themselves.
///
/// # Examples
///
/// ```
Expand Down
11 changes: 3 additions & 8 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,9 @@ pub trait Copy : MarkerTrait {
/// the `sync` crate do ensure that any mutation cannot cause data
/// races. Hence these types are `Sync`.
///
/// Users writing their own types with interior mutability (or anything
/// else that is not thread-safe) should use the `NoSync` marker type
/// (from `std::marker`) to ensure that the compiler doesn't
/// consider the user-defined type to be `Sync`. Any types with
/// interior mutability must also use the `std::cell::UnsafeCell` wrapper
/// around the value(s) which can be mutated when behind a `&`
/// reference; not doing this is undefined behaviour (for example,
/// `transmute`-ing from `&T` to `&mut T` is illegal).
/// Any types with interior mutability must also use the `std::cell::UnsafeCell` wrapper around the
/// value(s) which can be mutated when behind a `&` reference; not doing this is undefined
/// behaviour (for example, `transmute`-ing from `&T` to `&mut T` is illegal).
#[stable(feature = "rust1", since = "1.0.0")]
#[lang="sync"]
#[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"]
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,7 @@ pub trait FromStrRadix {
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::Err>;
}

/// A utility function that just calls FromStrRadix::from_str_radix.
/// A utility function that just calls `FromStrRadix::from_str_radix`.
#[unstable(feature = "core", reason = "needs reevaluation")]
pub fn from_str_radix<T: FromStrRadix>(str: &str, radix: u32)
-> Result<T, T::Err> {
Expand Down
7 changes: 5 additions & 2 deletions src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ pub fn build_output_filenames(input: &Input,
// We want to toss everything after the final '.'
let dirpath = match *odir {
Some(ref d) => d.clone(),
None => PathBuf::new(".")
None => PathBuf::new("")
};

// If a crate name is present, we use it as the link name
Expand All @@ -954,8 +954,11 @@ pub fn build_output_filenames(input: &Input,
if *odir != None {
sess.warn("ignoring --out-dir flag due to -o flag.");
}

let cur_dir = Path::new("");

OutputFilenames {
out_directory: out_file.parent().unwrap().to_path_buf(),
out_directory: out_file.parent().unwrap_or(cur_dir).to_path_buf(),
out_filestem: out_file.file_stem().unwrap()
.to_str().unwrap().to_string(),
single_output_file: ofile,
Expand Down
4 changes: 4 additions & 0 deletions src/test/run-make/bare-outfile/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-include ../tools.mk

all:
$(rustc) -o foo foo.rs
12 changes: 12 additions & 0 deletions src/test/run-make/bare-outfile/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn main() {
}
4 changes: 1 addition & 3 deletions src/test/run-pass/issue-4759-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//
// ignore-lexer-test FIXME #15877

trait U { fn f(self); }
impl U for int { fn f(self) {} }
impl U for isize { fn f(self) {} }
pub fn main() { 4.f(); }
2 changes: 0 additions & 2 deletions src/test/run-pass/unsized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//
// ignore-lexer-test FIXME #15879

// Test syntax checks for `?Sized` syntax.

Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/unsized2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//
// ignore-lexer-test FIXME #15879

#![allow(unknown_features)]
#![feature(box_syntax)]
Expand Down