Commit graph

11531 commits

Author SHA1 Message Date
xFrednet
7e90bb671a Fixed website inline code background 2021-04-14 20:06:26 +02:00
xFrednet
cbde4f2c67 parent_node_is_if_expr now also recognizes if let as parent if 2021-04-14 20:06:26 +02:00
bors
b1c675f3fc Auto merge of #7070 - camsteffen:changelog-stderr, r=flip1995
Fix changelog check output

Error messages are more helpful if you can see them.

changelog: none
2021-04-14 08:25:14 +00:00
bors
24921df7bd Auto merge of #7039 - phansch:melt-ice, r=flip1995
tabs_in_doc_comments: Fix ICE due to char indexing

This is a quick-fix for an ICE in `tabs_in_doc_comments`. The problem
was that we we're indexing into possibly multi-byte characters, such as '位'.

More specifically `get_chunks_of_tabs` was returning indices into
multi-byte characters. Those were passed on to a `Span` creation that
then caused the ICE.

This fix makes sure that we don't return indices that point inside a
multi-byte character. *However*, we are still iterating over unicode
codepoints, not grapheme clusters. So a seemingly single character like y̆ ,
which actually consists of two codepoints, will probably still cause
incorrect spans in the output. But I don't think we handle those cases
anywhere in Clippy currently?

Fixes #5835

changelog: Fix ICE in `tabs_in_doc_comments`
2021-04-14 04:53:24 +00:00
bors
19740d9334 Auto merge of #7076 - rail-rain:missing_const_for_fn, r=phansch
Fix a FP in `missing_const_for_fn`

where a function that calls a standard library function whose constness
is unstable is considered as being able to be a const function. Fixes #5995.

The core change is the move from `rustc_mir::const_eval::is_min_const_fn` to `rustc_mir::const_eval::is_const_fn`. I'm not clear about the difference in their purpose between them so I'm not sure if it's acceptable to call `qualify_min_const_fn::is_min_const_fn` this way now.

---

changelog: `missing_const_for_fn`: No longer lints when an unstably const function is called
2021-04-14 04:39:25 +00:00
Philipp Hansch
cbdebd97ec Explain why we use char_indices() instead of chars() 2021-04-14 06:30:51 +02:00
rail
26a1989041 Fix a FP in missing_const_for_fn
where a function that calls a standard library function whose constness
is unstable is considered as being able to be a const function
2021-04-14 09:23:44 +12:00
bors
8f3c2450c2 Auto merge of #7074 - camsteffen:diag-methods, r=llogiq
Split `is_diagnostic_assoc_item`

changelog: none

* Split `is_diagnostic_assoc_item` into `is_diag_item_method` and `is_diag_trait_item`
  * `is_diag_item_method` is a bit more nuanced with the `tcx.type_of(impl_id).ty_adt_def()` step, so it seems better to keep that separate.
  * No need to generalize over traits and Adt's since we know which one we want at compile time
  * "item" vs. "method" because a trait may have associated items.
