Skip to content

Commit 442f40b

Browse files
committed
Auto merge of #128807 - ChrisDenton:bloat, r=<try>
run-make: run fmt-write-bloat on Windows The trouble here is that libc doesn't exist on Windows. Well it kinda does but it isn't called that so we substitute a name that works. Ideally finding necessary libs for the platform would be done at a higher level but until then this should work. try-job: x86_64-msvc try-job: x86_64-mingw try-job: i686-msvc try-job: i686-mingw
2 parents 2048386 + d8969b0 commit 442f40b

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

src/tools/run-make-support/src/symbols.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ pub fn any_symbol_contains(path: impl AsRef<Path>, substrings: &[&str]) -> bool
2828
with_symbol_iter(path, |syms| {
2929
for sym in syms {
3030
for substring in substrings {
31-
if sym
32-
.name_bytes()
33-
.unwrap()
34-
.windows(substring.len())
35-
.any(|x| x == substring.as_bytes())
36-
{
31+
let name = sym.name_bytes().unwrap();
32+
if name.starts_with(b"__imp_") {
33+
continue;
34+
}
35+
if name.windows(substring.len()).any(|x| x == substring.as_bytes()) {
3736
eprintln!("{:?} contains {}", sym, substring);
3837
return true;
3938
}

tests/run-make/fmt-write-bloat/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use core::fmt;
66
use core::fmt::Write;
77

8-
#[link(name = "c")]
8+
#[cfg_attr(not(windows), link(name = "c"))]
99
extern "C" {}
1010

1111
struct Dummy;

tests/run-make/fmt-write-bloat/rmake.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@
1515
//! `NO_DEBUG_ASSERTIONS=1`). If debug assertions are disabled, then we can check for the absence of
1616
//! additional `usize` formatting and padding related symbols.
1717
18-
// Reason: This test is `ignore-windows` because the `no_std` test (using `#[link(name = "c")])`
19-
// doesn't link on windows.
20-
//@ ignore-windows
2118
//@ ignore-cross-compile
2219

2320
use run_make_support::env::no_debug_assertions;
24-
use run_make_support::rustc;
2521
use run_make_support::symbols::any_symbol_contains;
22+
use run_make_support::{bin_name, rustc};
2623

2724
fn main() {
2825
rustc().input("main.rs").opt().run();
@@ -33,5 +30,5 @@ fn main() {
3330
// otherwise, add them to the list of symbols to deny.
3431
panic_syms.extend_from_slice(&["panicking", "panic_fmt", "pad_integral", "Display"]);
3532
}
36-
assert!(!any_symbol_contains("main", &panic_syms));
33+
assert!(!any_symbol_contains(&bin_name("main"), &panic_syms));
3734
}

0 commit comments

Comments
 (0)