Commit graph

16056 commits

Author SHA1 Message Date
bors
298a78277e Auto merge of #106977 - michaelwoerister:unord_id_collections, r=oli-obk
Use UnordMap and UnordSet for id collections (DefIdMap, LocalDefIdMap, etc)

This PR changes the `rustc_data_structures::define_id_collections!` macro to use `UnordMap` and `UnordSet` instead of `FxHashMap` and `FxHashSet`. This should account for a large portion of hash-maps being used in places where they can cause trouble.

The changes required are moderate but non-zero:
- In some places the collections are extracted into sorted vecs.
- There are a few instances where for-loops have been changed to extends.

~~Let's see what the performance impact is. With a bit more refactoring, we might be able to get rid of some of the additional sorting -- but the change set is already big enough. Unless there's a performance impact, I'd like to do further changes in subsequent PRs.~~

Performance does not seem to be negatively affected ([perf-run here](https://github.com/rust-lang/rust/pull/106977#issuecomment-1396776699)).

Part of [MCP 533](https://github.com/rust-lang/compiler-team/issues/533).

r? `@ghost`
2023-01-21 14:18:17 +00:00
bors
8d3c7f044d Auto merge of #10216 - chansuke:hotfix/fix-spelling, r=llogiq
Fix spelling inconsistence of `mdBook`

I was reading both [mdBook Documentation](https://rust-lang.github.io/mdBook/) and  [The Clippy Book](https://doc.rust-lang.org/nightly/clippy/development/infrastructure/book.html#the-clippy-book) and felt that it's easier to read to unify the notation of `mdBook`.

- \[ ] Followed [lint naming conventions][lint_naming]
- \[ ] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[ ] Executed `cargo dev update_lints`
- \[ ] Added lint documentation
- \[x] Run `cargo dev fmt`

----

changelog: none
2023-01-21 13:00:20 +00:00
bors
ce460dcd14 Auto merge of #105102 - compiler-errors:copy-impl-considering-regions, r=lcnr
Check ADT fields for copy implementations considering regions

Fixes #88901
r? `@ghost`
2023-01-20 21:29:52 +00:00
chansuke
081c6178fe Fix spelling inconsistence of mdBook 2023-01-20 20:29:04 +09:00
bors
d1a5a353a1 Auto merge of #10214 - xFrednet:changelog-1-67, r=Manishearth,giraffate
Changelog for Rust 1.67 🐞

Roses are red,
violets are blue,
if changelogs could talk,
what would we do?

---

The usual disclaimer: This PR is written, as if the version was already released. It should be merged with the coming release on 2023-01-26. So, please provide feedback and approve it, if everything looks good, but let's wait with the r+ until the release :)

---

changelog: none
2023-01-20 08:36:25 +00:00
xFrednet
a7ae84bc84
Address PR feedback and change text for early merge 2023-01-20 09:21:41 +01:00
xFrednet
f64efd4d31
Changelog for Rust 1.67 🐞 2023-01-19 22:28:12 +01:00
xFrednet
e3a09eca6d
Update version attribute for 1.67 lints 2023-01-19 21:58:08 +01:00
bors
aa0eb7fb1c Auto merge of #10206 - Niki4tap:one_unsafe_op_per_block, r=Alexendoo
Add `multiple_unsafe_ops_per_block` lint

Adds a lint, which restricts an `unsafe` block to only one unsafe operation.

Closes #10064

---

changelog: New lint: [`multiple_unsafe_ops_per_block`]
[#10206](https://github.com/rust-lang/rust-clippy/pull/10206)
<!-- changelog_checked -->
2023-01-19 13:58:09 +00:00
bors
36e3e26464 Auto merge of #10213 - flip1995:changelog-doc, r=xFrednet
Improve the changelog update documentation

- Make the clippy::version attribute instructions more prominent.
- Mention the beta-accepted label.

[Rendered](https://github.com/flip1995/rust-clippy/blob/changelog-doc/book/src/development/infrastructure/changelog_update.md)

r? `@xFrednet`

changelog: none
2023-01-19 13:44:48 +00:00
Philipp Krones
d9baced2b5
Improve the changelog update documentation
- Make the clippy::version attribute instructions more prominent.
- Mention the beta-accepted label.
2023-01-19 11:28:35 +01:00
Alex Macleod
11611b0440 Move unchecked_duration_subtraction to pedantic 2023-01-19 11:18:47 +01:00
Michael Woerister
c1b358945a Allow for more efficient sorting when exporting Unord collections. 2023-01-19 10:40:54 +01:00
Michael Woerister
465ed5bd46 Use UnordMap instead of FxHashMap in define_id_collections!(). 2023-01-19 10:40:47 +01:00
Michael Woerister
31a053059e Use UnordSet instead of FxHashSet in define_id_collections!(). 2023-01-19 10:19:07 +01:00
Niki4tap
875e36f7e4 Add multiple_unsafe_ops_per_block lint 2023-01-18 10:00:31 +03:00
Kyle Matsuda
2bfba8685d fix missing subst in clippy utils 2023-01-17 08:55:28 -07:00
Kyle Matsuda
a084d7908c change item_bounds query to return EarlyBinder; remove bound_item_bounds query 2023-01-17 08:55:28 -07:00
Kyle Matsuda
5dac27503f change usages of item_bounds query to bound_item_bounds 2023-01-17 08:55:27 -07:00
bors
89d443a4c3 Auto merge of #10193 - Jarcho:issue_9894, r=Manishearth
Fix suggestion in `transmutes_expressible_as_ptr_casts` when the source type is a borrow.

fixes #9894

changelog: `transmutes_expressible_as_ptr_casts`: Fix suggestion when the source type is a borrow.
2023-01-17 14:58:39 +00:00
bors
07a7603994 Auto merge of #10187 - dswij:issue-10182-semicolon, r=Jarcho
[needless_return]: Remove all semicolons on suggestion

Closes #10182

Multiple semicolons currently breaks autofix for `needless_return` suggestions. Any semicolons left after removing return means that the return type will always be `()`, and thus fail to compile.

This PR allows `needless_return` to remove multiple semicolons.

The change won't cover the case where there is multiple line yet.

i.e.

```rust
fn needless_return() -> bool {
    return true;
;;
}
```

---

changelog: Sugg: [`needless_return`]: Now removes all semicolons on the same line
[#10187](https://github.com/rust-lang/rust-clippy/pull/10187)
<!-- changelog_checked -->
2023-01-15 15:49:40 +00:00
bors
aceb4439d6 Auto merge of #10199 - tylerjw:document-extending-list-configs, r=xFrednet
Document lint configuration values in Clippy's book

changelog: document lint configuration values in Clippy's book

fixes #9991

r? `@xFrednet`
2023-01-14 18:14:31 +00:00
Tyler Weaver
c0da8acb72
Comment that lint_configuration.md is machine generated 2023-01-14 11:10:40 -07:00
bors
483b7ac918 Auto merge of #10038 - xFrednet:9231-sugg-try-from, r=Jarcho
`cast_possible_truncation` Suggest TryFrom when truncation possible

This fixes the last issues from https://github.com/rust-lang/rust-clippy/pull/9664 as the author seems to be inactive. The PR author was sadly kept during the rebase, due to the conflict resolution.

IDK if it's worth it do to a full review, I only added the last commit, everything else remained the same, besides a rebase.

---

changelog: Sugg: [`cast_possible_truncation`]: Now suggests using `try_from` or allowing the lint
[#10038](https://github.com/rust-lang/rust-clippy/pull/10038)
<!-- changelog_checked -->

closes: https://github.com/rust-lang/rust-clippy/issues/9231
2023-01-14 16:04:51 +00:00
bors
91c8ecc5f9 Auto merge of #10201 - MariaSolOs:patch-1, r=dswij
Add missing arguments to `new_lint` example of `cargo` lints

changelog: Add missing arguments to `new_lint` code example.

From the surrounding text, it seems like this code example is missing the arguments to create a new `cargo` lint.
2023-01-14 15:34:17 +00:00
Tyler Weaver
d950279a03
Document generating lint config docs for adding configuration 2023-01-14 07:39:49 -07:00
Tyler Weaver
dc5ce488e7
Move CI tests for collect-metadata to clippy_bors.yml 2023-01-14 07:38:29 -07:00
Kyle Matsuda
b92d90211e change impl_trait_ref query to return EarlyBinder; remove bound_impl_trait_ref query; add EarlyBinder to impl_trait_ref in metadata 2023-01-14 00:29:56 -07:00
Kyle Matsuda
a160ce3a48 change usages of impl_trait_ref to bound_impl_trait_ref 2023-01-14 00:23:32 -07:00
Maria José Solano
a7db92574c
Split long line 2023-01-13 18:57:04 -08:00
Tyler Weaver
7d1609dce3
Document configurations in table and paragraphs
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-13 16:26:46 -07:00
Maria José Solano
93f602f1cf
Add missing arguments to cargo lint example 2023-01-13 15:21:49 -08:00
Michael Goulet
93d0f47064 Check ADT fields for copy implementations considering regions 2023-01-13 23:06:29 +00:00
Tyler Weaver
2e2ae68d5a
Document lint configuration values in Clippy's book
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-13 11:48:51 -07:00
Tyler Weaver
d43dce14d5
Remove cognitive-complexity-threshold from docs 2023-01-13 09:01:39 -07:00
bors
efb631a09c Auto merge of #106776 - oli-obk:om_nom_nom_nom_nom, r=cjgillot
Feed a bunch of queries instead of tracking fields on TyCtxt

r? `@cjgillot`

pulled out of https://github.com/rust-lang/rust/pull/105462
2023-01-13 13:57:21 +00:00
bors
ac95db69fd Auto merge of #106801 - JohnTitor:rollup-xqkraw0, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #106608 (Render missing generics suggestion verbosely)
 - #106716 ([RFC 2397] Deny incorrect locations)
 - #106754 (Rename `Ty::is_ty_infer` -> `Ty::is_ty_or_numeric_infer`)
 - #106782 (Ignore tests move in git blame)
 - #106785 (Make blame spans better for impl wfcheck)
 - #106791 (Fix ICE formatting)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-13 10:56:53 +00:00
Yuki Okushi
71b99c48ee Rollup merge of #106608 - compiler-errors:missing-generics-verbose, r=estebank
Render missing generics suggestion verbosely

It's a bit easier to read like this, especially ones that are appending new generics onto an existing list, like ": `, T`" which render somewhat poorly inline.

Also don't suggest `dyn` as a type parameter to add, even if technically that's valid in edition 2015.
2023-01-13 16:54:22 +09:00
bors
83dba6e8bb Auto merge of #106092 - asquared31415:start_lang_item_checks, r=davidtwco
Add checks for the signature of the `start` lang item

Closes #105963
2023-01-13 07:45:34 +00:00
bors
97fb130fb2 Auto merge of #10194 - Alexendoo:unchecked-duration-subtraction-pedantic, r=Jarcho
Move `unchecked_duration_subtraction` to pedantic

changelog: [`unchecked_duration_subtraction`]: Move to pedantic

Based on https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Meeting.202023-01-10/near/320488860
2023-01-13 05:58:46 +00:00
Alex Macleod
295225e9cd Move unchecked_duration_subtraction to pedantic 2023-01-13 00:04:28 +00:00
Michael Goulet
2253646395 Don't suggest dyn as parameter to add 2023-01-12 22:04:30 +00:00
Jason Newcomb
b38848d8f7 Fix suggestion in transmutes_expressible_as_ptr_casts when the source type is a borrow. 2023-01-12 16:01:24 -05:00
Philipp Krones
d21616737b Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup 2023-01-12 19:48:13 +01:00
bors
7f27e2e74e Auto merge of #10192 - Jarcho:revert_9701, r=flip1995
Partially revert #9701

This partially reverts #9701 due to #10134

r? `@flip1995`

changelog: None
2023-01-12 18:47:17 +00:00
Jason Newcomb
757e944ba6 Adjust old code for newer rustc version. 2023-01-12 13:29:23 -05:00
Jason Newcomb
5eed9c69ca Revert 4dbd8ad34e, c7dc961558, ed519ad746 and c6477eb711 2023-01-12 13:28:22 -05:00
bors
0b8ee70084 Auto merge of #10191 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-01-12 18:13:13 +00:00
Philipp Krones
cd76d574e4
Also add rustc_driver to clippy_utils
I'm not sure why this is necessary. It worked without this for me
locally, but this fails in CI. The same was done in clippy_dev
2023-01-12 19:12:06 +01:00
Philipp Krones
616b6d2be1
Bump nightly version -> 2023-01-12 2023-01-12 19:00:16 +01:00