Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #129663

Closed
wants to merge 38 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

RalfJung and others added 30 commits August 25, 2024 17:46
A partial stabilization that only affects:
- AllocType<T>::new_uninit
- AllocType<T>::assume_init
- AllocType<[T]>::new_uninit_slice
- AllocType<[T]>::assume_init
where "AllocType" is Box, Rc, or Arc
Plus a tiny bit of reformatting.
…ion-of-stabilization, r=dtolnay

Partially stabilize `feature(new_uninit)`

Finished comment period: rust-lang#63291 (comment)

The following API has been stabilized from rust-lang#63291

```rust
impl<T> Box<T> { pub fn new_uninit() -> Box<MaybeUninit<T>> {…} }
impl<T> Rc<T> { pub fn new_uninit() -> Rc<MaybeUninit<T>> {…} }
impl<T> Arc<T> { pub fn new_uninit() -> Arc<MaybeUninit<T>> {…} }

impl<T> Box<[T]> { pub fn new_uninit_slice(len: usize) -> Box<[MaybeUninit<T>]> {…} }
impl<T> Rc<[T]> { pub fn new_uninit_slice(len: usize) -> Rc<[MaybeUninit<T>]> {…} }
impl<T> Arc<[T]> { pub fn new_uninit_slice(len: usize) -> Arc<[MaybeUninit<T>]> {…} }

impl<T> Box<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Box<T> {…} }
impl<T> Box<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Box<[T]> {…} }
impl<T> Rc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Rc<T> {…} }
impl<T> Rc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Rc<[T]> {…} }
impl<T> Arc<MaybeUninit<T>> { pub unsafe fn assume_init(self) -> Arc<T> {…} }
impl<T> Arc<[MaybeUninit<T>]> { pub unsafe fn assume_init(self) -> Arc<[T]> {…} }
```

The remaining API is split between new issues
- `new_zeroed_alloc`: rust-lang#129396
- `box_uninit_write`: rust-lang#129397

All relevant code is thus either stabilized or split out of that issue, so this closes rust-lang#63291 as, with the FCP concluded, that issue has served its purpose.

try-job: x86_64-rust-for-linux
exit: explain our expectations for the exit handlers registered in a Rust program

This documents the position of `@Amanieu` and others in rust-lang#126600: a library with an atexit handler that destroys state that other threads could still be working on is buggy. We do not consider it acceptable for a library to say "you must call the following cleanup function before exiting from `main` or calling `exit`". I don't know if this is established `@rust-lang/libs-api`  consensus so I presume this will have to go through FCP.

Given that Rust supports concurrency, I don't think there is any way to write a sound Rust wrapper around a library that has such a required cleanup function: even if we made `exit` unsafe, and the Rust wrapper used the scope-with-callback approach to ensure it can run cleanup code before returning from the wrapper (like `thread::scope`), one could still call this wrapper in a second thread and then return from `main` while the wrapper runs. Making this sound would require `std` to provide a way to "block" returning from `main`, so that while the wrapper runs returning from `main` waits until the wrapper is done... that just doesn't seem feasible.

The `exit` docs do not seem like the best place to document this, but I also couldn't think of a better one.
…tlarsan68

Fix tidy to allow `edition = "2024"` in `Cargo.toml`

Needed to upgrade to edition 2024 eventually.
…pastorino

Use unsafe extern blocks throughout the compiler

Making this change in preparation for edition 2024.

r? spastorino
Fix typos in floating-point primitive type docs

Fixes a few typos. Also reflows the text of a couple of paragraphs in the source code to the standard line width to make the source easier to read (will have no effect on the rendered documentation).
…rgau

More `unreachable_pub`

Add `unreachable_pub` checking to some more compiler crates. A follow-up to rust-lang#126013.

r? `@Urgau`
…r=petrochenkov

ABI compat check: detect unadjusted ABI mismatches
fix Pointer to reference conversion docs

The aliasing rules documented in rust-lang#128157 are wrong, this fixes them.
@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Aug 27, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=8

@bors
Copy link
Contributor

bors commented Aug 27, 2024

📌 Commit 8d6aafa has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 27, 2024
@bors
Copy link
Contributor

bors commented Aug 27, 2024

⌛ Testing commit 8d6aafa with merge 246d2bd...

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 27, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#129401 (Partially stabilize `feature(new_uninit)`)
 - rust-lang#129581 (exit: explain our expectations for the exit handlers registered in a Rust program)
 - rust-lang#129634 (Fix tidy to allow `edition = "2024"` in `Cargo.toml`)
 - rust-lang#129635 (Use unsafe extern blocks throughout the compiler)
 - rust-lang#129645 (Fix typos in floating-point primitive type docs)
 - rust-lang#129648 (More `unreachable_pub`)
 - rust-lang#129649 (ABI compat check: detect unadjusted ABI mismatches)
 - rust-lang#129652 (fix Pointer to reference conversion docs)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
## Running ui tests in tests/fail for x86_64-unknown-linux-gnu
   Compiler: "MIRI_ENV_VAR_TEST"="0" "MIRI_TEMP"="/tmp/miri-uitest-s6GFTR" "RUST_BACKTRACE"="1" /checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/miri "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-unknown-linux-gnu" "--out-dir" OUT_DIR

FAILED TEST: tests/fail/weak_memory/weak_uninit.rs
command: MIRI_ENV_VAR_TEST="0" MIRI_TEMP="/tmp/miri-uitest-s6GFTR" RUST_BACKTRACE="1" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1/bin/miri" "--error-format=json" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/miri-sysroot" "-Dwarnings" "-Dunused" "-Ainternal_features" "-Zui-testing" "--target" "x86_64-unknown-linux-gnu" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/miri_ui/tests/fail/weak_memory" "tests/fail/weak_memory/weak_uninit.rs" "-Zmiri-ignore-leaks" "-Zmiri-preemption-rate=0" "--edition" "2021"
error: actual output differed from expected
Execute `./miri test --bless` to update `tests/fail/weak_memory/weak_uninit.stderr` to the actual output
--- tests/fail/weak_memory/weak_uninit.stderr
+++ <stderr output>
+++ <stderr output>
-error: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
+error: the feature `new_uninit` has been stable since 1.82.0-nightly and no longer requires an attribute to enable
   --> $DIR/weak_uninit.rs:LL:CC
    |
-LL |     let j2 = spawn(move || x.load(Ordering::Relaxed));
+LL | #![feature(new_uninit)]
-   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
    |
-   = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
+   = note: `-D stable-features` implied by `-D warnings`
-   = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
---

error: `using uninitialized data` not found in diagnostics on line 32
##[error]  --> tests/fail/weak_memory/weak_uninit.rs:32:66
   |
32 |     let j2 = spawn(move || x.load(Ordering::Relaxed)); //~ERROR: using uninitialized data
   |

error: there were 1 unmatched diagnostics that occurred outside the testfile and had no pattern
    Error: miri cannot be run on programs that fail compilation
---
Error: 
   0: ui tests in tests/fail for x86_64-unknown-linux-gnu failed
   1: tests failed

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
error: test failed, to rerun pass `--test ui`
Caused by:
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/ui-6a48dc8439ad88a0 --quiet` (exit status: 1)
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/ui-6a48dc8439ad88a0 --quiet` (exit status: 1)
Command has failed. Rerun with -v to see more details.
  local time: Tue Aug 27 16:48:49 UTC 2024
  network time: Tue, 27 Aug 2024 16:48:49 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants