Skip to content

Commit 003382e

Browse files
committed
Auto merge of rust-lang#59513 - Centril:rollup, r=Centril
Rollup of 11 pull requests Successful merges: - rust-lang#58019 (Combine all builtin late lints and make lint checking parallel) - rust-lang#59358 (Use `track_errors` instead of hand rolling) - rust-lang#59394 (warn -> deny duplicate match bindings) - rust-lang#59401 (bootstrap: build crates under libtest with -Z emit-stack-sizes) - rust-lang#59423 (Visit path in `walk_mac`) - rust-lang#59468 (musl: build toolchain libs with -fPIC) - rust-lang#59476 (Use `SmallVec` in `TokenStreamBuilder`.) - rust-lang#59496 (Remove unnecessary with_globals calls) - rust-lang#59498 (Use 'write_all' instead of 'write' in example code) - rust-lang#59503 (Stablize {f32,f64}::copysign().) - rust-lang#59511 (Fix missed fn rename in rust-lang#59284) Failed merges: r? @ghost
2 parents 4fec737 + 456fa39 commit 003382e

File tree

22 files changed

+472
-317
lines changed

22 files changed

+472
-317
lines changed

src/bootstrap/bin/rustc.rs

+27
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,33 @@ fn main() {
181181
cmd.arg("-C").arg(format!("debug-assertions={}", debug_assertions));
182182
}
183183

184+
// Build all crates in the `std` facade with `-Z emit-stack-sizes` to add stack usage
185+
// information.
186+
//
187+
// When you use this `-Z` flag with Cargo you get stack usage information on all crates
188+
// compiled from source, and when you are using LTO you also get information on pre-compiled
189+
// crates like `core` and `std`, even if they were not compiled with `-Z emit-stack-sizes`.
190+
// However, there's an exception: `compiler_builtins`. This crate is special and doesn't
191+
// participate in LTO because it's always linked as a separate object file. For this reason
192+
// it's impossible to get stack usage information about `compiler-builtins` using
193+
// `RUSTFLAGS` + Cargo, or `cargo rustc`.
194+
//
195+
// To make the stack usage information of all crates under the `std` facade available to
196+
// Cargo based stack usage analysis tools, in both LTO and non-LTO mode, we compile them
197+
// with the `-Z emit-stack-sizes` flag. The `RUSTC_EMIT_STACK_SIZES` var helps us apply this
198+
// flag only to the crates in the `std` facade. The `-Z` flag is known to currently work
199+
// with targets that produce ELF files so we limit its use flag to those targets.
200+
//
201+
// NOTE(japaric) if this ever causes problem with an LLVM upgrade or any PR feel free to
202+
// remove it or comment it out
203+
if env::var_os("RUSTC_EMIT_STACK_SIZES").is_some()
204+
&& (target.contains("-linux-")
205+
|| target.contains("-none-eabi")
206+
|| target.ends_with("-none-elf"))
207+
{
208+
cmd.arg("-Zemit-stack-sizes");
209+
}
210+
184211
if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
185212
cmd.arg("-C").arg(format!("codegen-units={}", s));
186213
}

src/bootstrap/compile.rs

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ impl Step for Std {
9797
let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage));
9898
builder.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage,
9999
&compiler.host, target));
100+
// compile with `-Z emit-stack-sizes`; see bootstrap/src/rustc.rs for more details
101+
cargo.env("RUSTC_EMIT_STACK_SIZES", "1");
100102
run_cargo(builder,
101103
&mut cargo,
102104
&libstd_stamp(builder, compiler, target),
@@ -382,6 +384,8 @@ impl Step for Test {
382384
let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage));
383385
builder.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage,
384386
&compiler.host, target));
387+
// compile with `-Z emit-stack-sizes`; see bootstrap/src/rustc.rs for more details
388+
cargo.env("RUSTC_EMIT_STACK_SIZES", "1");
385389
run_cargo(builder,
386390
&mut cargo,
387391
&libtest_stamp(builder, compiler, target),

src/ci/docker/scripts/musl-toolchain.sh

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ TARGET=$ARCH-linux-musl
2929
OUTPUT=/usr/local
3030
shift
3131

32+
# Ancient binutils versions don't understand debug symbols produced by more recent tools.
33+
# Apparently applying `-fPIC` everywhere allows them to link successfully.
34+
export CFLAGS="-fPIC $CFLAGS"
35+
3236
git clone https://github.com/richfelker/musl-cross-make -b v0.9.7
3337
cd musl-cross-make
3438

src/librustc/lint/builtin.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ declare_lint! {
354354

355355
declare_lint! {
356356
pub DUPLICATE_MATCHER_BINDING_NAME,
357-
Warn,
357+
Deny,
358358
"duplicate macro matcher binding name"
359359
}
360360

@@ -464,6 +464,7 @@ impl LintPass for HardwiredLints {
464464
DEPRECATED_IN_FUTURE,
465465
AMBIGUOUS_ASSOCIATED_ITEMS,
466466
NESTED_IMPL_TRAIT,
467+
DUPLICATE_MATCHER_BINDING_NAME,
467468
)
468469
}
469470
}

0 commit comments

Comments
 (0)