Skip to content

Commit

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

- Successful merges: #39775, #39793, #39804, #39834, #39836, #39839, #39840, #39843, #39844, #39846, #39857, #39861
- Failed merges:
  • Loading branch information
bors committed Feb 16, 2017
2 parents 1b6f1fe + c6edfdb commit d77af7f
Show file tree
Hide file tree
Showing 16 changed files with 329 additions and 97 deletions.
21 changes: 14 additions & 7 deletions src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ use std::process::{Command, Stdio};

use build_helper::output;

#[cfg(not(target_os = "solaris"))]
const SH_CMD: &'static str = "sh";
// On Solaris, sh is the historical bourne shell, not a POSIX shell, or bash.
#[cfg(target_os = "solaris")]
const SH_CMD: &'static str = "bash";

use {Build, Compiler, Mode};
use util::{cp_r, libdir, is_dylib, cp_filtered, copy};

Expand Down Expand Up @@ -69,7 +75,7 @@ pub fn docs(build: &Build, stage: u32, host: &str) {
let src = build.out.join(host).join("doc");
cp_r(&src, &dst);

let mut cmd = Command::new("sh");
let mut cmd = Command::new(SH_CMD);
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
.arg("--product-name=Rust-Documentation")
.arg("--rel-manifest-dir=rustlib")
Expand Down Expand Up @@ -119,7 +125,7 @@ pub fn mingw(build: &Build, host: &str) {
.arg(host);
build.run(&mut cmd);

let mut cmd = Command::new("sh");
let mut cmd = Command::new(SH_CMD);
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
.arg("--product-name=Rust-MinGW")
.arg("--rel-manifest-dir=rustlib")
Expand Down Expand Up @@ -185,7 +191,7 @@ pub fn rustc(build: &Build, stage: u32, host: &str) {
}

// Finally, wrap everything up in a nice tarball!
let mut cmd = Command::new("sh");
let mut cmd = Command::new(SH_CMD);
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
.arg("--product-name=Rust")
.arg("--rel-manifest-dir=rustlib")
Expand Down Expand Up @@ -290,7 +296,7 @@ pub fn std(build: &Build, compiler: &Compiler, target: &str) {
let src = build.sysroot(compiler).join("lib/rustlib");
cp_r(&src.join(target), &dst);

let mut cmd = Command::new("sh");
let mut cmd = Command::new(SH_CMD);
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
.arg("--product-name=Rust")
.arg("--rel-manifest-dir=rustlib")
Expand Down Expand Up @@ -343,9 +349,10 @@ pub fn analysis(build: &Build, compiler: &Compiler, target: &str) {
let image_src = src.join("save-analysis");
let dst = image.join("lib/rustlib").join(target).join("analysis");
t!(fs::create_dir_all(&dst));
println!("image_src: {:?}, dst: {:?}", image_src, dst);
cp_r(&image_src, &dst);

let mut cmd = Command::new("sh");
let mut cmd = Command::new(SH_CMD);
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
.arg("--product-name=Rust")
.arg("--rel-manifest-dir=rustlib")
Expand Down Expand Up @@ -452,7 +459,7 @@ pub fn rust_src(build: &Build) {
build.run(&mut cmd);

// Create source tarball in rust-installer format
let mut cmd = Command::new("sh");
let mut cmd = Command::new(SH_CMD);
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))
.arg("--product-name=Rust")
.arg("--rel-manifest-dir=rustlib")
Expand Down Expand Up @@ -610,7 +617,7 @@ pub fn extended(build: &Build, stage: u32, target: &str) {
input_tarballs.push_str(&sanitize_sh(&mingw_installer));
}

let mut cmd = Command::new("sh");
let mut cmd = Command::new(SH_CMD);
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/combine-installers.sh")))
.arg("--product-name=Rust")
.arg("--rel-manifest-dir=rustlib")
Expand Down
14 changes: 6 additions & 8 deletions src/doc/book/src/macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,36 +261,34 @@ The metavariable `$x` is parsed as a single expression node, and keeps its
place in the syntax tree even after substitution.

Another common problem in macro systems is ‘variable capture’. Here’s a C
macro, using [a GNU C extension] to emulate Rust’s expression blocks.

[a GNU C extension]: https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
macro using a block with multiple statements.

```text
#define LOG(msg) ({ \
#define LOG(msg) do { \
int state = get_log_state(); \
if (state > 0) { \
printf("log(%d): %s\n", state, msg); \
} \
})
} while (0)
```

Here’s a simple use case that goes terribly wrong:

```text
const char *state = "reticulating splines";
LOG(state)
LOG(state);
```

This expands to

```text
const char *state = "reticulating splines";
{
do {
int state = get_log_state();
if (state > 0) {
printf("log(%d): %s\n", state, state);
}
}
} while (0);
```

The second variable named `state` shadows the first one. This is a problem
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book/src/procedural-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ created, we'll add it to our toml:
hello-world-derive = { path = "hello-world-derive" }
```

As for our the source of our `hello-world-derive` crate, here's an example:
As for the source of our `hello-world-derive` crate, here's an example:

```rust,ignore
extern crate proc_macro;
Expand Down
56 changes: 56 additions & 0 deletions src/etc/natvis/libcollections.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="collections::vec::Vec&lt;*&gt;">
    <DisplayString>{{ size={len} }}</DisplayString>
    <Expand>
<Item Name="[size]" ExcludeView="simple">len</Item>
<Item Name="[capacity]" ExcludeView="simple">buf.cap</Item>
<ArrayItems>
<Size>len</Size>
<ValuePointer>buf.ptr.pointer.__0</ValuePointer>
</ArrayItems>
    </Expand>
  </Type>
<Type Name="collections::vec_deque::VecDeque&lt;*&gt;">
<DisplayString>{{ size={tail &lt;= head ? head - tail : buf.cap - tail + head} }}</DisplayString>
<Expand>
<Item Name="[size]" ExcludeView="simple">tail &lt;= head ? head - tail : buf.cap - tail + head</Item>
<Item Name="[capacity]" ExcludeView="simple">buf.cap</Item>
<CustomListItems>
<Variable Name="i" InitialValue="tail" />

<Size>tail &lt;= head ? head - tail : buf.cap - tail + head</Size>
<Loop>
<If Condition="i == head">
<Break/>
</If>
<Item>buf.ptr.pointer.__0 + i</Item>
<Exec>i = (i + 1 == buf.cap ? 0 : i + 1)</Exec>
</Loop>
</CustomListItems>
</Expand>
</Type>
<Type Name="collections::linked_list::LinkedList&lt;*&gt;">
<DisplayString>{{ size={len} }}</DisplayString>
<Expand>
<LinkedListItems>
<Size>len</Size>
<HeadPointer>*(collections::linked_list::Node&lt;$T1&gt; **)&amp;head</HeadPointer>
<NextPointer>*(collections::linked_list::Node&lt;$T1&gt; **)&amp;next</NextPointer>
<ValueNode>element</ValueNode>
</LinkedListItems>
</Expand>
</Type>
<Type Name="collections::string::String">
<DisplayString>{*(char**)this,[vec.len]}</DisplayString>
<StringView>*(char**)this,[vec.len]</StringView>
<Expand>
<Item Name="[size]" ExcludeView="simple">vec.len</Item>
<Item Name="[capacity]" ExcludeView="simple">vec.buf.cap</Item>
<ArrayItems>
<Size>vec.len</Size>
<ValuePointer>*(char**)this</ValuePointer>
</ArrayItems>
</Expand>
</Type>
</AutoVisualizer>
39 changes: 39 additions & 0 deletions src/etc/natvis/libcore.natvis
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="core::ptr::Unique&lt;*&gt;">
<DisplayString>{{ Unique {*pointer.__0} }}</DisplayString>
<Expand>
<Item Name="[ptr]">pointer.__0</Item>
</Expand>
</Type>
<Type Name="core::ptr::Shared&lt;*&gt;">
<DisplayString>{{ Shared {*pointer.__0} }}</DisplayString>
<Expand>
<Item Name="[ptr]">pointer.__0</Item>
</Expand>
</Type>
<Type Name="core::option::Option&lt;*&gt;">
<DisplayString Condition="RUST$ENUM$DISR == 0x0">{{ None }}</DisplayString>
<DisplayString Condition="RUST$ENUM$DISR == 0x1">{{ Some {__0} }}</DisplayString>
<Expand>
<Item Name="[size]" ExcludeView="simple">(ULONG)(RUST$ENUM$DISR != 0)</Item>
<Item Name="[value]" ExcludeView="simple">__0</Item>
<ArrayItems>
<Size>(ULONG)(RUST$ENUM$DISR != 0)</Size>
<ValuePointer>&amp;__0</ValuePointer>
</ArrayItems>
</Expand>
</Type>
<Type Name="core::option::Option&lt;*&gt;" Priority="MediumLow">
<DisplayString Condition="*(PVOID *)this == nullptr">{{ None }}</DisplayString>
<DisplayString>{{ Some {($T1 *)this} }}</DisplayString>
<Expand>
<Item Name="[size]" ExcludeView="simple">(ULONG)(*(PVOID *)this != nullptr)</Item>
<Item Name="[value]" ExcludeView="simple" Condition="*(PVOID *)this != nullptr">($T1 *)this</Item>
<ArrayItems>
<Size>(ULONG)(*(PVOID *)this != nullptr)</Size>
<ValuePointer>($T1 *)this</ValuePointer>
</ArrayItems>
</Expand>
</Type>
</AutoVisualizer>
6 changes: 3 additions & 3 deletions src/grammar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The build of the rust part is included with `make tidy` and can be run with `mak

# Manual build

To use manually, assuming antlr4 ist installed at `/usr/share/java/antlr-complete.jar`:
To use manually, assuming antlr4 is installed at `/usr/share/java/antlr-complete.jar`:

```
antlr4 RustLexer.g4
Expand All @@ -20,8 +20,8 @@ for file in ../*/**.rs; do
done
```

Note That the `../*/**.rs` glob will match every `*.rs` file in the above
directory and all of its recursive children. This is a zsh extension.
Note that the `../*/**.rs` glob will match every `*.rs` file in the above
directory and all of its recursive children. This is a Zsh extension.


## Cleanup
Expand Down
8 changes: 4 additions & 4 deletions src/libcollections/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ pub trait ToOwned {
/// Basic usage:
///
/// ```
/// let s = "a"; // &str
/// let ss = s.to_owned(); // String
/// let s: &str = "a";
/// let ss: String = s.to_owned();
///
/// let v = &[1, 2]; // slice
/// let vv = v.to_owned(); // Vec
/// let v: &[i32] = &[1, 2];
/// let vv: Vec<i32> = v.to_owned();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
fn to_owned(&self) -> Self::Owned;
Expand Down
Loading

0 comments on commit d77af7f

Please sign in to comment.