Skip to content

Commit b942cd4

Browse files
committed
Auto merge of #39863 - frewsxcv:rollup, r=frewsxcv
Rollup of 11 pull requests - Successful merges: #39775, #39793, #39804, #39824, #39834, #39837, #39839, #39840, #39843, #39844, #39846 - Failed merges:
2 parents 4d6019d + e7a68c9 commit b942cd4

File tree

20 files changed

+339
-86
lines changed

20 files changed

+339
-86
lines changed

configure

+1
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ opt ninja 0 "build LLVM using the Ninja generator (for MSVC, requires building i
650650
opt locked-deps 0 "force Cargo.lock to be up to date"
651651
opt vendor 0 "enable usage of vendored Rust crates"
652652
opt sanitizers 0 "build the sanitizer runtimes (asan, lsan, msan, tsan)"
653+
opt dist-src 1 "when building tarballs enables building a source tarball"
653654

654655
# Optimization and debugging options. These may be overridden by the release channel, etc.
655656
opt_nosave optimize 1 "build optimized rust code"

src/bootstrap/bin/rustc.rs

+5
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ fn main() {
205205
}
206206
}
207207
}
208+
209+
if target.contains("pc-windows-msvc") {
210+
cmd.arg("-Z").arg("unstable-options");
211+
cmd.arg("-C").arg("target-feature=+crt-static");
212+
}
208213
}
209214

210215
if verbose > 1 {

src/bootstrap/config.rs

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ pub struct Config {
7272
pub rustc_default_ar: Option<String>,
7373
pub rust_optimize_tests: bool,
7474
pub rust_debuginfo_tests: bool,
75+
pub rust_dist_src: bool,
7576

7677
pub build: String,
7778
pub host: Vec<String>,
@@ -183,6 +184,7 @@ struct Dist {
183184
sign_folder: Option<String>,
184185
gpg_password_file: Option<String>,
185186
upload_addr: Option<String>,
187+
src_tarball: Option<bool>,
186188
}
187189

188190
#[derive(RustcDecodable)]
@@ -380,6 +382,7 @@ impl Config {
380382
config.dist_sign_folder = t.sign_folder.clone().map(PathBuf::from);
381383
config.dist_gpg_password_file = t.gpg_password_file.clone().map(PathBuf::from);
382384
config.dist_upload_addr = t.upload_addr.clone();
385+
set(&mut config.rust_dist_src, t.src_tarball);
383386
}
384387

385388
return config
@@ -448,6 +451,7 @@ impl Config {
448451
("FULL_BOOTSTRAP", self.full_bootstrap),
449452
("EXTENDED", self.extended),
450453
("SANITIZERS", self.sanitizers),
454+
("DIST_SRC", self.rust_dist_src),
451455
}
452456

453457
match key {

src/bootstrap/dist.rs

+4
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@ const CARGO_VENDOR_VERSION: &'static str = "0.1.4";
364364

365365
/// Creates the `rust-src` installer component and the plain source tarball
366366
pub fn rust_src(build: &Build) {
367+
if !build.config.rust_dist_src {
368+
return
369+
}
370+
367371
println!("Dist src");
368372

369373
let name = pkgname(build, "rust-src");

src/bootstrap/native.rs

+6
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ pub fn llvm(build: &Build, target: &str) {
9999
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
100100
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
101101

102+
if target.contains("msvc") {
103+
cfg.define("LLVM_USE_CRT_DEBUG", "MT");
104+
cfg.define("LLVM_USE_CRT_RELEASE", "MT");
105+
cfg.define("LLVM_USE_CRT_RELWITHDEBINFO", "MT");
106+
}
107+
102108
if target.starts_with("i686") {
103109
cfg.define("LLVM_BUILD_32_BITS", "ON");
104110
}

src/ci/docker/dist-x86-linux/Dockerfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,9 @@ RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST |
8282
ENV HOSTS=i686-unknown-linux-gnu
8383
ENV HOSTS=$HOSTS,x86_64-unknown-linux-gnu
8484

85-
ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended --enable-sanitizers
85+
ENV RUST_CONFIGURE_ARGS \
86+
--host=$HOSTS \
87+
--enable-extended \
88+
--enable-sanitizers
8689
ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
90+
ENV DIST_SRC 1

src/ci/run.sh

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-quiet-tests"
2525
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-manage-submodules"
2626
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-locked-deps"
2727

28+
if [ "$DIST_SRC" == "" ]; then
29+
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --disable-dist-src"
30+
fi
31+
2832
# If we're deploying artifacts then we set the release channel, otherwise if
2933
# we're not deploying then we want to be sure to enable all assertions becauase
3034
# we'll be running tests

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

0 commit comments

Comments
 (0)