Skip to content

Commit ae3ab14

Browse files
committed
Auto merge of rust-lang#110839 - jyn514:rollup-uikilwm, r=jyn514
Rollup of 9 pull requests Successful merges: - rust-lang#108416 (black_box doc corrections for clarification - Issue rust-lang#107957) - rust-lang#109379 (Replace `yes` command by `while-echo` in test `tests/ui/process/process-sigpipe.rs`) - rust-lang#110266 (Update documentation wording on path 'try_exists' functions) - rust-lang#110329 (Improve tests for rust-lang#110138) - rust-lang#110418 (Spelling rustdoc) - rust-lang#110587 (Fix `std` compilation error for wasi+atomics) - rust-lang#110594 (`rustc --help` add `--cfg` SPEC declaration.) - rust-lang#110792 (Use the standard macOS CI runner) - rust-lang#110817 (Add regression tests for const-generic inherent associated types) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 70540d5 + 8c0dfa3 commit ae3ab14

File tree

17 files changed

+117
-41
lines changed

17 files changed

+117
-41
lines changed

.github/workflows/ci.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ jobs:
326326
NO_DEBUG_ASSERTIONS: 1
327327
NO_OVERFLOW_CHECKS: 1
328328
DIST_REQUIRE_ALL_TOOLS: 1
329-
os: macos-12-xl
329+
os: macos-latest
330330
- name: dist-apple-various
331331
env:
332332
SCRIPT: "./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim"
@@ -337,7 +337,7 @@ jobs:
337337
NO_LLVM_ASSERTIONS: 1
338338
NO_DEBUG_ASSERTIONS: 1
339339
NO_OVERFLOW_CHECKS: 1
340-
os: macos-12-xl
340+
os: macos-latest
341341
- name: dist-x86_64-apple-alt
342342
env:
343343
SCRIPT: "./x.py dist bootstrap --include-default-paths"
@@ -348,7 +348,7 @@ jobs:
348348
NO_LLVM_ASSERTIONS: 1
349349
NO_DEBUG_ASSERTIONS: 1
350350
NO_OVERFLOW_CHECKS: 1
351-
os: macos-12-xl
351+
os: macos-latest
352352
- name: x86_64-apple-1
353353
env:
354354
SCRIPT: "./x.py --stage 2 test --exclude tests/ui --exclude tests/rustdoc --exclude tests/run-make-fulldeps"
@@ -359,7 +359,7 @@ jobs:
359359
NO_LLVM_ASSERTIONS: 1
360360
NO_DEBUG_ASSERTIONS: 1
361361
NO_OVERFLOW_CHECKS: 1
362-
os: macos-12-xl
362+
os: macos-latest
363363
- name: x86_64-apple-2
364364
env:
365365
SCRIPT: "./x.py --stage 2 test tests/ui tests/rustdoc tests/run-make-fulldeps"
@@ -370,7 +370,7 @@ jobs:
370370
NO_LLVM_ASSERTIONS: 1
371371
NO_DEBUG_ASSERTIONS: 1
372372
NO_OVERFLOW_CHECKS: 1
373-
os: macos-12-xl
373+
os: macos-latest
374374
- name: dist-aarch64-apple
375375
env:
376376
SCRIPT: "./x.py dist bootstrap --include-default-paths --stage 2"
@@ -385,7 +385,7 @@ jobs:
385385
NO_OVERFLOW_CHECKS: 1
386386
DIST_REQUIRE_ALL_TOOLS: 1
387387
JEMALLOC_SYS_WITH_LG_PAGE: 14
388-
os: macos-12-xl
388+
os: macos-latest
389389
- name: x86_64-msvc-1
390390
env:
391391
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --enable-profiler"

