Commit graph

16268 commits

Author SHA1 Message Date
Samuel Tardieu
446ae429a6 lintcheck: fix parallel processing handling
Using `rayon::current_num_threads()` causes a bug:

```
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value:
  ThreadPoolBuildError { kind: GlobalPoolAlreadyInitialized }',
  src/main.rs:632:10
```

Moreover, using the number of threads and dividing it by 2 wouldn't
return the number of physical threads on modern processors which have
a varying number of threads per core.

It makes little sense to restrict ourselves to physical threads,
especially when, in modern architectures, cores with multiple threads
are often faster (performance) while cores with a unique threads are
often slower (efficient). The Rust runtime will make a better choice.
2023-03-04 17:29:58 +01:00
bors
113c704d22 Auto merge of #10427 - xFrednet:changelog-1-68, r=Manishearth
Update version attribute for 1.68 lints

Roses are red,
violets are blue,
I'm running out of rhymes,
changelogs are crimes????

---

changelog: none
<!-- changelog_checked -->
2023-02-28 21:24:26 +00:00
xFrednet
917ebc3af6
Changelog for Rust 1.68 🐶 2023-02-28 22:06:53 +01:00
xFrednet
7fb76a1ea7
Update version attribute for 1.68 lints 2023-02-28 21:56:03 +01:00
bors
2d9ca944fa Auto merge of #10425 - smoelius:docs, r=llogiq
Two small documentation improvements

The `wrong_self_convention` changes are for grammar and accuracy.

The `must_use_candidate` change is because that lint flags only exported functions: 8b65632b6e/clippy_lints/src/functions/must_use.rs (L27-L31)

changelog: `wrong_self_convention` and `must_use_candidate` documentation improvements
2023-02-28 18:16:15 +00:00
bors
ba86a99d24 Auto merge of #10324 - andrewbanchich:fix-missing-private-docs, r=dswij
Scope `missing_docs_in_private_items` to only private items

`missing_docs_in_private_items` currently detects missing docs for public items as well as private. Since `missing_docs`already covers public items, this PR updates `missing_docs_in_private_items` to only cover private items.

Fixes #1895

changelog: [`missing_docs_in_private_items`]: Apply lint only to private items (used to be public and private)
2023-02-28 16:30:49 +00:00
bors
d98873497b Auto merge of #10418 - Jarcho:finish_dogfood, r=flip1995
Run dogfood to completion

Run dogfood on all packages before failing the test. Failing early is painful on lints which trigger on multiple crates.

changelog: None
2023-02-28 15:21:32 +00:00
bors
1a11ad7390 Auto merge of #10405 - Jarcho:issue_10367, r=flip1995
Fix ICE in `multiple_unsafe_ops_per_block`

fixes #10367

changelog: [`multiple_unsafe_ops_per_block`]: Fix ICE when calling a function-like object in an unsafe block
2023-02-28 15:08:34 +00:00
bors
acf70eae4c Auto merge of #10423 - Alexendoo:array-size-threshold, r=flip1995
Fix array-size-threshold config deserialization error

changelog: Fix error when providing an `array-size-threshold` in `clippy.toml`

Not entirely sure why it doesn't want to deserialize a u128, but converting it after the fact is an easy enough fix

Fixes #10422
2023-02-28 14:57:33 +00:00
Samuel Moelius
90ba82bd39 Two small documentation improvements 2023-02-28 09:52:01 -05:00
Jason Newcomb
69a1100776 Run dogfood on all packages before failing 2023-02-28 09:49:54 -05:00
Alex Macleod
2cadea5dc5 Fix array-size-threshold config deserialization error 2023-02-28 14:37:41 +00:00
bors
8b65632b6e Auto merge of #10419 - deining:fix/typos, r=Jarcho
Fixing typos

changelog: none
2023-02-27 20:51:12 +00:00
Andreas Deininger
03a3f74365 Fixing typos 2023-02-27 21:45:26 +01:00
bors
2742ac0748 Auto merge of #10399 - samueltardieu:issue-10396, r=Manishearth
Do not suggest to derive `Default` on generics with implicit arguments

Fixes #10396

changelog: FP: [`derivable_impls`]: do not suggest to derive `Default` on generics with implicit arguments
2023-02-27 17:12:43 +00:00
bors
ba7fd68e87 Auto merge of #10408 - cdown:cdown/2023-02-26/exit_lint_sp, r=Alexendoo
exit lint: potentualy -> potentially

