Skip to content

Commit 8b1889c

Browse files
committed
Auto merge of #145450 - Kobzol:rollup-cqclix0, r=Kobzol
Rollup of 11 pull requests Successful merges: - #144210 (std: thread: Return error if setting thread stack size fails) - #145310 (Reduce usage of `compiler_for` in bootstrap) - #145311 (ci: clean windows disk space in background) - #145340 (Split codegen backend check step into two and don't run it with `x check compiler`) - #145408 (Deduplicate -L search paths) - #145412 (Windows: Replace `GetThreadId`+`GetCurrentThread` with `GetCurrentThreadId`) - #145413 (bootstrap: Reduce dependencies) - #145426 (Fix typos in bootstrap.example.toml) - #145430 (Fix wrong spans with external macros in the `dropping_copy_types` lint) - #145431 (Enhance UI test output handling for runtime errors) - #145448 (Autolabel `src/tools/{rustfmt,rust-analyzer}` changes with `T-{rustfmt,rust-analyzer}`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents c018ae5 + 9bf76ab commit 8b1889c

File tree

25 files changed

+478
-339
lines changed

25 files changed

+478
-339
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ jobs:
223223
cd src/ci/citool
224224
CARGO_INCREMENTAL=0 CARGO_TARGET_DIR=../../../build/citool cargo build
225225
226+
- name: wait for Windows disk cleanup to finish
227+
if: ${{ matrix.free_disk && startsWith(matrix.os, 'windows-') }}
228+
run: |
229+
python3 src/ci/scripts/free-disk-space-windows-wait.py
230+
226231
- name: run the build
227232
run: |
228233
set +e

bootstrap.example.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# a custom configuration file can also be specified with `--config` to the build
1010
# system.
1111
#
12-
# Note that the following are equivelent, for more details see <https://toml.io/en/v1.0.0>.
12+
# Note that the following are equivalent, for more details see <https://toml.io/en/v1.0.0>.
1313
#
1414
# build.verbose = 1
1515
#
@@ -345,9 +345,9 @@
345345
# want to use vendoring. See https://forge.rust-lang.org/infra/other-installation-methods.html#source-code.
346346
#build.vendor = if "is a tarball source" && "vendor" dir exists && ".cargo/config.toml" file exists { true } else { false }
347347

348-
# Typically the build system will build the Rust compiler twice. The second
349-
# compiler, however, will simply use its own libraries to link against. If you
350-
# would rather to perform a full bootstrap, compiling the compiler three times,
348+
# If you build the compiler more than twice (stage3+) or the standard library more than once
349+
# (stage 2+), the third compiler and second library will get uplifted from stage2 and stage1,
350+
# respectively. If you would like to disable this uplifting, and rather perform a full bootstrap,
351351
# then you can set this option to true.
352352
#
353353
# This is only useful for verifying that rustc generates reproducible builds.
@@ -482,7 +482,7 @@
482482
# Use `--extra-checks=''` to temporarily disable all extra checks.
483483
#
484484
# Automatically enabled in the "tools" profile.
485-
# Set to the empty string to force disable (recommeded for hdd systems).
485+
# Set to the empty string to force disable (recommended for hdd systems).
486486
#build.tidy-extra-checks = ""
487487

488488
# Indicates whether ccache is used when building certain artifacts (e.g. LLVM).

