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

x clippy #2

Closed
wants to merge 2,674 commits into from
Closed

x clippy #2

wants to merge 2,674 commits into from

Conversation

jyn514
Copy link
Owner

@jyn514 jyn514 commented Nov 4, 2023

No description provided.

The Miri Conjob Bot and others added 20 commits December 4, 2023 05:03
Now using a window of 3 instead 2 because it removes any
confusion about exactly how consecutive windows overlap
…hercote

Exhaustiveness: allocate memory better

Exhaustiveness is a recursive algorithm that allocates a bunch of slices at every step. Let's see if I can improve performance by improving allocations.

Already just using `Vec::with_capacity` is showing impressive improvements on my local measurements.

r? `@ghost`
They each have a single call site.

Note: the `make_diagnostic_builder` calls in `lib.rs` will be replaced
in a subsequent commit.
`sess` is a terribly misleading name for a `Handler`! This confused me
for a bit.
That's what is mostly used. This commit changes a few `EM` and `E` and
`T` type variables to `G`.
`Diagnostic::new` can be used instead.
These impls are all needed for just a single `IntoDiagnostic` type, not
a family of them.

Note that `ErrorGuaranteed` is the default type parameter for
`IntoDiagnostic`.
By making it generic, instead of only for `EmissionGuarantee = ()`, we
can use it everywhere.
`Handler` is a wrapper around `HanderInner`. Some functions on
on `Handler` just forward to the samed-named functions on
`HandlerInner`.

This commit removes as many of those as possible, implementing functions
on `Handler` where possible, to avoid the boilerplate required for
forwarding. The commit is moderately large but it's very mechanical.
This is weird: `HandlerInner::emit` calls
`HandlerInner::emit_diagnostic`, but only after doing a
`treat-err-as-bug` check. Which is fine, *except* that there are
multiple others paths for an `Error` or `Fatal` diagnostic to be passed
to `HandlerInner::emit_diagnostic` without going through
`HandlerInner::emit`, e.g. `Handler::span_err` call
`Handler::emit_diag_at_span`, which calls `emit_diagnostic`.
So that suggests that the coverage for `treat-err-as-bug` is incomplete.

This commit removes `HandlerInner::emit` and moves the
`treat-err-as-bug` check to `HandlerInner::emit_diagnostic`, so it
cannot by bypassed.
This makes `Handler::fatal` more like `Handler::{err,warn,bug,note}`.
…` format strings

This commit restricts what symbols can be used in a format string for
any option of the `diagnostic::on_unimplemented` attribute. We
previously allowed all the ad-hoc options supported by the internal
`#[rustc_on_unimplemented]` attribute. For the stable attribute we only
want to support generic parameter names and `{Self}` as parameters.  For
any other parameter an warning is emitted and the parameter is replaced
by the literal parameter string, so for example `{integer}` turns into
`{integer}`. This follows the general design of attributes in the
`#[diagnostic]` attribute namespace, that any syntax "error" is treated
as warning and subsequently ignored.
bors and others added 24 commits December 8, 2023 02:28
…3, r=BoxyUwU

split `NormalizesTo` out of `Projection` 3

third attempt at rust-lang#112658. Rebasing rust-lang#116262 is very annoying, so I am doing it again from scratch. We should now be able to merge it without regressing anything as we handle occurs check failures involving aliases correctly since rust-lang#117088.

see https://hackmd.io/ktEL8knTSYmtdfrMMnA-Hg

fixes rust-lang/trait-system-refactor-initiative#1

r? `@compiler-errors`
docs: publish nightly doc for `rustfix`

`rustfix `has migrated into rust-lang/cargo in <rust-lang/cargo#13005>. We now can publish nightly doc for it.
…s, r=cuviper

Elaborate on ip_addr bit conversion endianness

Adds explanation of how endianness is handled when converting `Ipv4Addr` and `Ipv6Addr` to and from bits. This is intended to unblock stabilization of the affected methods.

Addresses rust-lang#113744
…k, r=workingjubilee

OnceLock: Add note about drop and statics

Hi!  Just a minor documentation addition, I've attempted to build docs locally but ran in to issues, so am not 100% sure this change will render correctly.
…notriddle

[rustdoc] Fix display of features

Fixes rust-lang#118615.

It now looks like this:

![image](https://github.com/rust-lang/rust/assets/3050060/6e77204e-0706-44a3-89ae-2dbd1934ebbc)

We can't use flex without breaking the flow, meaning we can't vertically align items as we want. Because of that, the `min-height` was problematic as it rendered weirdly and therefore needed to be removed.

r? `@notriddle`
coverage: Avoid unnecessary macros in unit tests

These macros don't provide enough value to justify their complexity, when they can just as easily be functions instead.

---

`@rustbot` label +A-code-coverage
…achable, r=bjorn3

Tell MirUsedCollector that the pointer alignment checks calls its panic symbol

Fixes rust-lang#118683 (not an issue, but that PR is a basically a bug report)

When we had `panic_immediate_abort` start adding `#[inline]` to this panic function, builds started breaking because we failed to write up the MIR assert terminator to the correct panic shim. Things happened to work before by pure luck because without this feature enabled, the function we're inserting calls to is `#[inline(never)]` so we always generated code for it.

r? bjorn3
coverage: Merge refined spans in a separate final pass

Pulling this merge step out of `push_refined_span` and into a separate pass lets us push directly to `refined_spans` instead of calling a helper method.

Because the compiler can now see partial borrows of `refined_spans`, we can remove some extra code that was jumping through hoops to satisfy the borrow checker.

---

``@rustbot`` label +A-code-coverage
fix jobserver GLOBAL_CLIENT_CHECKED uninitialized before use

override rust-lang#118589, resolve merge conflict

`@petrochenkov` `@SparrowLii`

Thanks!
…uillaumeGomez

rustdoc: remove unused parameter `reversed` from onEach(Lazy)

This feature was added in edec580 to support JavaScript-based toggles that were later replaced with HTML `<details>`.
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#118505 (Elaborate on ip_addr bit conversion endianness)
 - rust-lang#118581 (OnceLock: Add note about drop and statics)
 - rust-lang#118677 ([rustdoc] Fix display of features)
 - rust-lang#118690 (coverage: Avoid unnecessary macros in unit tests)
 - rust-lang#118693 (Tell MirUsedCollector that the pointer alignment checks calls its panic symbol)
 - rust-lang#118695 (coverage: Merge refined spans in a separate final pass)
 - rust-lang#118709 (fix jobserver GLOBAL_CLIENT_CHECKED uninitialized before use)
 - rust-lang#118722 (rustdoc: remove unused parameter `reversed` from onEach(Lazy))

r? `@ghost`
`@rustbot` modify labels: rollup
…y-namespace, r=compiler-errors

Resolve associated item bindings by namespace

This is the 3rd commit split off from rust-lang#118360 with tests reblessed (they no longer contain duplicated diags which were caused by 4c0addc) & slightly adapted (removed supertraits from a UI test, cc rust-lang#118040).

> * Resolve all assoc item bindings (type, const, fn (feature `return_type_notation`)) by namespace instead of trying to resolve a type first (in the non-RTN case) and falling back to consts afterwards. This is consistent with RTN. E.g., for `Tr<K = {…}>` we now always try to look up assoc consts (this extends to supertrait bounds). This gets rid of assoc tys shadowing assoc consts in assoc item bindings which is undesirable & inconsistent (types and consts live in different namespaces after all)
> * Consolidate the resolution of assoc {ty, const} bindings and RTN (dedup, better diags for RTN)
> * Fix assoc consts being labeled as assoc *types* in several diagnostics
> * Make a bunch of diagnostics translatable

Fixes rust-lang#112560 (error → pass).

As discussed
r? `@compiler-errors`

---

**Addendum**: What I call “associated item bindings” are commonly referred to as “type bindings” for historical reasons. Nowadays, “type bindings” include assoc type bindings, assoc const bindings and RTN (return type notation) which is why I prefer not to use this outdated term.
Fix const drop checking

Fixes confirmation of `~const Destruct` and const drops.

r? fee1-dead
…mpiler-errors

never_patterns: Parse match arms with no body

Never patterns are meant to signal unreachable cases, and thus don't take bodies:
```rust
let ptr: *const Option<!> = ...;
match *ptr {
    None => { foo(); }
    Some(!),
}
```
This PR makes rustc accept the above, and enforces that an arm has a body xor is a never pattern. This affects parsing of match arms even with the feature off, so this is delicate. (Plus this is my first non-trivial change to the parser).

~~The last commit is optional; it introduces a bit of churn to allow the new suggestions to be machine-applicable. There may be a better solution? I'm not sure.~~ EDIT: I removed that commit

r? `@compiler-errors`
fix RUSTC_WRAPPER hacks
you can replicate this commit with `./x.py run bump-stage0 --args 2023-11-13`
…y or not

previously we had false-negatives when cross-compiling, which meant people just wouldn't get clippy lints for targets other than the host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.