changelog: none
2023-02-26 20:51:54 +00:00
Chris Down
5f3df6cfce exit lint: potentualy -> potentially 2023-02-26 17:43:24 +00:00
Samuel Tardieu
c82ff00539 Do not suggest to derive Default on generics with implicit arguments 2023-02-26 15:44:04 +01:00
Jason Newcomb
002e934189 Don't assume paths work with fn_sig in multiple_unsafe_ops_pre_block. 2023-02-26 02:55:52 -05:00
bors
3d193fa17a Auto merge of #10400 - calebcartwright:rustfmt-cleanup, r=Jarcho
chore: remove unneeded rustfmt skip

---

The associated rustfmt bug that originally necessitated these skips was resolved a while back, so these are no longer necessary

changelog: none
2023-02-26 03:03:01 +00:00
bors
e1ac1332b6 Auto merge of #10375 - samueltardieu:issue-10371, r=Manishearth
Do not suggest using Self in const generic parameters

Fixes #10371

changelog: FP: [`use_self`]: do not suggest using `Self` in const generic parameters
2023-02-26 00:52:55 +00:00
Andrew Banchich
49a06ed66f Scope missing_docs_in_private_items to only private items 2023-02-25 19:16:53 -05:00
bors
149392b0ba Auto merge of #10402 - Jarcho:rustup, r=Jarcho
Rustup

Looks like `@flip1995`  is busy.

r? `@ghost`

changelog: None
2023-02-25 23:34:06 +00:00
Jason Newcomb
69c4ff6df8 Emit unnecessary_def_path in source order. 2023-02-25 18:09:24 -05:00
Jason Newcomb
e825adf637 Fix normalization of custom_ice_message test. 2023-02-25 18:08:51 -05:00
bors
51551193d8 Auto merge of #10401 - samueltardieu:issue-10148, r=Alexendoo
Do not panic when analyzing the malformed origin of a format string

Fixes #10148. This will trigger only when generating format strings while accepting weird things in a procedural macro and setting the span to something which is not a string.

changelog: none
2023-02-25 23:05:23 +00:00
Samuel Tardieu
64775f30c2 Do not panic when analyzing the malformed origin of a format string 2023-02-25 23:48:17 +01:00
Jason Newcomb
5552f4a6b5 Bump nightly version -> 2023-02-25 2023-02-25 17:44:05 -05:00
Jason Newcomb
bc184e9c7d Merge branch 'master' into rustup 2023-02-25 17:43:19 -05:00
Caleb Cartwright
730fa93634 chore: remove unneeded rustfmt skip 2023-02-25 12:34:05 -06:00
bors
b528cc90bc Auto merge of #10391 - ldm0:ldm0_fix_unwrap_in_tests, r=xFrednet
Fix test function checker in `unwrap_used`, `expect_used`

After #9686 , `unwrap` and `expect` in integration tests and raw test functions won't be allowed.

fixes #10011
fixes #10238
fixes #10264

---