compiler/rustc_lint/src/drop_forget_useless.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
151151
&& let Node::Stmt(stmt) = node
152152
&& let StmtKind::Semi(e) = stmt.kind
153153
&& e.hir_id == expr.hir_id
154-
&& let Some(arg_span) = arg.span.find_ancestor_inside(expr.span)
154+
&& let Some(arg_span) = arg.span.find_ancestor_inside_same_ctxt(expr.span)
155155
{
156156
UseLetUnderscoreIgnoreSuggestion::Suggestion {
157157
start_span: expr.span.shrink_to_lo().until(arg_span),

compiler/rustc_session/src/config.rs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2847,16 +2847,27 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M
28472847
// This is the location used by the `rustc-dev` `rustup` component.
28482848
real_source_base_dir("lib/rustlib/rustc-src/rust", "compiler/rustc/src/main.rs");
28492849

2850-
let mut search_paths = vec![];
2851-
for s in &matches.opt_strs("L") {
2852-
search_paths.push(SearchPath::from_cli_opt(
2853-
sysroot.path(),
2854-
&target_triple,
2855-
early_dcx,
2856-
s,
2857-
unstable_opts.unstable_options,
2858-
));
2859-
}
2850+
// We eagerly scan all files in each passed -L path. If the same directory is passed multiple
2851+
// times, and the directory contains a lot of files, this can take a lot of time.
2852+
// So we remove -L paths that were passed multiple times, and keep only the first occurrence.
2853+
// We still have to keep the original order of the -L arguments.
2854+
let search_paths: Vec<SearchPath> = {
2855+
let mut seen_search_paths = FxHashSet::default();
2856+
let search_path_matches: Vec<String> = matches.opt_strs("L");
2857+
search_path_matches
2858+
.iter()
2859+
.filter(|p| seen_search_paths.insert(*p))
2860+
.map(|path| {
2861+
SearchPath::from_cli_opt(
2862+
sysroot.path(),
2863+
&target_triple,
2864+
early_dcx,
2865+
&path,
2866+
unstable_opts.unstable_options,
2867+
)
2868+
})
2869+
.collect()
2870+
};
28602871

28612872
let working_dir = std::env::current_dir().unwrap_or_else(|e| {
28622873
early_dcx.early_fatal(format!("Current directory is invalid: {e}"));

library/std/src/sys/pal/unix/thread.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,18 @@ impl Thread {
7777
let page_size = os::page_size();
7878
let stack_size =
7979
(stack_size + page_size - 1) & (-(page_size as isize - 1) as usize - 1);
80-
assert_eq!(libc::pthread_attr_setstacksize(attr.as_mut_ptr(), stack_size), 0);
80+
81+
// Some libc implementations, e.g. musl, place an upper bound
82+
// on the stack size, in which case we can only gracefully return
83+
// an error here.
84+
if libc::pthread_attr_setstacksize(attr.as_mut_ptr(), stack_size) != 0 {
85+
assert_eq!(libc::pthread_attr_destroy(attr.as_mut_ptr()), 0);
86+
drop(Box::from_raw(data));
87+
return Err(io::const_error!(
88+
io::ErrorKind::InvalidInput,
89+
"invalid stack size"
90+
));
91+
}
8192
}
8293
};
8394
}

library/std/src/sys/pal/windows/c/bindings.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2158,6 +2158,7 @@ GetCurrentDirectoryW
21582158
GetCurrentProcess
21592159
GetCurrentProcessId
21602160
GetCurrentThread
2161+
GetCurrentThreadId
21612162
GetEnvironmentStringsW
21622163
GetEnvironmentVariableW
21632164
GetExitCodeProcess
@@ -2185,7 +2186,6 @@ GetSystemInfo
21852186
GetSystemTimeAsFileTime
21862187
GetSystemTimePreciseAsFileTime
21872188
GetTempPathW
2188-
GetThreadId
21892189
GetUserProfileDirectoryW
21902190
GetWindowsDirectoryW
21912191
HANDLE

library/std/src/sys/pal/windows/c/windows_sys.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ windows_targets::link!("kernel32.dll" "system" fn GetCurrentDirectoryW(nbufferle
3838
windows_targets::link!("kernel32.dll" "system" fn GetCurrentProcess() -> HANDLE);
3939
windows_targets::link!("kernel32.dll" "system" fn GetCurrentProcessId() -> u32);
4040
windows_targets::link!("kernel32.dll" "system" fn GetCurrentThread() -> HANDLE);
41+
windows_targets::link!("kernel32.dll" "system" fn GetCurrentThreadId() -> u32);
4142
windows_targets::link!("kernel32.dll" "system" fn GetEnvironmentStringsW() -> PWSTR);
4243
windows_targets::link!("kernel32.dll" "system" fn GetEnvironmentVariableW(lpname : PCWSTR, lpbuffer : PWSTR, nsize : u32) -> u32);
4344
windows_targets::link!("kernel32.dll" "system" fn GetExitCodeProcess(hprocess : HANDLE, lpexitcode : *mut u32) -> BOOL);
@@ -61,7 +62,6 @@ windows_targets::link!("kernel32.dll" "system" fn GetSystemInfo(lpsysteminfo : *
6162
windows_targets::link!("kernel32.dll" "system" fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime : *mut FILETIME));
6263
windows_targets::link!("kernel32.dll" "system" fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime : *mut FILETIME));
6364
windows_targets::link!("kernel32.dll" "system" fn GetTempPathW(nbufferlength : u32, lpbuffer : PWSTR) -> u32);
64-
windows_targets::link!("kernel32.dll" "system" fn GetThreadId(thread : HANDLE) -> u32);
6565
windows_targets::link!("userenv.dll" "system" fn GetUserProfileDirectoryW(htoken : HANDLE, lpprofiledir : PWSTR, lpcchsize : *mut u32) -> BOOL);
6666
windows_targets::link!("kernel32.dll" "system" fn GetWindowsDirectoryW(lpbuffer : PWSTR, usize : u32) -> u32);
6767
windows_targets::link!("kernel32.dll" "system" fn InitOnceBeginInitialize(lpinitonce : *mut INIT_ONCE, dwflags : u32, fpending : *mut BOOL, lpcontext : *mut *mut core::ffi::c_void) -> BOOL);

library/std/src/sys/pal/windows/thread.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl Thread {
129129

130130
pub(crate) fn current_os_id() -> Option<u64> {
131131
// SAFETY: FFI call with no preconditions.
132-
let id: u32 = unsafe { c::GetThreadId(c::GetCurrentThread()) };
132+
let id: u32 = unsafe { c::GetCurrentThreadId() };
133133

134134
// A return value of 0 indicates failed lookup.
135135
if id == 0 { None } else { Some(id.into()) }

src/bootstrap/Cargo.lock

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ dependencies = [
4848
"clap",
4949
"clap_complete",
5050
"cmake",
51-
"fd-lock",
5251
"home",
5352
"ignore",
5453
"insta",
@@ -268,17 +267,6 @@ version = "2.3.0"
268267
source = "registry+https://github.com/rust-lang/crates.io-index"
269268
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
270269

271-
[[package]]
272-
name = "fd-lock"
273-
version = "4.0.4"
274-
source = "registry+https://github.com/rust-lang/crates.io-index"
275-
checksum = "0ce92ff622d6dadf7349484f42c93271a0d49b7cc4d466a936405bacbe10aa78"
276-
dependencies = [
277-
"cfg-if",
278-
"rustix",
279-
"windows-sys 0.59.0",
280-
]
281-
282270
[[package]]
283271
name = "filetime"
284272
version = "0.2.25"
@@ -759,13 +747,12 @@ dependencies = [
759747

760748
[[package]]
761749
name = "tar"
762-
version = "0.4.43"
750+
version = "0.4.44"
763751
source = "registry+https://github.com/rust-lang/crates.io-index"
764-
checksum = "c65998313f8e17d0d553d28f91a0df93e4dbbbf770279c7bc21ca0f09ea1a1f6"
752+
checksum = "1d863878d212c87a19c1a610eb53bb01fe12951c0501cf5a0d65f724914a667a"
765753
dependencies = [
766754
"filetime",
767755
"libc",
768-
"xattr",
769756
]
770757

771758
[[package]]
@@ -1147,16 +1134,6 @@ dependencies = [
11471134
"bitflags",
11481135
]
11491136

1150-
[[package]]
1151-
name = "xattr"
1152-
version = "1.5.0"
1153-
source = "registry+https://github.com/rust-lang/crates.io-index"
1154-
checksum = "0d65cbf2f12c15564212d48f4e3dfb87923d25d611f2aed18f4cb23f0413d89e"
1155-
dependencies = [
1156-
"libc",
1157-
"rustix",
1158-
]
1159-
11601137
[[package]]
11611138
name = "xz2"
11621139
version = "0.1.7"

src/bootstrap/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ cmake = "=0.1.54"
3838
build_helper = { path = "../build_helper" }
3939
clap = { version = "4.4", default-features = false, features = ["std", "usage", "help", "derive", "error-context"] }
4040
clap_complete = "4.4"
41-
fd-lock = "4.0"
4241
home = "0.5"
4342
ignore = "0.4"
4443
libc = "0.2"
@@ -51,7 +50,7 @@ serde = "1.0"
5150
serde_derive = "1.0"
5251
serde_json = "1.0"
5352
sha2 = "0.10"
54-
tar = "0.4"
53+
tar = { version = "0.4.44", default-features = false }
5554
termcolor = "1.4"
5655
toml = "0.5"
5756
walkdir = "2.4"

0 commit comments

Comments
 (0)