Skip to content

Commit 04ff05c

Browse files
committed
Auto merge of #148090 - jhpratt:rollup-n260hcy, r=jhpratt
Rollup of 5 pull requests Successful merges: - #147406 (Remove needs-asm-support directive in tests with explicit targets) - #148056 (refactor(rustdoc): Remove redundant langstr checks) - #148065 (compiletest: Add concrete examples for some config/test path fields) - #148072 (Fix compiling `CondVar::wait_timeout` on 32-bit Apple platforms) - #148073 (test(frontmatter): Rename tests to make coverage more obvious) r? `@ghost` `@rustbot` modify labels: rollup
2 parents e4407c0 + 3e3e08c commit 04ff05c

File tree

86 files changed

+950
-910
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+950
-910
lines changed

library/std/src/sys/pal/unix/sync/condvar.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
use super::Mutex;
22
use crate::cell::UnsafeCell;
33
use crate::pin::Pin;
4+
#[cfg(not(target_os = "nto"))]
5+
use crate::sys::pal::time::TIMESPEC_MAX;
6+
#[cfg(target_os = "nto")]
7+
use crate::sys::pal::time::TIMESPEC_MAX_CAPPED;
48
use crate::time::Duration;
59

610
pub struct Condvar {
@@ -51,10 +55,6 @@ impl Condvar {
5155
/// * `mutex` must be locked by the current thread.
5256
/// * This condition variable may only be used with the same mutex.
5357
pub unsafe fn wait_timeout(&self, mutex: Pin<&Mutex>, dur: Duration) -> bool {
54-
#[cfg(not(target_os = "nto"))]
55-
use crate::sys::pal::time::TIMESPEC_MAX;
56-
#[cfg(target_os = "nto")]
57-
use crate::sys::pal::time::TIMESPEC_MAX_CAPPED;
5858
use crate::sys::pal::time::Timespec;
5959

6060
let mutex = mutex.raw();
@@ -118,10 +118,12 @@ impl Condvar {
118118

119119
let (dur, clamped) = if dur <= MAX_DURATION { (dur, false) } else { (MAX_DURATION, true) };
120120

121-
let timeout = libc::timespec {
122-
// This cannot overflow because of the clamping above.
123-
tv_sec: dur.as_secs() as i64,
124-
tv_nsec: dur.subsec_nanos() as i64,
121+
// This can overflow on 32-bit platforms, but not on 64-bit because of the clamping above.
122+
let timeout = if let Ok(tv_sec) = dur.as_secs().try_into() {
123+
libc::timespec { tv_sec, tv_nsec: dur.subsec_nanos() as _ }
124+
} else {
125+
// This is less than `MAX_DURATION` on 32-bit platforms.
126+
TIMESPEC_MAX
125127
};
126128

127129
let r = unsafe { libc::pthread_cond_timedwait_relative_np(self.raw(), mutex, &timeout) };

src/doc/rustc-dev-guide/src/tests/directives.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ Some examples of `X` in `ignore-X` or `only-X`:
163163
The following directives will check rustc build settings and target
164164
settings:
165165

166-
- `needs-asm-support` — ignores if it is running on a target that doesn't have
167-
stable support for `asm!`
166+
- `needs-asm-support` — ignores if the **host** architecture doesn't have
167+
stable support for `asm!`. For tests that cross-compile to explicit targets
168+
via `--target`, use `needs-llvm-components` instead to ensure the appropriate
169+
backend is available.
168170
- `needs-profiler-runtime` — ignores the test if the profiler runtime was not
169171
enabled for the target
170172
(`build.profiler = true` in rustc's `bootstrap.toml`)

src/librustdoc/doctest.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,9 +1016,6 @@ impl CreateRunnableDocTests {
10161016
.span(scraped_test.span)
10171017
.build(dcx);
10181018
let is_standalone = !doctest.can_be_merged
1019-
|| scraped_test.langstr.compile_fail
1020-
|| scraped_test.langstr.test_harness
1021-
|| scraped_test.langstr.standalone_crate
10221019
|| self.rustdoc_options.nocapture
10231020
|| self.rustdoc_options.test_args.iter().any(|arg| arg == "--show-output");
10241021
if is_standalone {

src/tools/compiletest/src/common.rs

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,19 @@ pub struct Config {
248248

249249
/// Path to libraries needed to run the *staged* `rustc`-under-test on the **host** platform.
250250
///
251+
/// For example:
252+
/// - `/home/ferris/rust/build/x86_64-unknown-linux-gnu/stage1/bin/lib`
253+
///
251254
/// FIXME: maybe rename this to reflect (1) which target platform (host, not target), and (2)
252255
/// which `rustc` (the `rustc`-under-test, not the stage 0 `rustc` unless forced).
253256
pub compile_lib_path: Utf8PathBuf,
254257

255258
/// Path to libraries needed to run the compiled executable for the **target** platform. This
256259
/// corresponds to the **target** sysroot libraries, including the **target** standard library.
257260
///
261+
/// For example:
262+
/// - `/home/ferris/rust/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/i686-unknown-linux-gnu/lib`
263+
///
258264
/// FIXME: maybe rename this to reflect (1) which target platform (target, not host), and (2)
259265
/// what "run libraries" are against.
260266
///
@@ -266,6 +272,9 @@ pub struct Config {
266272
/// Path to the *staged* `rustc`-under-test. Unless forced, this `rustc` is *staged*, and must
267273
/// not be confused with [`Self::stage0_rustc_path`].
268274
///
275+
/// For example:
276+
/// - `/home/ferris/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc`
277+
///
269278
/// FIXME: maybe rename this to reflect that this is the `rustc`-under-test.
270279
pub rustc_path: Utf8PathBuf,
271280

@@ -274,11 +283,17 @@ pub struct Config {
274283
/// *not* used to compile the test recipes), and so must be staged as there may be differences
275284
/// between e.g. beta `cargo` vs in-tree `cargo`.
276285
///
286+
/// For example:
287+
/// - `/home/ferris/rust/build/x86_64-unknown-linux-gnu/stage1-tools-bin/cargo`
288+
///
277289
/// FIXME: maybe rename this to reflect that this is a *staged* host cargo.
278290
pub cargo_path: Option<Utf8PathBuf>,
279291

280292
/// Path to the stage 0 `rustc` used to build `run-make` recipes. This must not be confused with
281293
/// [`Self::rustc_path`].
294+
///
295+
/// For example:
296+
/// - `/home/ferris/rust/build/x86_64-unknown-linux-gnu/stage0/bin/rustc`
282297
pub stage0_rustc_path: Option<Utf8PathBuf>,
283298

284299
/// Path to the stage 1 or higher `rustc` used to obtain target information via
@@ -312,6 +327,9 @@ pub struct Config {
312327
pub llvm_filecheck: Option<Utf8PathBuf>,
313328

314329
/// Path to a host LLVM bintools directory.
330+
///
331+
/// For example:
332+
/// - `/home/ferris/rust/build/x86_64-unknown-linux-gnu/llvm/bin`
315333
pub llvm_bin_dir: Option<Utf8PathBuf>,
316334

317335
/// The path to the **target** `clang` executable to run `clang`-based tests with. If `None`,
@@ -321,28 +339,39 @@ pub struct Config {
321339
/// Path to the directory containing the sources. This corresponds to the root folder of a
322340
/// `rust-lang/rust` checkout.
323341
///
342+
/// For example:
343+
/// - `/home/ferris/rust`
344+
///
324345
/// FIXME: this name is confusing, because this is actually `$checkout_root`, **not** the
325346
/// `$checkout_root/src/` folder.
326347
pub src_root: Utf8PathBuf,
327348

328-
/// Path to the directory containing the test suites sources. This corresponds to the
329-
/// `$src_root/tests/` folder.
330-
///
331-
/// Must be an immediate subdirectory of [`Self::src_root`].
349+
/// Absolute path to the test suite directory.
332350
///
333-
/// FIXME: this name is also confusing, maybe just call it `tests_root`.
351+
/// For example:
352+
/// - `/home/ferris/rust/tests/ui`
353+
/// - `/home/ferris/rust/tests/coverage`
334354
pub src_test_suite_root: Utf8PathBuf,
335355

336-
/// Path to the build directory (e.g. `build/`).
356+
/// Path to the top-level build directory used by bootstrap.
357+
///
358+
/// For example:
359+
/// - `/home/ferris/rust/build`
337360
pub build_root: Utf8PathBuf,
338361

339-
/// Path to the test suite specific build directory (e.g. `build/host/test/ui/`).
362+
/// Path to the build directory used by the current test suite.
340363
///
341-
/// Must be a subdirectory of [`Self::build_root`].
364+
/// For example:
365+
/// - `/home/ferris/rust/build/x86_64-unknown-linux-gnu/test/ui`
366+
/// - `/home/ferris/rust/build/x86_64-unknown-linux-gnu/test/coverage`
342367
pub build_test_suite_root: Utf8PathBuf,
343368

344369
/// Path to the directory containing the sysroot of the `rustc`-under-test.
345370
///
371+
/// For example:
372+
/// - `/home/ferris/rust/build/x86_64-unknown-linux-gnu/stage1`
373+
/// - `/home/ferris/rust/build/x86_64-unknown-linux-gnu/stage2`
374+
///
346375
/// When stage 0 is forced, this will correspond to the sysroot *of* that specified stage 0
347376
/// `rustc`.
348377
///
@@ -1075,10 +1104,31 @@ fn query_rustc_output(config: &Config, args: &[&str], envs: HashMap<String, Stri
10751104
String::from_utf8(output.stdout).unwrap()
10761105
}
10771106

1107+
/// Path information for a single test file.
10781108
#[derive(Debug, Clone)]
1079-
pub struct TestPaths {
1080-
pub file: Utf8PathBuf, // e.g., compile-test/foo/bar/baz.rs
1081-
pub relative_dir: Utf8PathBuf, // e.g., foo/bar
1109+
pub(crate) struct TestPaths {
1110+
/// Full path to the test file.
1111+
///
1112+
/// For example:
1113+
/// - `/home/ferris/rust/tests/ui/warnings/hello-world.rs`
1114+
///
1115+
/// ---
1116+
///
1117+
/// For `run-make` tests, this path is the _directory_ that contains
1118+
/// `rmake.rs`.
1119+
///
1120+
/// For example:
1121+
/// - `/home/ferris/rust/tests/run-make/emit`
1122+
pub(crate) file: Utf8PathBuf,
1123+
1124+
/// Subset of the full path that excludes the suite directory and the
1125+
/// test filename. For tests in the root of their test suite directory,
1126+
/// this is blank.
1127+
///
1128+
/// For example:
1129+
/// - `file`: `/home/ferris/rust/tests/ui/warnings/hello-world.rs`
1130+
/// - `relative_dir`: `warnings`
1131+
pub(crate) relative_dir: Utf8PathBuf,
10821132
}
10831133

10841134
/// Used by `ui` tests to generate things like `foo.stderr` from `foo.rs`.

tests/ui/asm/aarch64/arm64ec-sve.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ add-core-stubs
22
//@ compile-flags: --target arm64ec-pc-windows-msvc
3-
//@ needs-asm-support
43
//@ needs-llvm-components: aarch64
54
//@ ignore-backends: gcc
65

tests/ui/asm/aarch64/arm64ec-sve.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: cannot use register `p0`: x13, x14, x23, x24, x28, v16-v31, p*, ffr cannot be used for Arm64EC
2-
--> $DIR/arm64ec-sve.rs:19:18
2+
--> $DIR/arm64ec-sve.rs:18:18
33
|
44
LL | asm!("", out("p0") _);
55
| ^^^^^^^^^^^
66

77
error: cannot use register `ffr`: x13, x14, x23, x24, x28, v16-v31, p*, ffr cannot be used for Arm64EC
8-
--> $DIR/arm64ec-sve.rs:21:18
8+
--> $DIR/arm64ec-sve.rs:20:18
99
|
1010
LL | asm!("", out("ffr") _);
1111
| ^^^^^^^^^^^^

tests/ui/asm/inline-syntax.arm.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LL | .intel_syntax noprefix
1515
| ^
1616

1717
error: unknown directive
18-
--> $DIR/inline-syntax.rs:22:15
18+
--> $DIR/inline-syntax.rs:21:15
1919
|
2020
LL | asm!(".intel_syntax noprefix", "nop");
2121
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -27,7 +27,7 @@ LL | .intel_syntax noprefix
2727
| ^
2828

2929
error: unknown directive
30-
--> $DIR/inline-syntax.rs:25:15
30+
--> $DIR/inline-syntax.rs:24:15
3131
|
3232
LL | asm!(".intel_syntax aaa noprefix", "nop");
3333
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -39,7 +39,7 @@ LL | .intel_syntax aaa noprefix
3939
| ^
4040

4141
error: unknown directive
42-
--> $DIR/inline-syntax.rs:28:15
42+
--> $DIR/inline-syntax.rs:27:15
4343
|
4444
LL | asm!(".att_syntax noprefix", "nop");
4545
| ^^^^^^^^^^^^^^^^^^^^
@@ -51,7 +51,7 @@ LL | .att_syntax noprefix
5151
| ^
5252

5353
error: unknown directive
54-
--> $DIR/inline-syntax.rs:31:15
54+
--> $DIR/inline-syntax.rs:30:15
5555
|
5656
LL | asm!(".att_syntax bbb noprefix", "nop");
5757
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -63,7 +63,7 @@ LL | .att_syntax bbb noprefix
6363
| ^
6464

6565
error: unknown directive
66-
--> $DIR/inline-syntax.rs:34:15
66+
--> $DIR/inline-syntax.rs:33:15
6767
|
6868
LL | asm!(".intel_syntax noprefix; nop");
6969
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -75,7 +75,7 @@ LL | .intel_syntax noprefix; nop
7575
| ^
7676

7777
error: unknown directive
78-
--> $DIR/inline-syntax.rs:40:13
78+
--> $DIR/inline-syntax.rs:39:13
7979
|
8080
LL | .intel_syntax noprefix
8181
| ^^^^^^^^^^^^^^^^^^^^^^

tests/ui/asm/inline-syntax.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//@[arm] compile-flags: --target armv7-unknown-linux-gnueabihf
88
//@[arm] build-fail
99
//@[arm] needs-llvm-components: arm
10-
//@ needs-asm-support
1110
//@ ignore-backends: gcc
1211

1312
#![feature(no_core)]

tests/ui/asm/inline-syntax.x86_64.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
warning: avoid using `.intel_syntax`, Intel syntax is the default
2-
--> $DIR/inline-syntax.rs:48:14
2+
--> $DIR/inline-syntax.rs:47:14
33
|
44
LL | global_asm!(".intel_syntax noprefix", "nop");
55
| ^^^^^^^^^^^^^^^^^^^^^^
66
|
77
= note: `#[warn(bad_asm_style)]` on by default
88

99
warning: avoid using `.intel_syntax`, Intel syntax is the default
10-
--> $DIR/inline-syntax.rs:22:15
10+
--> $DIR/inline-syntax.rs:21:15
1111
|
1212
LL | asm!(".intel_syntax noprefix", "nop");
1313
| ^^^^^^^^^^^^^^^^^^^^^^
1414

1515
warning: avoid using `.intel_syntax`, Intel syntax is the default
16-
--> $DIR/inline-syntax.rs:25:15
16+
--> $DIR/inline-syntax.rs:24:15
1717
|
1818
LL | asm!(".intel_syntax aaa noprefix", "nop");
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2020

2121
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
22-
--> $DIR/inline-syntax.rs:28:15
22+
--> $DIR/inline-syntax.rs:27:15
2323
|
2424
LL | asm!(".att_syntax noprefix", "nop");
2525
| ^^^^^^^^^^^^^^^^^^^^
2626

2727
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
28-
--> $DIR/inline-syntax.rs:31:15
28+
--> $DIR/inline-syntax.rs:30:15
2929
|
3030
LL | asm!(".att_syntax bbb noprefix", "nop");
3131
| ^^^^^^^^^^^^^^^^^^^^^^^^
3232

3333
warning: avoid using `.intel_syntax`, Intel syntax is the default
34-
--> $DIR/inline-syntax.rs:34:15
34+
--> $DIR/inline-syntax.rs:33:15
3535
|
3636
LL | asm!(".intel_syntax noprefix; nop");
3737
| ^^^^^^^^^^^^^^^^^^^^^^
3838

3939
warning: avoid using `.intel_syntax`, Intel syntax is the default
40-
--> $DIR/inline-syntax.rs:40:13
40+
--> $DIR/inline-syntax.rs:39:13
4141
|
4242
LL | .intel_syntax noprefix
4343
| ^^^^^^^^^^^^^^^^^^^^^^

tests/ui/asm/issue-92378.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ add-core-stubs
22
//@ compile-flags: --target armv5te-unknown-linux-gnueabi
33
//@ needs-llvm-components: arm
4-
//@ needs-asm-support
54
//@ build-pass
65
//@ ignore-backends: gcc
76

0 commit comments

Comments
 (0)