changelog: Fix: [`expect_used`], [`unwrap_used`], [`dbg_macro`], [`print_stdout`], [`print_stderr`]: No longer lint in test functions, if the related configuration is set
[#10391](https://github.com/rust-lang/rust-clippy/pull/10391)
<!-- changelog_checked -->
2023-02-24 09:24:41 +00:00
Liu Dingming
84ceca852e run cargo collect-metadata 2023-02-24 05:53:58 +08:00
bors
659112ca95 Auto merge of #10369 - nindalf:no_mangle_lint, r=llogiq
Add new lint no_mangle_with_rust_abi

Fixes issue #10347

This PR adds a new lint `no_mangle_with_rust_abi` that suggests converting a function to the C ABI to if the function has the `#[no_mangle]` attribute and `Abi == Abi::Rust`. It will not run for any of the other variants defined in [rustc_target::spec::abi::Abi](https://doc.rust-lang.org/beta/nightly-rustc/rustc_target/spec/abi/enum.Abi.html), nor suggest any conversion other than conversion to the C ABI.

Functions that explicitly opt into the Rust ABI with `extern "Rust"` are ignored by this lint.

---

changelog: [`no_mangle_with_rust_abi`]: add lint that converts Rust ABI functions with the `#[no_mangle]` attribute to C ABI
2023-02-23 19:41:03 +00:00
Krishna Sundarram
00c294ad05 Add new lint no_mangle_with_rust_abi 2023-02-23 17:35:06 +00:00
bors
f9adb83e0a Auto merge of #10392 - mkrasnitski:false-positives, r=Jarcho
Fix more false positives for `extra_unused_type_parameters`

Builds on #10321. All empty functions are no longer linted, instead of just those that have trait bounds on them. Also, if a trait bound contains a non-public trait (un-exported, but still potentially reachable), then the corresponding type parameter isn't linted.

Finally, added support for the `avoid_breaking_exported_api` config option.

r? `@flip1995`
changelog: none
2023-02-23 15:53:39 +00:00
Michael Krasnitski
528bb639d4 Fix more false positives for extra_unused_type_parameters 2023-02-23 10:12:02 -05:00
bors
daa94d2583 Auto merge of #108324 - notriddle:notriddle/assoc-fn-method, r=compiler-errors,davidtwco,estebank,oli-obk
diagnostics: if AssocFn has self argument, describe as method

Discussed in https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.22associated.20function.22.20vs.20.22method.22/near/329265515

This commit also changes the tooltips on rustdoc intra-doc links targeting methods.

For anyone not sure why this is being done, see the Reference definitions of these terms in <https://doc.rust-lang.org/1.67.1/reference/items/associated-items.html#methods>

> Associated functions whose first parameter is named `self` are called methods and may be invoked using the [method call operator](https://doc.rust-lang.org/1.67.1/reference/expressions/method-call-expr.html), for example, `x.foo()`, as well as the usual function call notation.

In particular, while this means it's technically correct for rustc to refer to a method as an associated function (and there are a few cases where it'll still do so), rustc *must never* use the term "method" to refer to an associated function that does not have a `self` parameter.
2023-02-23 00:19:12 +00:00
bors
95cd5284d4 Auto merge of #108340 - eggyal:remove_traversal_trait_aliases, r=oli-obk
Remove type-traversal trait aliases

#107924 moved the type traversal (folding and visiting) traits into the type library, but created trait aliases in `rustc_middle` to minimise both the API churn for trait consumers and the arising boilerplate.  As mentioned in that PR, an alternative approach of defining subtraits with blanket implementations of the respective supertraits was also considered at that time but was ruled out as not adding much value.

Unfortunately, it has since emerged that rust-analyzer has difficulty with these trait aliases at present, resulting in a degraded contributor experience (see the recent [r-a has become useless](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/r-a.20has.20become.20useless) topic on the #t-compiler/help Zulip stream).

This PR removes the trait aliases, and accordingly the underlying type library traits are now used directly; they are parameterised by `TyCtxt<'tcx>` rather than just the `'tcx` lifetime, and imports have been updated to reflect the fact that the trait aliases' explicitly named traits are no longer automatically brought into scope.  These changes also roll-back the (no-longer required) workarounds to #107747 that were made in b409329c624b9e3bbd7d8e07697e2e9f861a45b6.

Since this PR is just a find+replace together with the changes necessary for compilation & tidy to pass, it's currently just one mega-commit.  Let me know if you'd like it broken up.

r? `@oli-obk`
2023-02-22 18:26:51 +00:00
Alan Egerton
430c4ab7ff Remove type-traversal trait aliases 2023-02-22 17:04:58 +00:00
Michael Howell
d254516be1 clippy: update clippy to use new TyCtxt::def_descr 2023-02-22 08:40:47 -07:00
Liu Dingming
79a90248c3 bless 2023-02-22 21:49:26 +08:00
Liu Dingming
a5acb926c1 fix fmt 2023-02-22 21:44:56 +08:00
Liu Dingming
1a474d9179 Recover tests 2023-02-22 21:36:30 +08:00
Liu Dingming
b9c617a1b7 correct comments 2023-02-22 21:36:16 +08:00
Liu Dingming
72e773f6a8 Fix test function checker in [unwrap_used], [expect_used] 2023-02-22 21:31:21 +08:00
bors
8d08917d3a Auto merge of #10385 - Jarcho:readme_restriction, r=xFrednet
Update readme description of `restriction` lints to dissuade casual use.

Adds some stronger wording about not enabling `restriction` lints. I've seen it come up a few times where people are confused about what the `restriction` category is for and end up casually enabling lints from it (or the whole category).

changelog: None
2023-02-22 09:51:01 +00:00
David Wood
ab69a2a57b various: translation resources from cg backend
Extend `CodegenBackend` trait with a function returning the translation
resources from the codegen backend, which can be added to the complete
list of resources provided to the emitter.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22 09:15:54 +00:00
David Wood
aa0e543ba0 errors: generate typed identifiers in each crate
Instead of loading the Fluent resources for every crate in
`rustc_error_messages`, each crate generates typed identifiers for its
own diagnostics and creates a static which are pulled together in the
`rustc_driver` crate and provided to the diagnostic emitter.

Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22 09:15:53 +00:00
Jason Newcomb
bf7c209620 Update readme description of restriction lints to dissuade casual use. 2023-02-21 22:05:38 -05:00
bors
51668820f4 Auto merge of #10386 - Jarcho:issue_10384, r=Manishearth
Normalize projections types when checking `explicit_auto_deref`

fixes #10384

changelog: [`explicit_auto_deref`]: Better consider projection types when checking if auto deref is applicable
2023-02-21 21:27:41 +00:00