| Age | Commit message (Collapse) | Author | Lines |
|
Add enum_intrinsics_non_enums lint
There is a clippy lint to prevent calling [`mem::discriminant`](https://doc.rust-lang.org/std/mem/fn.discriminant.html) with a non-enum type. I think the lint is worthy of being included in rustc, given that `discriminant::<T>()` where `T` is a non-enum has an unspecified return value, and there are no valid use cases where you'd actually want this.
I've also made the lint check [variant_count](https://doc.rust-lang.org/core/mem/fn.variant_count.html) (#73662).
closes #83899
|
|
Rollup of 7 pull requests
Successful merges:
- #89655 (bootstrap: don't use `--merges` to look for commit hashes for downloading artifacts)
- #89726 (Add #[must_use] to alloc constructors)
- #89729 (Add #[must_use] to core and std constructors)
- #89743 (Fix RUSTC_LOG handling)
- #89753 (Add #[must_use] to from_value conversions)
- #89754 (Cleanup .item-table CSS)
- #89761 (:arrow_up: rust-analyzer)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
:arrow_up: rust-analyzer
r? ``@ghost``
|
|
Cleanup .item-table CSS
The main table-like element must be `display: table;`
r? `@GuillaumeGomez`
|
|
r=joshtriplett
Add #[must_use] to from_value conversions
I added two methods to the list myself. Clippy did not flag them because they take `mut` args, but neither modifies their argument.
```rust
core::str const unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str;
std::ffi::CString unsafe fn from_raw(ptr: *mut c_char) -> CString;
```
I put a custom note on `from_raw`:
```rust
#[must_use = "call `drop(from_raw(ptr))` if you intend to drop the `CString`"]
pub unsafe fn from_raw(ptr: *mut c_char) -> CString {
```
Parent issue: #89692
r? ``@joshtriplett``
|
|
Fix RUSTC_LOG handling
Rustc was incorrectly reading the value of `RUSTC_LOG` as the environment vairable with the logging configuration, rather than the logging configuration itself.
|
|
r=joshtriplett
Add #[must_use] to core and std constructors
Parent issue: #89692
r? ``@joshtriplett``
|
|
Add #[must_use] to alloc constructors
Added `#[must_use]`. to the various forms of `new`, `pin`, and `with_capacity` in the `alloc` crate. No extra explanations given as I couldn't think of anything useful to add.
I figure this deserves extra scrutiny compared to the other PRs I've done so far. In particular:
* The 4 `pin`/`pin_in` methods I touched. Are there legitimate use cases for pinning and not using the result? Pinning's a difficult concept I'm not very comfortable with.
* `Box`'s constructors. Do people ever create boxes just for the side effects... allocating or zeroing out memory?
Parent issue: #89692
r? ``@joshtriplett``
|
|
bootstrap: don't use `--merges` to look for commit hashes for downloading artifacts
Shallow clones (and possibly worktrees, though I can't seem to reproduce the problem there) can cause `git rev-list --merges` to falsely return no results, even if a merge commit is present. Stop using the `--merges` option when looking for commit hashes that have build artifacts. `--first-parent` and `--author=bors@rust-lang.org` should be sufficient.
Also exit with an error if the configuration asks for artifacts to be downloaded and we can't determine an appropriate commit hash to use to download artifacts.
Fixes #87890.
r? ``@jyn514``
``@rustbot`` label +A-rustbuild +A-contributor-roadblock
|
|
Apply clippy suggestions for rustc and core
|
|
|
|
This lint has been uplifted and is now included in
enum_intrinsics_non_enums.
|
|
|
|
r=joshtriplett
Add #[must_use] to conversions that move self
Everything here got the same message. Is the wording okay?
```rust
#[must_use = "`self` will be dropped if the result is not used"]
```
I want to draw attention to these methods in particular:
```rust
alloc::sync::Arc<MaybeUninit<T>> unsafe fn assume_init(self) -> Arc<T>;
alloc::sync::Arc<[MaybeUninit<T>]> unsafe fn assume_init(self) -> Arc<[T]>;
core::pin::Pin<&'a mut T> const fn into_ref(self) -> Pin<&'a T>;
core::pin::Pin<&'a mut T> const fn get_mut(self) -> &'a mut T;
core::pin::Pin<&'a mut T> const unsafe fn get_unchecked_mut(self) -> &'a mut T;
core::pin::Pin<&'a mut T> unsafe fn map_unchecked_mut(self, func: F) -> Pin<&'a mut U>;
core::pin::Pin<&'a mut Pin<P>> fn as_deref_mut(self) -> Pin<&'a mut P::Target>;
```
Parent issue: #89692
r? `@joshtriplett`
|
|
|
|
|
|
Create more accurate debuginfo for vtables.
Before this PR all vtables would have the same name (`"vtable"`) in debuginfo. Now they get an unambiguous name that identifies the implementing type and the trait that is being implemented.
This is only one of several possible improvements:
- This PR describes vtables as arrays of `*const u8` pointers. It would nice to describe them as structs where function pointer is represented by a field with a name indicative of the method it maps to. However, this requires coming up with a naming scheme that avoids clashes between methods with the same name (which is possible if the vtable contains multiple traits).
- The PR does not update the debuginfo we generate for the vtable-pointer field in a fat `dyn` pointer. Right now there does not seem to be an easy way of getting ahold of a vtable-layout without also knowing the concrete self-type of a trait object.
r? `@wesleywiser`
|
|
Rollup of 6 pull requests
Successful merges:
- #89579 (Add regression test for issue 80108)
- #89632 (Fix docblock code display on mobile)
- #89691 (Move `DebuggerCommands` and `check_debugger_output` to a separate module)
- #89707 (Apply clippy suggestions for std)
- #89722 (Fix spelling: Cannonical -> Canonical)
- #89736 (Remove unused CSS rule)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
|
|
|
|
Remove unused CSS rule
As you can see in the firefox devtools:

It needs the display to be `grid` or `inline-grid`, which isn't the case.
r? `@dns2utf8`
|
|
Fix spelling: Cannonical -> Canonical
|
|
r=Mark-Simulacrum
Apply clippy suggestions for std
|
|
Move `DebuggerCommands` and `check_debugger_output` to a separate module
Work towards #89475.
As part of this move, the public functions were changed to return `Result`. This is so that the error handling that initially took `&self: TestCx` can still use that `TestCx`.
|
|
Fix docblock code display on mobile
Fixes https://github.com/rust-lang/rust/issues/89618.
Before:

After:

r? `@jsha`
|
|
Add regression test for issue 80108
Closes #80108
|
|
Cleanup src/test/ui/{simd,simd-intrinsic}
Initial motivation was to simplify a huge macro expansion using a tuple, since we can just use an array in `#[repr(simd)]` now for the same result. But also, several tests were going unnoticed during development of SIMD intrinsics because people kept looking in the wrong directory, and many are basically run-pass vs. build-fail versions of the same tests, so let's keep them close together and simplify their names, so they're easier to sift through.
|
|
|
|
Rollup of 11 pull requests
Successful merges:
- #88374 (Fix documentation in Cell)
- #88713 (Improve docs for int_log)
- #89428 (Feature gate the non_exhaustive_omitted_patterns lint)
- #89438 (docs: `std::hash::Hash` should ensure prefix-free data)
- #89520 (Don't rebuild GUI test crates every time you run test src/test/rustdoc-gui)
- #89705 (Cfg hide no_global_oom_handling and no_fp_fmt_parse)
- #89713 (Fix ABNF of inline asm options)
- #89718 (Add #[must_use] to is_condition tests)
- #89719 (Add #[must_use] to char escape methods)
- #89720 (Add #[must_use] to math and bit manipulation methods)
- #89735 (Stabilize proc_macro::is_available)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Rustc was incorrectly reading the value of `RUSTC_LOG` as the
environment vairable with the logging configuration, rather than the
logging configuration itself.
|
|
r=petrochenkov
Stabilize proc_macro::is_available
Tracking issue: https://github.com/rust-lang/rust/issues/71436
The FCP for the stabilization of `proc_macro::is_available` has completed.
|
|
Add #[must_use] to math and bit manipulation methods
Also tidied up a few other nearby `#[must_use]`s.
Parent issue: #89692
|
|
Add #[must_use] to char escape methods
Parent issue: #89692
|
|
Add #[must_use] to is_condition tests
There's nothing insightful to say about these so I didn't write any extra explanations.
Parent issue: #89692
|
|
Fix ABNF of inline asm options
This is the case since #73227.
r? `@camelid`
|
|
Cfg hide no_global_oom_handling and no_fp_fmt_parse
These are unstable sysroot customisation cfg options that only projects building their own sysroot will use (e.g. Rust-for-linux). Most users shouldn't care. `no_global_oom_handling` can be especially annoying since it's applied on many commonly used alloc crate methods (e.g. `Box::new`, `Vec::push`).
r? ```@GuillaumeGomez```
|
|
r=Mark-Simulacrum
Don't rebuild GUI test crates every time you run test src/test/rustdoc-gui
This method has multiple advantages:
* It'll completely remove the rustdoc-GUI test doc folder if rustdoc was updated
* It'll rebuild GUI test crates only they have been updated
All in all, it's quite convenient! (even more with https://github.com/rust-lang/rust/pull/88816)
r? ```@Mark-Simulacrum```
|
|
docs: `std::hash::Hash` should ensure prefix-free data
Attempt to synthesize the discussion in #89429 into a suggestion regarding `Hash` implementations (not a hard requirement).
Closes #89429.
|
|
Feature gate the non_exhaustive_omitted_patterns lint
Fixes https://github.com/rust-lang/rust/issues/89374
Add the machinery to gate the new `non_exhaustive_omitted_patterns` lint.
relates to https://github.com/rust-lang/rust/pull/89105 and https://github.com/rust-lang/rust/pull/89423
|
|
Improve docs for int_log
* Clarify rounding.
* Avoid "wrapping" wording.
* Omit wrong claim on 0 only being returned in error cases.
* Typo fix for one_less_than_next_power_of_two.
|
|
Fix documentation in Cell
|
|
Show detailed expected/found types in error message when trait paths are the same
Fixes #65230.
### Issue solved by this PR
```rust
trait T {
type U;
fn f(&self) -> Self::U;
}
struct X<'a>(&'a mut i32);
impl<'a> T for X<'a> {
type U = &'a i32;
fn f(&self) -> Self::U {
self.0
}
}
fn main() {}
```
Compiler generates the following note:
```
note: ...so that the types are compatible
--> test.rs:10:28
|
10 | fn f(&self) -> Self::U {
| ____________________________^
11 | | self.0
12 | | }
| |_____^
= note: expected `T`
found `T`
```
This note is not useful since the expected type and the found type are the same.
### How this PR solve the issue
When the expected type and the found type are exactly the same in string representation, the note falls back to the detailed string representation of trait ref:
```
note: ...so that the types are compatible
--> test.rs:10:28
|
10 | fn f(&self) -> Self::U {
| ____________________________^
11 | | self.0
12 | | }
| |_____^
= note: expected `<X<'a> as T>`
found `<X<'_> as T>`
```
So that a user can notice what was different between the expected one and the found one.
|
|
|
|
|
|
|
|
Use get_unchecked in str::[r]split_once
This PR removes indices checking in `str::split_once` and `str::rsplit_once` methods.
|
|
|
|
|
|
|
|
|