compiler/rustc_session/src/config.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,8 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE
14001400
pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
14011401
vec![
14021402
opt::flag_s("h", "help", "Display this message"),
1403-
opt::multi_s("", "cfg", "Configure the compilation environment", "SPEC"),
1403+
opt::multi_s("", "cfg", "Configure the compilation environment.
1404+
SPEC supports the syntax `NAME[=\"VALUE\"]`.", "SPEC"),
14041405
opt::multi("", "check-cfg", "Provide list of valid cfg options for checking", "SPEC"),
14051406
opt::multi_s(
14061407
"L",

library/core/src/hint.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,14 @@ pub fn spin_loop() {
217217
/// Note however, that `black_box` is only (and can only be) provided on a "best-effort" basis. The
218218
/// extent to which it can block optimisations may vary depending upon the platform and code-gen
219219
/// backend used. Programs cannot rely on `black_box` for *correctness*, beyond it behaving as the
220-
/// identity function.
220+
/// identity function. As such, it **must not be relied upon to control critical program behavior.**
221+
/// This _immediately_ precludes any direct use of this function for cryptographic or security
222+
/// purposes.
221223
///
222224
/// [`std::convert::identity`]: crate::convert::identity
223225
///
224226
/// # When is this useful?
225227
///
226-
/// First and foremost: `black_box` does _not_ guarantee any exact behavior and, in some cases, may
227-
/// do nothing at all. As such, it **must not be relied upon to control critical program behavior.**
228-
/// This _immediately_ precludes any direct use of this function for cryptographic or security
229-
/// purposes.
230-
///
231228
/// While not suitable in those mission-critical cases, `black_box`'s functionality can generally be
232229
/// relied upon for benchmarking, and should be used there. It will try to ensure that the
233230
/// compiler doesn't optimize away part of the intended test code based on context. For

library/std/src/fs.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -2515,9 +2515,10 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
25152515
/// This function will traverse symbolic links to query information about the
25162516
/// destination file. In case of broken symbolic links this will return `Ok(false)`.
25172517
///
2518-
/// As opposed to the [`Path::exists`] method, this one doesn't silently ignore errors
2519-
/// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
2520-
/// denied on some of the parent directories.)
2518+
/// As opposed to the [`Path::exists`] method, this will only return `Ok(true)` or `Ok(false)`
2519+
/// if the path was _verified_ to exist or not exist. If its existence can neither be confirmed
2520+
/// nor denied, an `Err(_)` will be propagated instead. This can be the case if e.g. listing
2521+
/// permission is denied on one of the parent directories.
25212522
///
25222523
/// Note that while this avoids some pitfalls of the `exists()` method, it still can not
25232524
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios

library/std/src/path.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -2844,9 +2844,11 @@ impl Path {
28442844
/// This function will traverse symbolic links to query information about the
28452845
/// destination file. In case of broken symbolic links this will return `Ok(false)`.
28462846
///
2847-
/// As opposed to the [`exists()`] method, this one doesn't silently ignore errors
2848-
/// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
2849-
/// denied on some of the parent directories.)
2847+
/// [`Path::exists()`] only checks whether or not a path was both found and readable. By
2848+
/// contrast, `try_exists` will return `Ok(true)` or `Ok(false)`, respectively, if the path
2849+
/// was _verified_ to exist or not exist. If its existence can neither be confirmed nor
2850+
/// denied, it will propagate an `Err(_)` instead. This can be the case if e.g. listing
2851+
/// permission is denied on one of the parent directories.
28502852
///
28512853
/// Note that while this avoids some pitfalls of the `exists()` method, it still can not
28522854
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios

library/std/src/sys/wasi/mod.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ pub mod io;
3232
#[path = "../unsupported/locks/mod.rs"]
3333
pub mod locks;
3434
pub mod net;
35-
#[path = "../unsupported/once.rs"]
36-
pub mod once;
3735
pub mod os;
3836
#[path = "../unix/os_str.rs"]
3937
pub mod os_str;
@@ -51,6 +49,13 @@ pub mod thread_local_dtor;
5149
pub mod thread_local_key;
5250
pub mod time;
5351

52+
cfg_if::cfg_if! {
53+
if #[cfg(not(target_feature = "atomics"))] {
54+
#[path = "../unsupported/once.rs"]
55+
pub mod once;
56+
}
57+
}
58+
5459
#[path = "../unsupported/common.rs"]
5560
#[deny(unsafe_op_in_unsafe_fn)]
5661
#[allow(unused)]

src/ci/github-actions/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ x--expand-yaml-anchors--remove:
8282
<<: *base-job
8383

8484
- &job-macos-xl
85-
os: macos-12-xl
85+
os: macos-latest # We use the standard runner for now
8686
<<: *base-job
8787

8888
- &job-windows-8c

src/doc/rustdoc/src/how-to-read-rustdoc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ including automatic and blanket implementations that `rustdoc` knows about.
4343
Subheadings, variants, fields, and many other things in this documentation
4444
are anchors and can be clicked on and deep-linked to,
4545
which is a great way to communicate exactly what you're talking about.
46-
The typograpical character "§" appears next to lines with anchors on them
46+
The typographical character "§" appears next to lines with anchors on them
4747
when hovered or given keyboard focus.
4848

4949
## The Navigation Bar

src/doc/rustdoc/src/references.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ If you know of other great resources, please submit a pull request!
1313

1414
## Community
1515
- [API Guidelines]
16-
- [Github tagged RFCs]
17-
- [Github tagged issues]
16+
- [GitHub tagged RFCs]
17+
- [GitHub tagged issues]
1818
- [RFC (stalled) front page styleguide]
1919
- [Guide on how to write documentation for a Rust crate]
2020

2121

2222
[API Guidelines]: https://rust-lang.github.io/api-guidelines/documentation.html
23-
[Github tagged RFCs]: https://github.com/rust-lang/rfcs/issues?q=label%3AT-rustdoc
24-
[Github tagged issues]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AT-rustdoc
23+
[GitHub tagged RFCs]: https://github.com/rust-lang/rfcs/issues?q=label%3AT-rustdoc
24+
[GitHub tagged issues]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AT-rustdoc
2525
[Guide on how to write documentation for a Rust crate]: https://blog.guillaume-gomez.fr/articles/2020-03-12+Guide+on+how+to+write+documentation+for+a+Rust+crate
2626
[Learn Rust]: https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#making-useful-documentation-comments
2727
[RFC 1574: More API Documentation Conventions]: https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
//! Should not be inlined
2+
3+
/// Should not be inlined
4+
pub enum O {
5+
L = -1,
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Regression Test for https://github.com/rust-lang/rust/issues/110138
2+
// aux-build: enum_with_discriminant.rs
3+
4+
#[doc(inline)]
5+
pub extern crate enum_with_discriminant;
6+
7+
// @!has '$.index[*][?(@.docs == "Should not be inlined")]'
8+
// @is '$.index[*][?(@.name == "enum_with_discriminant")].kind' '"extern_crate"'
9+
// @set enum_with_discriminant = '$.index[*][?(@.name == "enum_with_discriminant")].id'
10+
// @is '$.index[*][?(@.name == "doc_inline_external_crate")].inner.items[*]' $enum_with_discriminant
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// aux-build: enum_with_discriminant.rs
2+
3+
extern crate enum_with_discriminant;
4+
5+
#[doc(inline)]
6+
pub use enum_with_discriminant::*;
7+
8+
// @!has '$.index[*][?(@.docs == "Should not be inlined")]'
9+
// @set use = '$.index[*][?(@.inner.name == "enum_with_discriminant")].id'
10+
// @is '$.index[*][?(@.name == "extern_crate_glob")].inner.items[*]' $use

tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs

-3
This file was deleted.

tests/rustdoc-ui/intra-doc/inline-external-enum.rs

-8
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Regression test for issue #109759.
2+
// check-pass
3+
4+
#![feature(inherent_associated_types)]
5+
#![allow(incomplete_features)]
6+
7+
struct Foo;
8+
9+
struct Bar<const X: usize>([(); X]);
10+
11+
impl<const X: usize> Bar<X> {
12+
pub fn new() -> Self {
13+
Self([(); X])
14+
}
15+
}
16+
17+
impl Foo {
18+
type Bar<const X: usize> = Bar<X>;
19+
}
20+
21+
fn main() {
22+
let _ = Foo::Bar::<10>::new();
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// check-pass
2+
3+
#![feature(inherent_associated_types, generic_const_exprs)]
4+
#![allow(incomplete_features)]
5+
6+
struct Parent<const O: usize>;
7+
8+
impl<const O: usize> Parent<O> {
9+
type Mapping<const I: usize> = Store<{ O + I }>
10+
where
11+
[(); O + I]:
12+
;
13+
}
14+
15+
struct Store<const N: usize>;
16+
17+
impl<const N: usize> Store<N> {
18+
const REIFIED: usize = N;
19+
20+
fn reify() -> usize {
21+
N
22+
}
23+
}
24+
25+
fn main() {
26+
let _ = Parent::<2>::Mapping::<{ 12 * 2 }>::REIFIED;
27+
let _ = Parent::<1>::Mapping::<{ 2 * 5 }>::reify();
28+
}

tests/ui/process/process-sigpipe.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
// libstd ignores SIGPIPE, and other libraries may set signal masks.
99
// Make sure that these behaviors don't get inherited to children
1010
// spawned via std::process, since they're needed for traditional UNIX
11-
// filter behavior. This test checks that `yes | head` terminates
11+
// filter behavior.
12+
// This test checks that `while echo y ; do : ; done | head` terminates
1213
// (instead of running forever), and that it does not print an error
1314
// message about a broken pipe.
1415

1516
// ignore-emscripten no threads support
1617
// ignore-vxworks no 'sh'
1718
// ignore-fuchsia no 'sh'
18-
// ignore-nto no 'yes'
1919

2020
use std::process;
2121
use std::thread;
@@ -27,7 +27,11 @@ fn main() {
2727
thread::sleep_ms(5000);
2828
process::exit(1);
2929
});
30-
let output = process::Command::new("sh").arg("-c").arg("yes | head").output().unwrap();
30+
let output = process::Command::new("sh")
31+
.arg("-c")
32+
.arg("while echo y ; do : ; done | head")
33+
.output()
34+
.unwrap();
3135
assert!(output.status.success());
3236
assert!(output.stderr.len() == 0);
3337
}

0 commit comments

Comments
 (0)