When a tail expression isn't unit, we previously always suggested adding
a trailing `;` to turn it into a statement. This suggestion isn't
appropriate for any expression that doesn't have side-effects, as the
user will have likely wanted to call something else or do something with
the resulting value, instead of just discarding it.
Some newcomers are confused by the behavior of tail expressions,
interpreting that "leaving out the `;` makes it the return value".
To help them go in the right direction, suggest using `return` instead
when applicable.
[intra-doc links] Don't check feature gates of items re-exported across crates
It should be never break another crate to re-export a public item.
Note that this doesn't check the feature gate at
*all* for other crates:
- Feature-gates aren't currently serialized, so the only way to check
the gate is with ad-hoc attribute checking.
- Checking the feature gate twice (once when documenting the original
crate and one when documenting the current crate) seems not great.
This should still catch using the feature most of the time though, since
people tend to document their own crates.
Closes https://github.com/rust-lang/rust/issues/82284.
r? `@Manishearth`
Enums on hexagon use a smallest size (but at least 1 byte) that fits all
the enumeration values. This is unlike many other ABIs where enums are
at least 32 bits.
Rollup of 11 pull requests
Successful merges:
- #81300 (BTree: share panicky test code & test panic during clear, clone)
- #81706 (Document BinaryHeap unsafe functions)
- #81833 (parallelize x.py test tidy)
- #81966 (Add new `rustc` target for Arm64 machines that can target the iphonesimulator)
- #82154 (Update RELEASES.md 1.50 to include methods stabilized in #79342)
- #82177 (Do not delete bootstrap.exe on Windows during clean)
- #82181 (Add check for ES5 in CI)
- #82229 (Add [A-diagnostics] bug report template)
- #82233 (try-back-block-type test: Use TryFromSliceError for From test)
- #82302 (Remove unsafe impl Send for CompletedTest & TestResult)
- #82349 (test: Print test name only once on timeout)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Fix some Python2→3 error in publish_toolstate.py
Fix#82254.
The error is primarily due to `data = json.dumps(…)` producing a `str` instead of a `bytes`, which are different types on Python 3. But then `urllib.request.urlopen(…, data)` cannot accept `data` as a `str`, thus the error.
This PR added `.encode()` call after `json.dumps()` to ensure we are sending `bytes`. Additionally, we added type annotation to ensure things can statically type-check with `mypy` on both Python 2 and 3.
test: Print test name only once on timeout
Pretty formatter when using multiple test threads displays test name twice on
timeout event. This implicitly suggest that those are two different events,
while in fact they are always printed together.
Print test name only once.
Before:
```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) ... test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```
After:
```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```
try-back-block-type test: Use TryFromSliceError for From test
Using `i32` is rather fragile because it has many implementations. Recently in an early draft of another MR (#82228) I did something that introduced a new `i32 as From<something>` impl and this test broke.
TryFromSliceError is nice because it doesn't seem likely to grow new conversions. We still have one conversion, from Infallible.
My other MR is going to be reworked and won't need this any more but having done it I thought I would submit it rather than just throw it away. Sorry for the tiny MR.
Do not delete bootstrap.exe on Windows during clean
Windows does not allow deleting currently running executables.
This an addition to ```@jyn514's``` change in https://github.com/rust-lang/rust/pull/80574.
Add new `rustc` target for Arm64 machines that can target the iphonesimulator
This PR lands a new target (`aarch64-apple-ios-sim`) that targets arm64 iphone simulator, previously unreachable from Apple Silicon machines.
resolves#81632
r? `@shepmaster`
parallelize x.py test tidy
Running tidy on individual commits when rewriting git history was somewhat of an annoyance, so I have parallelized it a bit.
running `time ./x.py test tidy` with warm IO caches:
old:
```
real 0m11.123s
user 0m14.495s
sys 0m5.227s
```
new:
```
real 0m1.834s
user 0m13.545s
sys 0m3.094s
```
There's further room for improvement (<0.9s should be feasible) but that would require bigger changes.
Document BinaryHeap unsafe functions
`BinaryHeap` contains some private safe functions but that are actually unsafe to call. This PR marks them `unsafe` and documents all the `unsafe` function calls inside them.
While doing this I might also have found a bug: some "SAFETY" comments in `sift_down_range` and `sift_down_to_bottom` are valid only if you assume that `child` doesn't overflow. However it may overflow if `end > isize::MAX` which can be true for ZSTs (but I think only for them). I guess the easiest fix would be to skip any sifting if `mem::size_of::<T> == 0`.
Probably conflicts with #81127 but solving the eventual merge conflict should be pretty easy.
BTree: share panicky test code & test panic during clear, clone
Bases almost all tests of panic on the same, richer definition, and extends it to cloning to test panic during clone.
r? ```@Mark-Simulacrum```
Improve assert_eq! and assert_ne!
This PR improves `assert_eq!` and `assert_ne!` by moving the panicking code in an external function.
It does not change the fast path, but the move of the formatting in the cold path (the panic) may have a positive effect on in instruction cache use and with inlining.
Moreover, the use of trait objects instead of generic may improve compile times for `assert_eq!`-heavy code.
Godbolt link: ~~https://rust.godbolt.org/z/TYa9MT~~ \
Updated: https://rust.godbolt.org/z/bzE84x
Pretty formatter when using multiple test threads displays test name twice on
timeout event. This implicitly suggest that those are two different events,
while in fact they are always printed together.
Print test name only once.
Before:
```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) ... test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```
After:
```
running 3 tests
test src/lib.rs - c (line 16) ... ok
test src/lib.rs - a (line 3) ... ok
test src/lib.rs - b (line 9) has been running for over 60 seconds
test src/lib.rs - b (line 9) ... ok
```