Commit Graph

21089 Commits

Author SHA1 Message Date
bors
cefa31a524 Auto merge of #13588 - GuillaumeGomez:fix-lint-anchor, r=flip1995
Fix not working lint anchor (generation and filtering)

As spotted by `@flip1995,` the anchor button is currently not working. Problem was the JS that was preventing the web browser from adding the hash at the end of the URL.

For the second bug fixed, the JS was stripping two characters instead of just stripping the `#` at the beginning.

changelog: Fix clippy page lint anchor (generation and filtering)

r? `@flip1995`
2024-10-23 19:12:16 +00:00
Guillaume Gomez
7115404a97 Open lint when clicking on its anchor 2024-10-23 16:58:06 +02:00
Ralf Jung
54f9bc4884 nightly feature tracking: get rid of the per-feature bool fields 2024-10-23 09:14:41 +01:00
Guillaume Gomez
b33977b852 Fix invalid lint ID filtering 2024-10-22 22:54:29 +02:00
Guillaume Gomez
97d13a8c0a Fix not working lint anchor 2024-10-22 22:50:17 +02:00
Evan Jones
0bcc6f8156
docs: Fix too_long_first_doc_paragraph: line -> paragraph
The documentation for too_long_first_doc_paragraph incorrectly says
"line" where it should say "paragraph".

Fix a minor typo: doscstring -> docstring.

Also do a few tiny edits to attempt to make the wording slightly
shorter and clearer.

changelog: Edit documentation for [`too_long_first_doc_paragraph`]
2024-10-22 16:04:30 -04:00
Michael Goulet
088f07a0a7 Represent TraitBoundModifiers as distinct parts in HIR 2024-10-22 19:48:44 +00:00
bors
78fc7bbfdd Auto merge of #131321 - RalfJung:feature-activation, r=nnethercote
terminology: #[feature] *enables* a feature (instead of "declaring" or "activating" it)

Mostly, we currently call a feature that has a corresponding `#[feature(name)]` attribute in the current crate a "declared" feature. I think that is confusing as it does not align with what "declaring" usually means. Furthermore, we *also* refer to `#[stable]`/`#[unstable]` as *declaring* a feature (e.g. in [these diagnostics](f25e5abea2/compiler/rustc_passes/messages.ftl (L297-L301))), which aligns better with what "declaring" usually means. To make things worse, the functions  `tcx.features().active(...)` and  `tcx.features().declared(...)` both exist and they are doing almost the same thing (testing whether a corresponding `#[feature(name)]`  exists) except that `active` would ICE if the feature is not an unstable lang feature. On top of this, the callback when a feature is activated/declared is called `set_enabled`, and many comments also talk about "enabling" a feature.

So really, our terminology is just a mess.

I would suggest we use "declaring a feature" for saying that something is/was guarded by a feature (e.g. `#[stable]`/`#[unstable]`), and "enabling a feature" for  `#[feature(name)]`. This PR implements that.
2024-10-22 11:02:35 +00:00
Ralf Jung
2fd8222bd4 terminology: #[feature] *enables* a feature (instead of "declaring" or "activating" it) 2024-10-22 07:37:54 +01:00
bors
f03f7c6c9d Auto merge of #129935 - RalfJung:unsupported_calling_conventions, r=compiler-errors
make unsupported_calling_conventions a hard error

This has been a future-compat lint (not shown in dependencies) since Rust 1.55, released 3 years ago. Hopefully that was enough time so this can be made a hard error now. Given that long timeframe, I think it's justified to skip the "show in dependencies" stage. There were [not many crates hitting this](https://github.com/rust-lang/rust/pull/86231#issuecomment-866300943) even when the lint was originally added.

This should get cratered, and I assume then it needs a t-compiler FCP. (t-compiler because this looks entirely like an implementation oversight -- for the vast majority of ABIs, we already have a hard error, but some were initially missed, and we are finally fixing that.)

Fixes https://github.com/rust-lang/rust/pull/87678
2024-10-22 03:24:40 +00:00
blyxyas
3773534f29 Move COGNITIVE_COMPLEXITY to use macro again 2024-10-21 19:27:34 +02:00
bors
5873cb9d17 Auto merge of #13570 - Kijewski:pr-stray-comma, r=xFrednet
docs: remove stray comma

changelog: none

the typo was (seemingly) ignored by browsers, so the change isn't visible to users
2024-10-21 09:11:08 +00:00
bors
8538562429 Auto merge of #13567 - y21:span_debug_assertions, r=flip1995
Add debug assertions for empty replacements and overlapping spans

rustc has debug assertions [^1] [^2] that check that a substitution doesn't have an empty suggestion string and an empty span at the same time, as well as that spans in multipart suggestions don't overlap.
However, since we link to the rustc-dev distributed compiler, these debug assertions are always disabled and so we never actually run them.

