Remove uses of `mem::uninitialized()` from cloudabi
This PR removes uses of `mem::uninitialized` from `cloudabi` module,
excluding the layout test in `src/libstd/sys/cloudabi/abi/cloudabi.rs`.
r? @RalfJung
cc @EdSchouten
cc #62397
Add UWP MSVC targets
Hi,
- The README URI change is the correct one for VS2019 community edition, which I suspect most people would use. Doesn't _need_ to be merged though.
- This 5e6619edd1 fixes the UWP build (msvc or not, doesn't matter). I suspect it broke with recent changes unnoticed because no CI.
- Store lib location is found through the VCToolsInstallDir env variable. The end of the path is currently for the VS2019 store lib locations only.
- I could not test the aarch64_uwp_windows_msvc target because the rust build script does not currently support arm64 msvc AFAIU.
Add #[repr(transparent)] for several types
In some functions, types mentioned in this PR are transmuted into their inner value.
Example for `PathBuf`: https://github.com/rust-lang/rust/blob/master/src/libstd/path.rs#L1132.
This PR adds `#[repr(transparent)]` to those types, so their correct behavior doesn't depend on compiler details. (As far as I understand, currently that line, converting `PathBuf` to `Vec<u8>`, is UB).
Prevously the `read_to_end` implementation for `std::io::Take` used its
own `limit` as a cap on the `reservation_size`. However, that could
still result in an over-allocation like this:
1. Call `reader.take(5).read_to_end(&mut vec)`.
2. `read_to_end_with_reservation` reserves 5 bytes and calls `read`.
3. `read` writes 5 bytes.
4. `read_to_end_with_reservation` reserves 5 bytes and calls `read`.
5. `read` writes 0 bytes.
6. The read loop ends with `vec` having length 5 and capacity 10.
The reservation of 5 bytes was correct for the read at step 2 but
unnecessary for the read at step 4. By that second read, `Take::limit`
is 0, but the `read_to_end_with_reservation` loop is still using the
same `reservation_size` it started with.
Solve this by having `read_to_end_with_reservation` take a closure,
which lets it get a fresh `reservation_size` for each read. This is an
implementation detail which doesn't affect any public API.
Explaining the reason why validation is performed in to_str of path.rs
I thought it's good to explain the reason for the validation during the conversion between Path/PathBuffer into str, which explains the reason for returning an Option at this point (good for beginners who are reading through the docs).
Rollup of 7 pull requests
Successful merges:
- #63107 (Added support for armv7-unknown-linux-gnueabi/musleabi)
- #63121 (On `format!()` arg count mismatch provide extra info)
- #63196 (build_helper: try less confusing method names)
- #63206 (remove unsupported test case)
- #63208 (Round generator sizes to a multiple of their alignment)
- #63212 (Pretty print attributes in `print_arg`)
- #63215 (Clarify semantics of mem::zeroed)
Failed merges:
r? @ghost
provide thread name to OS for Solarish systems
Fixes#62302
Passes a Linux bootstrap build. python x.py test src/tools/tidy happy.
I tested this with a small test binary that spawns a few threads, and verified
that:
- on an illumos system lacking the libc function, the binary runs but no OS-level
thread names are set
- on an illumos system with the feature, the binary runs, and the thread names are
visible and correct under tools like MDB, pstack, core dump, etc.
Rollup of 8 pull requests
Successful merges:
- #62644 (simplify std::io::Write::write rustdoc)
- #62971 (Add keywords item into the sidebar)
- #63122 (Account for `maybe_whole_expr` in range patterns)
- #63158 (Add test for issue-58951)
- #63170 (cleanup StringReader fields)
- #63179 (update test cases for vxWorks)
- #63188 (Fix typos in release notes.)
- #63191 (ci: fix toolstate not pushing data for Linux)
Failed merges:
r? @ghost
simplify std::io::Write::write rustdoc
The std::io::Write::write method currensly suggests consumers guaranteed
that `0 <= n <= buf.len()`, for `Ok(n)`, however `n` is of type `usize`
causing the compiler to emit a warning:
```
warning: comparison is useless due to type limits
--> lib.rs:6:18
|
6 | Ok(n) => 0 <= n && n <= output.len(),
| ^^^^^^
|
= note: #[warn(unused_comparisons)] on by default
```
This PR removes the suggestion to check `0 <= n` since it is moot.
r? @steveklabnik
Remove derives `Encodable`/`Decodable` and unstabilize attribute `#[bench]`
`Encodable` and `Decodable` were deprecated before 1.0 and emitted an unsuppressable warning all this time.
`#[bench]` is a part of the custom test framework feature and cannot be used meaningfully on stable, only as `cfg(false)`.
Crater results can be found in https://github.com/rust-lang/rust/pull/62507#issuecomment-513850732 and below.
This PR also reroutes the tracking issue for `feature(test)` from #27812 (compiler internals) to #50297 (custom test frameworks).
Closes https://github.com/rust-lang/rust/issues/62048