Skip to content

Commit d77af7f

Browse files
committed
Auto merge of #39876 - frewsxcv:rollup, r=frewsxcv
Rollup of 12 pull requests - Successful merges: #39775, #39793, #39804, #39834, #39836, #39839, #39840, #39843, #39844, #39846, #39857, #39861 - Failed merges:
2 parents 1b6f1fe + c6edfdb commit d77af7f

File tree

16 files changed

+329
-97
lines changed

16 files changed

+329
-97
lines changed

src/bootstrap/dist.rs

+14-7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ use std::process::{Command, Stdio};
2626

2727
use build_helper::output;
2828

29+
#[cfg(not(target_os = "solaris"))]
30+
const SH_CMD: &'static str = "sh";
31+
// On Solaris, sh is the historical bourne shell, not a POSIX shell, or bash.
32+
#[cfg(target_os = "solaris")]
33+
const SH_CMD: &'static str = "bash";
34+
2935
use {Build, Compiler, Mode};
3036
use util::{cp_r, libdir, is_dylib, cp_filtered, copy};
3137

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

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

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

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

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

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

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

613-
let mut cmd = Command::new("sh");
620+
let mut cmd = Command::new(SH_CMD);
614621
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/combine-installers.sh")))
615622
.arg("--product-name=Rust")
616623
.arg("--rel-manifest-dir=rustlib")

src/doc/book/src/macros.md

+6-8
Original file line numberDiff line numberDiff line change
@@ -261,36 +261,34 @@ The metavariable `$x` is parsed as a single expression node, and keeps its
261261
place in the syntax tree even after substitution.
262262

263263
Another common problem in macro systems is ‘variable capture’. Here’s a C
264-
macro, using [a GNU C extension] to emulate Rust’s expression blocks.
265-
266-
[a GNU C extension]: https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
264+
macro using a block with multiple statements.
267265

268266
```text
269-
#define LOG(msg) ({ \
267+
#define LOG(msg) do { \
270268
int state = get_log_state(); \
271269
if (state > 0) { \
272270
printf("log(%d): %s\n", state, msg); \
273271
} \
274-
})
272+
} while (0)
275273
```
276274

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

279277
```text
280278
const char *state = "reticulating splines";
281-
LOG(state)
279+
LOG(state);
282280
```
283281

284282
This expands to
285283

286284
```text
287285
const char *state = "reticulating splines";
288-
{
286+
do {
289287
int state = get_log_state();
290288
if (state > 0) {
291289
printf("log(%d): %s\n", state, state);
292290
}
293-
}
291+
} while (0);
294292
```
295293

296294
The second variable named `state` shadows the first one. This is a problem

src/doc/book/src/procedural-macros.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ created, we'll add it to our toml:
9999
hello-world-derive = { path = "hello-world-derive" }
100100
```
101101

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

104104
```rust,ignore
105105
extern crate proc_macro;

src/etc/natvis/libcollections.natvis

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
3+
<Type Name="collections::vec::Vec&lt;*&gt;">
4+
    <DisplayString>{{ size={len} }}</DisplayString>
5+
    <Expand>
6+
<Item Name="[size]" ExcludeView="simple">len</Item>
7+
<Item Name="[capacity]" ExcludeView="simple">buf.cap</Item>
8+
<ArrayItems>
9+
<Size>len</Size>
10+
<ValuePointer>buf.ptr.pointer.__0</ValuePointer>
11+
</ArrayItems>
12+
    </Expand>
13+
  </Type>
14+
<Type Name="collections::vec_deque::VecDeque&lt;*&gt;">
15+
<DisplayString>{{ size={tail &lt;= head ? head - tail : buf.cap - tail + head} }}</DisplayString>
16+
<Expand>
17+
<Item Name="[size]" ExcludeView="simple">tail &lt;= head ? head - tail : buf.cap - tail + head</Item>
18+
<Item Name="[capacity]" ExcludeView="simple">buf.cap</Item>
19+
<CustomListItems>
20+
<Variable Name="i" InitialValue="tail" />
21+
22+
<Size>tail &lt;= head ? head - tail : buf.cap - tail + head</Size>
23+
<Loop>
24+
<If Condition="i == head">
25+
<Break/>
26+
</If>
27+
<Item>buf.ptr.pointer.__0 + i</Item>
28+
<Exec>i = (i + 1 == buf.cap ? 0 : i + 1)</Exec>
29+
</Loop>
30+
</CustomListItems>
31+
</Expand>
32+
</Type>
33+
<Type Name="collections::linked_list::LinkedList&lt;*&gt;">
34+
<DisplayString>{{ size={len} }}</DisplayString>
35+
<Expand>
36+
<LinkedListItems>
37+
<Size>len</Size>
38+
<HeadPointer>*(collections::linked_list::Node&lt;$T1&gt; **)&amp;head</HeadPointer>
39+
<NextPointer>*(collections::linked_list::Node&lt;$T1&gt; **)&amp;next</NextPointer>
40+
<ValueNode>element</ValueNode>
41+
</LinkedListItems>
42+
</Expand>
43+
</Type>
44+
<Type Name="collections::string::String">
45+
<DisplayString>{*(char**)this,[vec.len]}</DisplayString>
46+
<StringView>*(char**)this,[vec.len]</StringView>
47+
<Expand>
48+
<Item Name="[size]" ExcludeView="simple">vec.len</Item>
49+
<Item Name="[capacity]" ExcludeView="simple">vec.buf.cap</Item>
50+
<ArrayItems>
51+
<Size>vec.len</Size>
52+
<ValuePointer>*(char**)this</ValuePointer>
53+
</ArrayItems>
54+
</Expand>
55+
</Type>
56+
</AutoVisualizer>

src/etc/natvis/libcore.natvis

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
3+
<Type Name="core::ptr::Unique&lt;*&gt;">
4+
<DisplayString>{{ Unique {*pointer.__0} }}</DisplayString>
5+
<Expand>
6+
<Item Name="[ptr]">pointer.__0</Item>
7+
</Expand>
8+
</Type>
9+
<Type Name="core::ptr::Shared&lt;*&gt;">
10+
<DisplayString>{{ Shared {*pointer.__0} }}</DisplayString>
11+
<Expand>
12+
<Item Name="[ptr]">pointer.__0</Item>
13+
</Expand>
14+
</Type>
15+
<Type Name="core::option::Option&lt;*&gt;">
16+
<DisplayString Condition="RUST$ENUM$DISR == 0x0">{{ None }}</DisplayString>
17+
<DisplayString Condition="RUST$ENUM$DISR == 0x1">{{ Some {__0} }}</DisplayString>
18+
<Expand>
19+
<Item Name="[size]" ExcludeView="simple">(ULONG)(RUST$ENUM$DISR != 0)</Item>
20+
<Item Name="[value]" ExcludeView="simple">__0</Item>
21+
<ArrayItems>
22+
<Size>(ULONG)(RUST$ENUM$DISR != 0)</Size>
23+
<ValuePointer>&amp;__0</ValuePointer>
24+
</ArrayItems>
25+
</Expand>
26+
</Type>
27+
<Type Name="core::option::Option&lt;*&gt;" Priority="MediumLow">
28+
<DisplayString Condition="*(PVOID *)this == nullptr">{{ None }}</DisplayString>
29+
<DisplayString>{{ Some {($T1 *)this} }}</DisplayString>
30+
<Expand>
31+
<Item Name="[size]" ExcludeView="simple">(ULONG)(*(PVOID *)this != nullptr)</Item>
32+
<Item Name="[value]" ExcludeView="simple" Condition="*(PVOID *)this != nullptr">($T1 *)this</Item>
33+
<ArrayItems>
34+
<Size>(ULONG)(*(PVOID *)this != nullptr)</Size>
35+
<ValuePointer>($T1 *)this</ValuePointer>
36+
</ArrayItems>
37+
</Expand>
38+
</Type>
39+
</AutoVisualizer>

src/grammar/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The build of the rust part is included with `make tidy` and can be run with `mak
88

99
# Manual build
1010

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

1313
```
1414
antlr4 RustLexer.g4
@@ -20,8 +20,8 @@ for file in ../*/**.rs; do
2020
done
2121
```
2222

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

2626

2727
## Cleanup

src/libcollections/borrow.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ pub trait ToOwned {
5252
/// Basic usage:
5353
///
5454
/// ```
55-
/// let s = "a"; // &str
56-
/// let ss = s.to_owned(); // String
55+
/// let s: &str = "a";
56+
/// let ss: String = s.to_owned();
5757
///
58-
/// let v = &[1, 2]; // slice
59-
/// let vv = v.to_owned(); // Vec
58+
/// let v: &[i32] = &[1, 2];
59+
/// let vv: Vec<i32> = v.to_owned();
6060
/// ```
6161
#[stable(feature = "rust1", since = "1.0.0")]
6262
fn to_owned(&self) -> Self::Owned;

0 commit comments

Comments
 (0)