Skip to content

Commit

Permalink
Auto merge of rust-lang#110839 - jyn514:rollup-uikilwm, r=jyn514
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Apr 26, 2023
2 parents 70540d5 + 8c0dfa3 commit ae3ab14
Show file tree
Hide file tree
Showing 17 changed files with 117 additions and 41 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ jobs:
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
DIST_REQUIRE_ALL_TOOLS: 1
os: macos-12-xl
os: macos-latest
- name: dist-apple-various
env:
SCRIPT: "./x.py dist bootstrap --include-default-paths --host='' --target=aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim"
Expand All @@ -337,7 +337,7 @@ jobs:
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
os: macos-12-xl
os: macos-latest
- name: dist-x86_64-apple-alt
env:
SCRIPT: "./x.py dist bootstrap --include-default-paths"
Expand All @@ -348,7 +348,7 @@ jobs:
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
os: macos-12-xl
os: macos-latest
- name: x86_64-apple-1
env:
SCRIPT: "./x.py --stage 2 test --exclude tests/ui --exclude tests/rustdoc --exclude tests/run-make-fulldeps"
Expand All @@ -359,7 +359,7 @@ jobs:
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
os: macos-12-xl
os: macos-latest
- name: x86_64-apple-2
env:
SCRIPT: "./x.py --stage 2 test tests/ui tests/rustdoc tests/run-make-fulldeps"
Expand All @@ -370,7 +370,7 @@ jobs:
NO_LLVM_ASSERTIONS: 1
NO_DEBUG_ASSERTIONS: 1
NO_OVERFLOW_CHECKS: 1
os: macos-12-xl
os: macos-latest
- name: dist-aarch64-apple
env:
SCRIPT: "./x.py dist bootstrap --include-default-paths --stage 2"
Expand All @@ -385,7 +385,7 @@ jobs:
NO_OVERFLOW_CHECKS: 1
DIST_REQUIRE_ALL_TOOLS: 1
JEMALLOC_SYS_WITH_LG_PAGE: 14
os: macos-12-xl
os: macos-latest
- name: x86_64-msvc-1
env:
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --enable-profiler"
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,8 @@ The default is {DEFAULT_EDITION} and the latest stable edition is {LATEST_STABLE
pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
vec![
opt::flag_s("h", "help", "Display this message"),
opt::multi_s("", "cfg", "Configure the compilation environment", "SPEC"),
opt::multi_s("", "cfg", "Configure the compilation environment.
SPEC supports the syntax `NAME[=\"VALUE\"]`.", "SPEC"),
opt::multi("", "check-cfg", "Provide list of valid cfg options for checking", "SPEC"),
opt::multi_s(
"L",
Expand Down
9 changes: 3 additions & 6 deletions library/core/src/hint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,14 @@ pub fn spin_loop() {
/// Note however, that `black_box` is only (and can only be) provided on a "best-effort" basis. The
/// extent to which it can block optimisations may vary depending upon the platform and code-gen
/// backend used. Programs cannot rely on `black_box` for *correctness*, beyond it behaving as the
/// identity function.
/// identity function. As such, it **must not be relied upon to control critical program behavior.**
/// This _immediately_ precludes any direct use of this function for cryptographic or security
/// purposes.
///
/// [`std::convert::identity`]: crate::convert::identity
///
/// # When is this useful?
///
/// First and foremost: `black_box` does _not_ guarantee any exact behavior and, in some cases, may
/// do nothing at all. As such, it **must not be relied upon to control critical program behavior.**
/// This _immediately_ precludes any direct use of this function for cryptographic or security
/// purposes.
///
/// While not suitable in those mission-critical cases, `black_box`'s functionality can generally be
/// relied upon for benchmarking, and should be used there. It will try to ensure that the
/// compiler doesn't optimize away part of the intended test code based on context. For
Expand Down
7 changes: 4 additions & 3 deletions library/std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2515,9 +2515,10 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
/// This function will traverse symbolic links to query information about the
/// destination file. In case of broken symbolic links this will return `Ok(false)`.
///
/// As opposed to the [`Path::exists`] method, this one doesn't silently ignore errors
/// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
/// denied on some of the parent directories.)
/// As opposed to the [`Path::exists`] method, this will only return `Ok(true)` or `Ok(false)`
/// if the path was _verified_ to exist or not exist. If its existence can neither be confirmed
/// nor denied, an `Err(_)` will be propagated instead. This can be the case if e.g. listing
/// permission is denied on one of the parent directories.
///
/// Note that while this avoids some pitfalls of the `exists()` method, it still can not
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios
Expand Down
8 changes: 5 additions & 3 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2844,9 +2844,11 @@ impl Path {
/// This function will traverse symbolic links to query information about the
/// destination file. In case of broken symbolic links this will return `Ok(false)`.
///
/// As opposed to the [`exists()`] method, this one doesn't silently ignore errors
/// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
/// denied on some of the parent directories.)
/// [`Path::exists()`] only checks whether or not a path was both found and readable. By
/// contrast, `try_exists` will return `Ok(true)` or `Ok(false)`, respectively, if the path
/// was _verified_ to exist or not exist. If its existence can neither be confirmed nor
/// denied, it will propagate an `Err(_)` instead. This can be the case if e.g. listing
/// permission is denied on one of the parent directories.
///
/// Note that while this avoids some pitfalls of the `exists()` method, it still can not
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios
Expand Down
9 changes: 7 additions & 2 deletions library/std/src/sys/wasi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ pub mod io;
#[path = "../unsupported/locks/mod.rs"]
pub mod locks;
pub mod net;
#[path = "../unsupported/once.rs"]
pub mod once;
pub mod os;
#[path = "../unix/os_str.rs"]
pub mod os_str;
Expand All @@ -51,6 +49,13 @@ pub mod thread_local_dtor;
pub mod thread_local_key;
pub mod time;

cfg_if::cfg_if! {
if #[cfg(not(target_feature = "atomics"))] {
#[path = "../unsupported/once.rs"]
pub mod once;
}
}

#[path = "../unsupported/common.rs"]
#[deny(unsafe_op_in_unsafe_fn)]
#[allow(unused)]
Expand Down
2 changes: 1 addition & 1 deletion src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ x--expand-yaml-anchors--remove:
<<: *base-job

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

- &job-windows-8c
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustdoc/src/how-to-read-rustdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ including automatic and blanket implementations that `rustdoc` knows about.
Subheadings, variants, fields, and many other things in this documentation
are anchors and can be clicked on and deep-linked to,
which is a great way to communicate exactly what you're talking about.
The typograpical character "§" appears next to lines with anchors on them
The typographical character "§" appears next to lines with anchors on them
when hovered or given keyboard focus.

## The Navigation Bar
Expand Down
8 changes: 4 additions & 4 deletions src/doc/rustdoc/src/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ If you know of other great resources, please submit a pull request!

## Community
- [API Guidelines]
- [Github tagged RFCs]
- [Github tagged issues]
- [GitHub tagged RFCs]
- [GitHub tagged issues]
- [RFC (stalled) front page styleguide]
- [Guide on how to write documentation for a Rust crate]


[API Guidelines]: https://rust-lang.github.io/api-guidelines/documentation.html
[Github tagged RFCs]: https://github.com/rust-lang/rfcs/issues?q=label%3AT-rustdoc
[Github tagged issues]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AT-rustdoc
[GitHub tagged RFCs]: https://github.com/rust-lang/rfcs/issues?q=label%3AT-rustdoc
[GitHub tagged issues]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AT-rustdoc
[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
[Learn Rust]: https://doc.rust-lang.org/book/ch14-02-publishing-to-crates-io.html#making-useful-documentation-comments
[RFC 1574: More API Documentation Conventions]: https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//! Should not be inlined

/// Should not be inlined
pub enum O {
L = -1,
}
10 changes: 10 additions & 0 deletions tests/rustdoc-json/reexport/doc_inline_external_crate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Regression Test for https://github.com/rust-lang/rust/issues/110138
// aux-build: enum_with_discriminant.rs

#[doc(inline)]
pub extern crate enum_with_discriminant;

// @!has '$.index[*][?(@.docs == "Should not be inlined")]'
// @is '$.index[*][?(@.name == "enum_with_discriminant")].kind' '"extern_crate"'
// @set enum_with_discriminant = '$.index[*][?(@.name == "enum_with_discriminant")].id'
// @is '$.index[*][?(@.name == "doc_inline_external_crate")].inner.items[*]' $enum_with_discriminant
10 changes: 10 additions & 0 deletions tests/rustdoc-json/reexport/extern_crate_glob.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// aux-build: enum_with_discriminant.rs

extern crate enum_with_discriminant;

#[doc(inline)]
pub use enum_with_discriminant::*;

// @!has '$.index[*][?(@.docs == "Should not be inlined")]'
// @set use = '$.index[*][?(@.inner.name == "enum_with_discriminant")].id'
// @is '$.index[*][?(@.name == "extern_crate_glob")].inner.items[*]' $use
3 changes: 0 additions & 3 deletions tests/rustdoc-ui/intra-doc/auxiliary/inner-crate-enum.rs

This file was deleted.

8 changes: 0 additions & 8 deletions tests/rustdoc-ui/intra-doc/inline-external-enum.rs

This file was deleted.

23 changes: 23 additions & 0 deletions tests/ui/associated-inherent-types/const-generics.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Regression test for issue #109759.
// check-pass

#![feature(inherent_associated_types)]
#![allow(incomplete_features)]

struct Foo;

struct Bar<const X: usize>([(); X]);

impl<const X: usize> Bar<X> {
pub fn new() -> Self {
Self([(); X])
}
}

impl Foo {
type Bar<const X: usize> = Bar<X>;
}

fn main() {
let _ = Foo::Bar::<10>::new();
}
28 changes: 28 additions & 0 deletions tests/ui/associated-inherent-types/generic-const-exprs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// check-pass

#![feature(inherent_associated_types, generic_const_exprs)]
#![allow(incomplete_features)]

struct Parent<const O: usize>;

impl<const O: usize> Parent<O> {
type Mapping<const I: usize> = Store<{ O + I }>
where
[(); O + I]:
;
}

struct Store<const N: usize>;

impl<const N: usize> Store<N> {
const REIFIED: usize = N;

fn reify() -> usize {
N
}
}

fn main() {
let _ = Parent::<2>::Mapping::<{ 12 * 2 }>::REIFIED;
let _ = Parent::<1>::Mapping::<{ 2 * 5 }>::reify();
}
10 changes: 7 additions & 3 deletions tests/ui/process/process-sigpipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
// libstd ignores SIGPIPE, and other libraries may set signal masks.
// Make sure that these behaviors don't get inherited to children
// spawned via std::process, since they're needed for traditional UNIX
// filter behavior. This test checks that `yes | head` terminates
// filter behavior.
// This test checks that `while echo y ; do : ; done | head` terminates
// (instead of running forever), and that it does not print an error
// message about a broken pipe.

// ignore-emscripten no threads support
// ignore-vxworks no 'sh'
// ignore-fuchsia no 'sh'
// ignore-nto no 'yes'

use std::process;
use std::thread;
Expand All @@ -27,7 +27,11 @@ fn main() {
thread::sleep_ms(5000);
process::exit(1);
});
let output = process::Command::new("sh").arg("-c").arg("yes | head").output().unwrap();
let output = process::Command::new("sh")
.arg("-c")
.arg("while echo y ; do : ; done | head")
.output()
.unwrap();
assert!(output.status.success());
assert!(output.stderr.len() == 0);
}
Expand Down

0 comments on commit ae3ab14

Please sign in to comment.