Skip to content
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

Rollup of 12 pull requests #39876

Merged
merged 25 commits into from
Feb 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
51a2e2f
Allow more Cell methods for non-Copy types
RalfJung Feb 13, 2017
044ed10
Remove Copy bound from some Cell trait impls
RalfJung Feb 14, 2017
ca54fc7
Show five traits implementation in help when there are exactly five
seppo0010 Feb 14, 2017
e3384e0
fix types in to_owned doctest
durka Feb 15, 2017
5156ded
make doc consistent with var name
king6cong Feb 15, 2017
a8b7b28
Vec, LinkedList, VecDeque, String, and Option NatVis visualizations
AndrewGaspar Feb 15, 2017
938fed7
Update procedural-macros.md
DaseinPhaos Feb 15, 2017
b821313
sys/mod doc update and mod import order adjust
king6cong Feb 15, 2017
577497b
Fix typo
comonadd Feb 15, 2017
b6a1618
book: don’t use GNU extensions in the example unnecessarily
mina86 Feb 13, 2017
cf20d8e
static recursion test added to compile-fail test suite
cseale Feb 15, 2017
087c233
use bash when invoking dist shell scripts on solaris
binarycrusader Feb 15, 2017
d5a4db3
Fix parameter to GetUserProfileDirectoryW
retep998 Feb 15, 2017
ef45eca
Rollup merge of #39775 - mina86:master, r=steveklabnik
frewsxcv Feb 16, 2017
3f95303
Rollup merge of #39793 - RalfJung:cell, r=alexcrichton
frewsxcv Feb 16, 2017
01ccaa3
Rollup merge of #39804 - seppo0010:recommend-five-traits, r=jonathand…
frewsxcv Feb 16, 2017
4a07be3
Rollup merge of #39834 - cseale:feature-gate-static-recursion, r=est31
frewsxcv Feb 16, 2017
46564d4
Rollup merge of #39836 - durka:patch-37, r=alexcrichton
frewsxcv Feb 16, 2017
35bf74b
Rollup merge of #39839 - king6cong:refine-doc, r=frewsxcv
frewsxcv Feb 16, 2017
ce9b478
Rollup merge of #39840 - DaseinPhaos:patch-2, r=frewsxcv
frewsxcv Feb 16, 2017
a6b1c13
Rollup merge of #39843 - AndrewGaspar:natvis, r=brson
frewsxcv Feb 16, 2017
12f3e45
Rollup merge of #39844 - king6cong:sys, r=alexcrichton
frewsxcv Feb 16, 2017
23e2d2f
Rollup merge of #39846 - WRONGWAY4YOU:typo-fix, r=frewsxcv
frewsxcv Feb 16, 2017
88f40f7
Rollup merge of #39857 - binarycrusader:master, r=alexcrichton
frewsxcv Feb 16, 2017
c6edfdb
Rollup merge of #39861 - retep998:small-fix, r=alexcrichton
frewsxcv Feb 16, 2017
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
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