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 9 pull requests #120226

Merged
merged 25 commits into from
Jan 22, 2024
Merged

Rollup of 9 pull requests #120226

merged 25 commits into from
Jan 22, 2024

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

The-Ludwig and others added 25 commits December 7, 2023 17:50
- lint if the lock was in a nested pattern
- lint if the lock is inside a `Result<Lock, _>`
This shortens the `#[must_use]` diagnostics displayed, in light of the [review comment](https://github.com/rust-lang/rust/pull/62431/files#r300819839) on when this was originally added.
We have several methods indicating the presence of errors, lint errors,
and delayed bugs. I find it frustrating that it's very unclear which one
you should use in any particular spot. This commit attempts to instill a
basic principle of "use the least general one possible", because that
reflects reality in practice -- `has_errors` is the least general one
and has by far the most uses (esp. via `abort_if_errors`).

Specifics:
- Add some comments giving some usage guidelines.
- Prefer `has_errors` to comparing `err_count` to zero.
- Remove `has_errors_or_span_delayed_bugs` because it's a weird one: in
  the cases where we need to count delayed bugs, we should really be
  counting lint errors as well.
- Rename `is_compilation_going_to_fail` as
  `has_errors_or_lint_errors_or_span_delayed_bugs`, for consistency with
  `has_errors` and `has_errors_or_lint_errors`.
- Change a few other `has_errors_or_lint_errors` calls to `has_errors`,
  as per the "least general" principle.

This didn't turn out to be as neat as I hoped when I started, but I
think it's still an improvement.
…_field, r=Nilstrieb

 Explanation that fields are being used when deriving `(Partial)Ord` on enums

When deriving `std::cmp::Ord` or `std::cmp::PartialOrd` on enums, their fields are compared if the variants are equal.
This means that the last assertion in the following snipped panics.
```rust
use std::cmp::{PartialEq, Eq, PartialOrd, Ord};

#[derive(PartialEq, Eq, PartialOrd, Ord)]
enum Sizes {
    Small(usize),
    Big(usize),
}

fn main() {
    let a = Sizes::Big(3);
    let b = Sizes::Big(5);
    let c = Sizes::Small(10);
    assert!( c < a);
    assert_eq!(a, c);
}
```

This is more often expected behavior than not, and can be easily circumvented, as discussed in [this thread](https://users.rust-lang.org/t/how-to-sort-enum-variants/52291/4).
But it is addressed nowhere in the documentation, yet.
So I stumbled across this, as I personally did not expect fields being used in `PartialOrd`.
I added the explanation to the documentation.
Improve `let_underscore_lock`

- lint if the lock was in a nested pattern
- lint if the lock is inside a `Result<Lock, _>`

addresses rust-lang#119704 (comment)
…lstrieb

Tweak Library Integer Division Docs

Improved the documentation and diagnostics related to panicking in the division-like methods in std:

* For signed methods that can overflow, clarified "results in overflow" to "self is -1 and rhs is Self::MIN." This is more concise than saying "results in overflow" and then explaining how it could overflow.
* For floor/ceil_div, corrected the documentation and made it more like the documentation in other methods.
* For signed methods that can overflow, explicitly mention that they are not affected by compiler flags.
* Removed all unused rustc_inherit_overflow_checks attributes. The non-division-like operations will never overflow.
* Added track_caller attributes to all methods that can panic. The panic messages will always be correct. For example, division methods all have / before %.
* Edited the saturating_div documentation to be consistent with similar methods.
…odals, r=fmease

rustdoc: hide modals when resizing the sidebar

Follow-up for
rust-lang#119477 (comment)

CC `@lukas-code`
…compiler-errors,oli-obk

Fix error counting

There is some messiness in how errors get counted. Here are some cleanups.

r? `@compiler-errors`
…-option-must-use, r=Nilstrieb

Shorten `#[must_use]` Diagnostic Message for `Option::is_none`

This shortens the `#[must_use]` diagnostics displayed, in light of the [review comment](https://github.com/rust-lang/rust/pull/62431/files#r300819839) on when this was originally added.
…link, r=dtolnay

Correct the anchor of an URL in an error message

Following error message from rustc points to a URL, but its anchor does not exist.
The destination seems to be https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib.
This PR makes that correction.

      = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)
…ler-errors

Replace `#!/bin/bash` with `#!/usr/bin/env bash` in rust-installer tests

This allows the rust-installer tests to pass on NixOS

This change has [already been made](rust-lang@302ad21) for the actual installer, it appears that the tests were just forgotten.
…r=compiler-errors

Give nnethercote more reviews

Gulp!
@rustbot rustbot added A-meta Area: Issues about the rust-lang/rust repository. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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. labels Jan 22, 2024
@rustbot rustbot added T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jan 22, 2024
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=9

@bors
Copy link
Contributor

bors commented Jan 22, 2024

📌 Commit 610f13d 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 Jan 22, 2024
@bors
Copy link
Contributor

bors commented Jan 22, 2024

⌛ Testing commit 610f13d with merge 366d112...

@bors
Copy link
Contributor

bors commented Jan 22, 2024

☀️ Test successful - checks-actions
Approved by: matthiaskrgr
Pushing 366d112 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 22, 2024
@bors bors merged commit 366d112 into rust-lang:master Jan 22, 2024
12 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 22, 2024
@rust-timer
Copy link
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#118714 Explanation that fields are being used when deriving `(Par… 2ba815329a5a562523f6f53d651009f9acefb403 (link)
#119710 Improve let_underscore_lock b983667f8fcf635f99e0d3fd50c404973c2386c2 (link)
#119726 Tweak Library Integer Division Docs 5316692d93c9cf03d80fb2322f526ca35b9ed53c (link)
#119746 rustdoc: hide modals when resizing the sidebar ce78e5f82aa22f46a19750215d06495af6f21fff (link)
#119986 Fix error counting 1ed6980c64c775a4c73aa0e48b6114b01f1cfb31 (link)
#120194 Shorten #[must_use] Diagnostic Message for `Option::is_no… 98cfdabded9677834673b04ef9c100502ce0914a (link)
#120200 Correct the anchor of an URL in an error message a77de4856132a69c58de8ce08070a2fa2ab3151f (link)
#120203 Replace #!/bin/bash with #!/usr/bin/env bash in rust-in… 30170712b944b0234f3856af5af94add4f5d7e86 (link)
#120212 Give nnethercote more reviews 9818111c594af3f0583785c8b18cc16a047ada23 (link)

previous master: 6fff796eac

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (366d112): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.8% [2.8%, 2.9%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.2% [-2.2%, -2.2%] 1
Improvements ✅
(secondary)
-2.2% [-3.9%, -0.9%] 7
All ❌✅ (primary) 1.1% [-2.2%, 2.9%] 3

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [-0.2%, 0.1%] 3

Bootstrap: 662.296s -> 663.975s (0.25%)
Artifact size: 308.38 MiB -> 308.39 MiB (0.00%)

@matthiaskrgr matthiaskrgr deleted the rollup-9xwx0si branch March 16, 2024 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues about the rust-lang/rust repository. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) merged-by-bors This PR was explicitly merged by bors. 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.