Skip to content

Commit

Permalink
Auto merge of #40598 - frewsxcv:rollup, r=frewsxcv
Browse files Browse the repository at this point in the history
Rollup of 23 pull requests

- Successful merges: #40387, #40433, #40452, #40456, #40457, #40458, #40463, #40466, #40467, #40495, #40496, #40497, #40499, #40500, #40503, #40505, #40512, #40514, #40517, #40520, #40536, #40545, #40586
- Failed merges:
  • Loading branch information
bors committed Mar 17, 2017
2 parents 9fae040 + 3bec563 commit a559452
Show file tree
Hide file tree
Showing 122 changed files with 1,008 additions and 705 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Expand Up @@ -20,10 +20,10 @@
url = https://github.com/rust-lang/libc.git
[submodule "src/doc/nomicon"]
path = src/doc/nomicon
url = https://github.com/rust-lang-nursery/nomicon
url = https://github.com/rust-lang-nursery/nomicon.git
[submodule "src/tools/cargo"]
path = cargo
url = https://github.com/rust-lang/cargo
url = https://github.com/rust-lang/cargo.git
[submodule "reference"]
path = src/doc/reference
url = https://github.com/rust-lang-nursery/reference.git
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -161,8 +161,9 @@ If you’d like to build the documentation, it’s almost the same:
$ ./x.py doc
```

The generated documentation will appear in a top-level `doc` directory,
created by the `make` rule.
The generated documentation will appear under `doc` in the `build` directory for
the ABI used. I.e., if the ABI was `x86_64-pc-windows-msvc`, the directory will be
`build\x86_64-pc-windows-msvc\doc`.

## Notes

Expand Down
3 changes: 1 addition & 2 deletions RELEASES.md
Expand Up @@ -4,7 +4,6 @@ Version 1.16.0 (2017-03-16)
Language
--------

* Lifetimes in statics and consts default to `'static`. [RFC 1623]
* [The compiler's `dead_code` lint now accounts for type aliases][38051].
* [Uninhabitable enums (those without any variants) no longer permit wildcard
match patterns][38069]
Expand Down Expand Up @@ -5056,7 +5055,7 @@ Version 0.1 (2012-01-20)

* Compiler works with the following configurations:
* Linux: x86 and x86_64 hosts and targets
* MacOS: x86 and x86_64 hosts and targets
* macOS: x86 and x86_64 hosts and targets
* Windows: x86 hosts and targets

* Cross compilation / multi-target configuration supported.
Expand Down
2 changes: 1 addition & 1 deletion cargo
2 changes: 1 addition & 1 deletion src/bootstrap/bin/rustc.rs
Expand Up @@ -182,7 +182,7 @@ fn main() {
if env::var("RUSTC_RPATH") == Ok("true".to_string()) {
let rpath = if target.contains("apple") {

// Note that we need to take one extra step on OSX to also pass
// Note that we need to take one extra step on macOS to also pass
// `-Wl,-instal_name,@rpath/...` to get things to work right. To
// do that we pass a weird flag to the compiler to get it to do
// so. Note that this is definitely a hack, and we should likely
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/check.rs
Expand Up @@ -176,7 +176,7 @@ pub fn compiletest(build: &Build,
cmd.arg("--docck-python").arg(build.python());

if build.config.build.ends_with("apple-darwin") {
// Force /usr/bin/python on OSX for LLDB tests because we're loading the
// Force /usr/bin/python on macOS for LLDB tests because we're loading the
// LLDB plugin's compiled module which only works with the system python
// (namely not Homebrew-installed python)
cmd.arg("--lldb-python").arg("/usr/bin/python");
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/compile.rs
Expand Up @@ -249,7 +249,7 @@ pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
cargo.env("CFG_LLVM_ROOT", s);
}
// Building with a static libstdc++ is only supported on linux right now,
// not for MSVC or OSX
// not for MSVC or macOS
if build.config.llvm_static_stdcpp &&
!target.contains("windows") &&
!target.contains("apple") {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/lib.rs
Expand Up @@ -846,7 +846,7 @@ impl Build {
.filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
.collect::<Vec<_>>();

// If we're compiling on OSX then we add a few unconditional flags
// If we're compiling on macOS then we add a few unconditional flags
// indicating that we want libc++ (more filled out than libstdc++) and
// we want to compile for 10.7. This way we can ensure that
// LLVM/jemalloc/etc are all properly compiled.
Expand Down
21 changes: 18 additions & 3 deletions src/bootstrap/native.rs
Expand Up @@ -222,9 +222,24 @@ pub fn openssl(build: &Build, target: &str) {
let tarball = out.join(&name);
if !tarball.exists() {
let tmp = tarball.with_extension("tmp");
build.run(Command::new("curl")
.arg("-o").arg(&tmp)
.arg(format!("https://www.openssl.org/source/{}", name)));
// originally from https://www.openssl.org/source/...
let url = format!("https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/{}",
name);
let mut ok = false;
for _ in 0..3 {
let status = Command::new("curl")
.arg("-o").arg(&tmp)
.arg(&url)
.status()
.expect("failed to spawn curl");
if status.success() {
ok = true;
break
}
}
if !ok {
panic!("failed to download openssl source")
}
let mut shasum = if target.contains("apple") {
let mut cmd = Command::new("shasum");
cmd.arg("-a").arg("256");
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/sanity.rs
Expand Up @@ -151,10 +151,10 @@ pub fn check(build: &mut Build) {
}

for target in build.config.target.iter() {
// Can't compile for iOS unless we're on OSX
// Can't compile for iOS unless we're on macOS
if target.contains("apple-ios") &&
!build.config.build.contains("apple-darwin") {
panic!("the iOS target is only supported on OSX");
panic!("the iOS target is only supported on macOS");
}

// Make sure musl-root is valid if specified
Expand Down
21 changes: 2 additions & 19 deletions src/doc/book/src/documentation.md
Expand Up @@ -170,8 +170,6 @@ more than one section:
# fn foo() {}
```

Let's discuss the details of these code blocks.

#### Code block annotations

To write some Rust code in a comment, use the triple graves:
Expand All @@ -183,23 +181,8 @@ To write some Rust code in a comment, use the triple graves:
# fn foo() {}
```

If you want something that's not Rust code, you can add an annotation:

```rust
/// ```c
/// printf("Hello, world\n");
/// ```
# fn foo() {}
```

This will highlight according to whatever language you're showing off.
If you're only showing plain text, choose `text`.

It's important to choose the correct annotation here, because `rustdoc` uses it
in an interesting way: It can be used to actually test your examples in a
library crate, so that they don't get out of date. If you have some C code but
`rustdoc` thinks it's Rust because you left off the annotation, `rustdoc` will
complain when trying to generate the documentation.
This will add code highlighting. If you are only showing plain text, put `text`
instead of `rust` after the triple graves (see below).

## Documentation as tests

Expand Down
8 changes: 4 additions & 4 deletions src/doc/book/src/ffi.md
Expand Up @@ -687,7 +687,7 @@ attribute turns off Rust's name mangling, so that it is easier to link to.

It’s important to be mindful of `panic!`s when working with FFI. A `panic!`
across an FFI boundary is undefined behavior. If you’re writing code that may
panic, you should run it in a closure with [`catch_unwind()`]:
panic, you should run it in a closure with [`catch_unwind`]:

```rust
use std::panic::catch_unwind;
Expand All @@ -706,11 +706,11 @@ pub extern fn oh_no() -> i32 {
fn main() {}
```

Please note that [`catch_unwind()`] will only catch unwinding panics, not
those who abort the process. See the documentation of [`catch_unwind()`]
Please note that [`catch_unwind`] will only catch unwinding panics, not
those who abort the process. See the documentation of [`catch_unwind`]
for more information.

[`catch_unwind()`]: ../std/panic/fn.catch_unwind.html
[`catch_unwind`]: ../std/panic/fn.catch_unwind.html

# Representing opaque structs

Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/src/guessing-game.md
Expand Up @@ -217,7 +217,7 @@ The next part will use this handle to get input from the user:
.read_line(&mut guess)
```

Here, we call the [`read_line()`][read_line] method on our handle.
Here, we call the [`read_line`][read_line] method on our handle.
[Methods][method] are like associated functions, but are only available on a
particular instance of a type, rather than the type itself. We’re also passing
one argument to `read_line()`: `&mut guess`.
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/src/testing.md
Expand Up @@ -147,7 +147,7 @@ And that's reflected in the summary line:
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
```

We also get a non-zero status code. We can use `$?` on OS X and Linux:
We also get a non-zero status code. We can use `$?` on macOS and Linux:

```bash
$ echo $?
Expand Down
6 changes: 3 additions & 3 deletions src/doc/index.md
Expand Up @@ -11,18 +11,18 @@ Other unofficial documentation may exist elsewhere; for example, the [Rust
Learning] project collects documentation from the community, and [Docs.rs]
builds documentation for individual Rust packages.

## API Documentation
# API Documentation

Rust provides a standard library with a number of features; [we host its
documentation here][api].

## Extended Error Documentation
# Extended Error Documentation

Many of Rust's errors come with error codes, and you can request extended
diagnostics from the compiler on those errors. We also [have the text of those
extended errors on the web][err], if you prefer to read them that way.

## The Rust Bookshelf
# The Rust Bookshelf

Rust provides a number of book-length sets of documentation, collectively
nicknamed 'The Rust Bookshelf.'
Expand Down
1 change: 1 addition & 0 deletions src/doc/unstable-book/src/SUMMARY.md
Expand Up @@ -75,6 +75,7 @@
- [simd](simd.md)
- [simd_ffi](simd-ffi.md)
- [slice_patterns](slice-patterns.md)
- [sort_unstable](sort-unstable.md)
- [specialization](specialization.md)
- [staged_api](staged-api.md)
- [start](start.md)
Expand Down
12 changes: 12 additions & 0 deletions src/doc/unstable-book/src/concat-idents.md
Expand Up @@ -6,5 +6,17 @@ The tracking issue for this feature is: [#29599]

------------------------

The `concat_idents` feature adds a macro for concatenating multiple identifiers
into one identifier.

## Examples

```rust
#![feature(concat_idents)]

fn main() {
fn foobar() -> u32 { 23 }
let f = concat_idents!(foo, bar);
assert_eq!(f(), 23);
}
```
56 changes: 56 additions & 0 deletions src/doc/unstable-book/src/conservative-impl-trait.md
Expand Up @@ -6,5 +6,61 @@ The tracking issue for this feature is: [#34511]

------------------------

The `conservative_impl_trait` feature allows a conservative form of abstract
return types.

Abstract return types allow a function to hide a concrete return type behind a
trait interface similar to trait objects, while still generating the same
statically dispatched code as with concrete types.

## Examples

```rust
#![feature(conservative_impl_trait)]

fn even_iter() -> impl Iterator<Item=u32> {
(0..).map(|n| n * 2)
}

fn main() {
let first_four_even_numbers = even_iter().take(4).collect::<Vec<_>>();
assert_eq!(first_four_even_numbers, vec![0, 2, 4, 6]);
}
```

## Background

In today's Rust, you can write function signatures like:

````rust,ignore
fn consume_iter_static<I: Iterator<u8>>(iter: I) { }
fn consume_iter_dynamic(iter: Box<Iterator<u8>>) { }
````

In both cases, the function does not depend on the exact type of the argument.
The type held is "abstract", and is assumed only to satisfy a trait bound.

* In the `_static` version using generics, each use of the function is
specialized to a concrete, statically-known type, giving static dispatch,
inline layout, and other performance wins.
* In the `_dynamic` version using trait objects, the concrete argument type is
only known at runtime using a vtable.

On the other hand, while you can write:

````rust,ignore
fn produce_iter_dynamic() -> Box<Iterator<u8>> { }
````

...but you _cannot_ write something like:

````rust,ignore
fn produce_iter_static() -> Iterator<u8> { }
````

That is, in today's Rust, abstract return types can only be written using trait
objects, which can be a significant performance penalty. This RFC proposes
"unboxed abstract types" as a way of achieving signatures like
`produce_iter_static`. Like generics, unboxed abstract types guarantee static
dispatch and inline data layout.
19 changes: 19 additions & 0 deletions src/doc/unstable-book/src/const-fn.md
Expand Up @@ -6,5 +6,24 @@ The tracking issue for this feature is: [#24111]

------------------------

The `const_fn` feature allows marking free functions and inherent methods as
`const`, enabling them to be called in constants contexts, with constant
arguments.

## Examples

```rust
#![feature(const_fn)]

const fn double(x: i32) -> i32 {
x * 2
}

const FIVE: i32 = 5;
const TEN: i32 = double(FIVE);

fn main() {
assert_eq!(5, FIVE);
assert_eq!(10, TEN);
}
```
9 changes: 9 additions & 0 deletions src/doc/unstable-book/src/const-indexing.md
Expand Up @@ -6,5 +6,14 @@ The tracking issue for this feature is: [#29947]

------------------------

The `const_indexing` feature allows the constant evaluation of index operations
on constant arrays and repeat expressions.

## Examples

```rust
#![feature(const_indexing)]

const ARR: [usize; 5] = [1, 2, 3, 4, 5];
const ARR2: [usize; ARR[1]] = [42, 99];
```
15 changes: 15 additions & 0 deletions src/doc/unstable-book/src/i128-type.md
Expand Up @@ -6,5 +6,20 @@ The tracking issue for this feature is: [#35118]

------------------------

The `i128_type` feature adds support for 128 bit signed and unsigned integer
types.

```rust
#![feature(i128_type)]

fn main() {
assert_eq!(1u128 + 1u128, 2u128);
assert_eq!(u128::min_value(), 0);
assert_eq!(u128::max_value(), 340282366920938463463374607431768211455);

assert_eq!(1i128 - 2i128, -1i128);
assert_eq!(i128::min_value(), -170141183460469231731687303715884105728);
assert_eq!(i128::max_value(), 170141183460469231731687303715884105727);
}
```

8 changes: 8 additions & 0 deletions src/doc/unstable-book/src/non-ascii-idents.md
Expand Up @@ -6,5 +6,13 @@ The tracking issue for this feature is: [#28979]

------------------------

The `non_ascii_idents` feature adds support for non-ASCII identifiers.

## Examples

```rust
#![feature(non_ascii_idents)]

const ε: f64 = 0.00001f64;
const Π: f64 = 3.14f64;
```
9 changes: 9 additions & 0 deletions src/doc/unstable-book/src/sort-unstable.md
@@ -0,0 +1,9 @@
# `sort_unstable`

The tracking issue for this feature is: [#40585]

[#40585]: https://github.com/rust-lang/rust/issues/40585

------------------------


0 comments on commit a559452

Please sign in to comment.