* Replaces the usage of the `sym::slice` diagnostic item with the `slice_alloc` lang item. The diagnostic item should be removed from rustc because it is on the `slice_alloc` impl, not slice itself (and it's not needed).
2021-04-13 20:31:22 +00:00
Cameron Steffen
0d144298ee Improve changelog check error handling 2021-04-13 14:53:12 -05:00
Cameron Steffen
76bd5d232c Refactor diagnostic item methods 2021-04-13 14:10:40 -05:00
bors
e9728b80ce Auto merge of #7068 - boxdot:remove-std-ptr-null, r=camsteffen
Remove paths::STD_PTR_NULL

Related to #5393

changelog: none
2021-04-12 18:37:31 +00:00
bors
2a96bc434b Auto merge of #7067 - TaKO8Ki:fix-false-negative-on-needless-return, r=llogiq
Fix a false negative on `needless return`

closes #7042

changelog: fix a false negative on `needless return`
2021-04-12 18:00:38 +00:00
boxdot
d6beb18411
Remove paths::STD_PTR_NULL 2021-04-12 18:35:47 +02:00
bors
411c0df1d0 Auto merge of #7064 - ThibsG:WrongSelfFix, r=giraffate
Fix FP in `wrong_self_convention` lint

Previously, this lint didn't check into impl block when it was implementing a trait.
Recent improvements (#6924) have moved this check and some impl blocks are now checked but they shouldn't, such as in #7032.

Fixes #7032

changelog: Fix FP when not taking `self` in impl block for `wrong_self_convention` lint
2021-04-12 14:16:17 +00:00
Takayuki
e6c67ad2bf fix limit_stderr_length error 2021-04-12 21:58:34 +09:00
Takayuki
0218a3b12f add tests for a false negative on needless_return 2021-04-12 21:37:19 +09:00
Takayuki
53260df2fa fix a false negative on needless_return 2021-04-12 21:36:49 +09:00
bors
c3ef585328 Auto merge of #6982 - Jarcho:explicit_into_iter_loop_fp, r=flip1995
Fix `explicit_into_iter_loop`

fixes: #6900

changelog: Only lint when `into_iter` is an implementation of `IntoIterator`
2021-04-12 09:45:32 +00:00
bors
aecccbc579 Auto merge of #7047 - camsteffen:lang-ctor, r=flip1995
Introduce `is_lang_ctor`

changelog: none

Replaces `is_some_ctor` and `is_ok_ctor`. Removes many path usages.
2021-04-12 08:52:10 +00:00
bors
f0ceb28ba1 Auto merge of #7065 - rail-rain:warn_copy_pass_by_ref, r=Manishearth
Add a note on the issue #5953

Hello,

I thought it would be better to have a note and warning about this issue considering it introduced an UB in the past even with the "Search on Github" feature.

---

changelog: Add a note on the issue #5953 to the known problems section.
2021-04-12 04:38:42 +00:00
rail
fb54b703c7 Add a note on the issue #5953 2021-04-12 15:32:54 +12:00
bors
a6b514c603 Auto merge of #7059 - camsteffen:filter-map, r=flip1995
Deprecate `filter_map`

Since #6591, `filter_map` does not even lint `filter().map()`. The cases that are still linted make no sense IMO. So this just removes/deprecates it.

changelog: Deprecate `filter_map` lint

Closes #3424
Fixes #7050
2021-04-11 18:24:23 +00:00
bors
67fad0139f Auto merge of #6905 - ThibsG:fpSingleComponentPathImports5210, r=giraffate
Fix FP in `single_component_path_imports` lint

Fix FP in  `single_component_path_imports` lint when the import is reused with `self`, like in `use self::module`.

Fixes #5210

changelog: none
2021-04-11 14:18:38 +00:00
ThibsG
3ce6f0d022 Fix FP in wrong_self_convention lint 2021-04-11 13:29:08 +02:00
bors
75e20ba6a2 Auto merge of #7063 - daxpedda:debug-assert-panic, r=Manishearth
Fix false-positive `debug_assert` in `panic`

This fixes a false-positive in `clippy::panic` when `debug_assert` is used with a message.

Fixes https://github.com/rust-lang/rust-clippy/issues/7062.

changelog: Fix false-positive in `panic` when `debug_assert` is used with a message
2021-04-10 22:14:06 +00:00
Cameron Steffen
a45faf66f3 Deprecate filter_map 2021-04-10 16:59:59 -05:00
daxpedda
cb14e7ebf4
Fix false-positive debug_assert in panic 2021-04-10 23:37:18 +02:00
bors
fd5cf4e82d Auto merge of #7060 - daxpedda:debug-assert-panic-in-result-fn, r=flip1995
Remove `debug_assert` from `panic_in_result_fn`

I couldn't find any documentation on `debug_assert` that should be remove.
In my humble opinion, I would also like to argue that `todo` and `unreachable` shouldn't trigger this lint?

Related: https://github.com/rust-lang/rust-clippy/issues/6082

r? `@flip1995`

changelog: Change `panic_in_result_fn` to ignore `debug_assert` and co macros
2021-04-10 19:15:37 +00:00
daxpedda
271c163ba3
Fix false-positive debug_assert 2021-04-10 20:54:40 +02:00
daxpedda
8f4417faf2
Fix rustfmt 2021-04-10 17:45:55 +02:00
daxpedda
43e6c656ba
Remove debug_assert from panic_in_result_fn 2021-04-10 17:38:04 +02:00
Philipp Hansch
47a4865406 Fix dogfood 2021-04-10 15:30:51 +02:00
Philipp Hansch
8b9331b49d Fix rustfmt error / Add comment for tab character 2021-04-10 14:43:52 +02:00
Philipp Hansch
dde46c9340 Replace complex conditional with pattern matching 2021-04-10 14:42:33 +02:00
ThibsG
297e84f3f4 Handle imports which are nested directly 2021-04-10 10:26:53 +02:00
bors
f7c2c44e76 Auto merge of #7056 - jyn514:register-renamed, r=flip1995
Use `register_renamed` instead of `register_removed` for uplifted lints

This still applies the lint, and also adds a structured suggestion to
rename it.

changelog: Use `register_renamed` instead of `register_removed` for lints uplifted to rustc
2021-04-09 15:17:36 +00:00
Joshua Nelson
012f9d47b2 Use register_renamed instead of register_removed for uplifted lints
This still applies the lint, and also adds a structured suggestion to
rename it.
2021-04-09 10:56:11 -04:00
bors
75efc144e7 Auto merge of #7023 - boxdot:invalid-null-usage-v2, r=camsteffen
Invalid null usage v2

This is continuation of #6192 after inactivity.

I plan to move paths into the compiler as diagnostic items after this is merged.

fixes #1703
changelog: none
2021-04-08 21:00:48 +00:00
boxdot
4f7fc11ef1
Add invalid null pointer usage lint. 2021-04-08 22:49:48 +02:00
bors
c40fa00113 Auto merge of #7022 - Jarcho:macro_use_import_ice, r=flip1995
Fix `macro_use_import` ICE

fixes: #7015
changelog: Fix `macro_use_import` ICE
2021-04-08 16:04:55 +00:00
flip1995
f6d1f368db Merge commit 'b40ea209e7f14c8193ddfc98143967b6a2f4f5c9' into clippyup 2021-04-08 17:50:13 +02:00
bors
b40ea209e7 Auto merge of #7051 - flip1995:rustup, r=flip1995
Rustup

changelog: none

r? `@ghost`
2021-04-08 15:46:38 +00:00
flip1995
61eafbb1e0
Bump nightly version -> 2021-04-08 2021-04-08 17:37:06 +02:00
flip1995
ffa2b7da29
Merge remote-tracking branch 'upstream/master' into rustup 2021-04-08 17:36:41 +02:00
Dylan DPC
cde58f7174 Rollup merge of #83916 - Amanieu:asm_anonconst, r=petrochenkov
Use AnonConst for asm! constants

This replaces the old system which used explicit promotion. See #83169 for more background.

The syntax for `const` operands is still the same as before: `const <expr>`.

Fixes #83169

Because the implementation is heavily based on inline consts, we suffer from the same issues:
- We lose the ability to use expressions derived from generics. See the deleted tests in `src/test/ui/asm/const.rs`.
- We are hitting the same ICEs as inline consts, for example #78174. It is unlikely that we will be able to stabilize this before inline consts are stabilized.
2021-04-07 13:07:14 +02:00
bors
db6ea84f87 Auto merge of #7046 - camsteffen:symbol-optimize, r=giraffate
Some symbol optimizations

changelog: none
2021-04-07 04:36:31 +00:00
Cameron Steffen
7468542328 Introduce is_lang_ctor 2021-04-06 15:05:00 -05:00
Cameron Steffen
47f0c15f67 Symbol optimizations 2021-04-06 13:00:36 -05:00
bors
624e8aad32 Auto merge of #7044 - camsteffen:match-path, r=Manishearth
Soft deprecate match_path and match_qpath

changelog: none

From zulip [disucssion](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/match_.5Bq.5Dpath.20is.20bad.3F).
2021-04-06 17:41:34 +00:00
bors
bbe1567bc9 Auto merge of #7043 - camsteffen:dead-utils, r=flip1995
Remove some dead utils

changelog: none
2021-04-06 16:49:42 +00:00