This leads to the problem that the debug ICE is not necessarily caught in the PR and only triggered in the rust repo sync, and in one of the last syncs this was a blocker and delayed the sync by several weeks because the fix was not obvious.

So this PR essentially copies the checks over and runs them in clippy debug builds as well, so that we can catch these errors in PRs directly.

-----
As for the second commit, this also *did* cause an ICE in a sync before and was fixed in the sync PR (see https://github.com/rust-lang/rust/pull/120345#issuecomment-1911005554), but it seems like that commit didn't make it back into the clippy repo (cc `@flip1995),` so the fixed code is in the rust repo but not in the clippy repo.

changelog: none

[^1]: https://doc.rust-lang.org/1.82.0/nightly-rustc/src/rustc_errors/diagnostic.rs.html#1019
[^2]: https://doc.rust-lang.org/1.82.0/nightly-rustc/src/rustc_errors/diagnostic.rs.html#932
2024-10-21 08:26:32 +00:00
bors
1d0dad5eb3 Auto merge of #131988 - matthiaskrgr:rollup-tx173wn, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #126588 (Added more scenarios where comma to be removed in the function arg)
 - #131728 (bootstrap: extract builder cargo to its own module)
 - #131968 (Rip out old effects var handling code from traits)
 - #131981 (Remove the `BoundConstness::NotConst` variant)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-10-21 06:13:34 +00:00
bors
d00ab2e955 Auto merge of #13569 - alex-semenyuk:fix_version, r=blyxyas
Fix version for `ref_option`

Close #13566
As mentioned at #13566 `ref_option` [was merged](https://github.com/rust-lang/rust-clippy/pull/13336) after 1.82.0 so it wasn't include in this version

changelog: none
2024-10-20 22:20:55 +00:00
y21
b3bf128e54 don't lint nested items that don't have generated documentation in missing_docs_in_private_items 2024-10-20 23:42:28 +02:00
y21
2f71ce6651 don't lint unnamed constants in missing_docs_in_private_items 2024-10-20 22:14:02 +02:00
Alex Macleod
2666ed6c5b Fix indentation of website code snippets 2024-10-20 19:02:40 +00:00
y21
65eb1ec0fb remove the semicolon for builtin macro call statements in statement_outside_block
The expansion of `asm!()` and `line!()` is not marked as from an expansion, in which case `SourceMap::stmt_span` returns the input span unchanged. So instead of using `stmt_span`, use `mac_call_stmt_semi_span` directly
2024-10-20 19:00:55 +02:00
Michael Goulet
d8b2f9364d Rip out old effects var handling code from traits 2024-10-20 13:40:22 +00:00
Ralf Jung
aab0eee4ef make unsupported_calling_conventions a hard error 2024-10-20 15:22:21 +02:00
René Kijewski
2a5de352a1 docs: remove stray comma 2024-10-20 14:47:01 +02:00
alexey semenyuk
64c4cf1cba
Fix version for ref_option 2024-10-20 14:43:32 +05:00
Michael Goulet
69b088626c Fix tests 2024-10-19 18:07:35 +00:00
y21
4de65a113f fix empty suggestion ICE in from_over_into 2024-10-19 19:24:09 +02:00
y21
38cf3f3234 add debug assertions for overlapping spans and empty replacements 2024-10-19 19:23:56 +02:00
blyxyas
e518d66dc0 Apply review comments + use shallow_lint_levels_on 2024-10-19 16:20:52 +02:00
blyxyas
e427a4e694 Remove module passes filtering 2024-10-19 16:20:51 +02:00
blyxyas
8f8aa46a87 Follow review comments (optimize the filtering) 2024-10-19 16:20:33 +02:00
blyxyas
698363122e Do not run lints that cannot emit
Before this change, adding a lint was a difficult matter
because it always had some overhead involved. This was
because all lints would run, no matter their default level,
or if the user had #![allow]ed them. This PR changes that
2024-10-19 16:19:44 +02:00
bors
5678531c6d Auto merge of #13564 - GnomedDev:fix-manualbits-in-macro, r=blyxyas
Stop linting manual_bits in any macro invoke

Closes #13563.

changelog: [`manual_bits`] No longer lints in macro-generated code
2024-10-19 14:09:28 +00:00
bors
f2f0175eb2 Auto merge of #13543 - GnomedDev:symbol-comparisons, r=y21
Add internal lint to check for slow symbol comparisons

See the conversation on [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Checking.20a.20Symbol.20is.20equal.20to.20a.20string.20literal).

changelog: none
2024-10-18 23:20:38 +00:00
GnomedDev
a739cc3abe
Stop linting manual_bits in any macro invoke 2024-10-18 21:41:05 +01:00
bors
6a795887c4 Auto merge of #13539 - GuillaumeGomez:allow-no-js, r=Alexendoo
Allow to go through clippy lints page without javascript

Fixes #13536.

This is the follow-up of https://github.com/rust-lang/rust-clippy/pull/13269.

This PR makes it possible to expand/collapse lints (individually) without JS. To achieve this result, there are two ways:
1. Use `details` and `summary` tags. Problem with this approach is that the web browser search may open the `details` tags automatically if content matching it is inside. From a previous discussion with `@Alexendoo,` it seems to not be a desired behaviour.
2. Use a little trick where you use a `label` and a checkbox where the checkbox is in fact hidden. Then it's just a matter of CSS.

r? `@Alexendoo`

changelog: Allow to go through clippy lints page without JS
2024-10-18 19:24:16 +00:00
bors
47effe4f68 Auto merge of #13562 - klensy:pc, r=flip1995
pulldown-cmark: don't pull getopts dep

Don't pull getopts, as it unused. Noticed in https://github.com/rust-lang/rust/pull/131892

changelog: none
2024-10-18 16:27:41 +00:00
Guillaume Gomez
da19d47147 Fix lints syntax highlighting 2024-10-18 18:03:16 +02:00
Guillaume Gomez
82969e5c4e Allow to go through clippy lints page without javascript 2024-10-18 18:03:16 +02:00
klensy
2c3a34a040 pulldown-cmark: don't pull getopts dep 2024-10-18 17:08:50 +03:00
Philipp Krones
91a458f451 Hotfix TRAIT_METHODS static->const 2024-10-18 14:54:06 +02:00
Philipp Krones
fea5e77da1 Merge commit 'a109190d7060236e655fc75533373fa274ec5343' into clippy-subtree-update 2024-10-18 13:44:06 +02:00
bors
a109190d70 Auto merge of #13561 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-10-18 11:31:05 +00:00
Philipp Krones
4b5d1894db
Bump nightly version -> 2024-10-18 2024-10-18 13:26:07 +02:00
Philipp Krones
4d5eaa0344
Bump Clippy version -> 0.1.84 2024-10-18 13:25:50 +02:00
Philipp Krones
224d1e323a
Merge remote-tracking branch 'upstream/master' into rustup 2024-10-18 13:25:37 +02:00
Alexey Semenyuk
8555922351 Don't trigger const_is_empty for inline const assertions 2024-10-17 22:36:26 +05:00
bors
dae1be90ee Auto merge of #13525 - xFrednet:changelog-1-82, r=dswij
Changelog for Clippy 1.82 ✈️

```
Roses are red,
Violets are blue,
EuroRust in Austria,
    RustConf in Canada.
```

---

### The cat of this release is *Racka*:

<img height=500 src="https://github.com/user-attachments/assets/e5e3cc95-6fc3-4214-aab0-4f26e0967ae5" alt="The cats of this Clippy release" />

Cats for the next release can be nominated in the comments :D

---

changelog: none
2024-10-17 11:13:09 +00:00
bors
ccb30bfd5b Auto merge of #13554 - ageorgou:doc-links, r=xFrednet
Documentation fixes

- In [the page describing the lints](https://rust-lang.github.io/rust-clippy/master/index.html), the View Source links are incorrect. This PR removes the extra segment causing them to fail.
  - Example before: https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/clippy_lints/src/absolute_paths.rs#L13
  - Example after: https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/absolute_paths.rs#L13
  - I think this was introduced in #13269.
  - I've only checked a few of the lints with the new template, but from what I can tell the metadata is generated in the same way for all of them. The `id_location` contains the full path of the lint declaration in the repository, which is why `clippy_lints` was repeated in the URL.
- Separately, fixing a typo in the explanation of `unnecessary_get_then_check`.

changelog: none
2024-10-16 09:46:17 +00:00
bors
c512a221c2 Auto merge of #131481 - nnethercote:rm-GenKillSet, r=cjgillot
Remove `GenKillAnalysis`

There are two kinds of dataflow analysis in the compiler: `Analysis`, which is the basic kind, and `GenKillAnalysis`, which is a more specialized kind for gen/kill analyses that is intended as an optimization. However, it turns out that `GenKillAnalysis` is actually a  pessimization! It's faster (and much simpler) to do all the gen/kill analyses via `Analysis`. This lets us remove `GenKillAnalysis`, and `GenKillSet`, and a few other things, and also merge `AnalysisDomain` into `Analysis`. The PR removes 500 lines of code and improves performance.

r? `@tmiasko`
2024-10-16 09:45:05 +00:00
wowinter13
ad002ea99f fix: linter 2024-10-16 01:49:15 +02:00
wowinter13
40cb24f23c fix: simplify suggestion 2024-10-16 01:42:43 +02:00