Commit Graph

12447 Commits

Author SHA1 Message Date
flip1995
1f955158dd
Merge remote-tracking branch 'upstream/master' into rustup 2021-10-07 11:11:23 +02:00
bors
01ea06acb7 Auto merge of #7780 - mikerite:update_lints_mod_revert, r=llogiq
Revert `update_lints` module list generating code

This commit reverts the module list generation code to what it was
before the change to `include!` it and generates better output.

changelog: none
2021-10-07 05:00:53 +00:00
Michael Wright
8f075ec961 Revert update_lints module list generating code
This commit reverts the module list generation code to what it was
before the change to `include!` it and generates better output.
2021-10-07 06:42:21 +02:00
bors
11492c75a3 Auto merge of #7772 - Manishearth:doc-markdown-intra, r=camsteffen
Handle intra-doc links in doc_markdown

Fixes #7758

changelog: Handle intra-doc links in [`doc_markdown`]
2021-10-06 19:16:22 +00:00
Manish Goregaokar
2a8d7bd0dd Handle intra-doc links in doc_markdown 2021-10-06 08:38:35 -07:00
Manish Goregaokar
80408ef8dc Add regression test for #7758 2021-10-06 08:31:14 -07:00
bors
b9d753e4f5 Auto merge of #7776 - tsoutsman:patch-1, r=flip1995
Fix typos

I'm not sure whether I should add links to `bool`, `char`, and `str`. `slice` could also be linked to.

changelog: none
2021-10-06 13:23:13 +00:00
Klim Tsoutsman
8b37928131
Fix typos
I'm not sure whether I should add links to `bool`, `char`, and `str`. `slice` could also be linked to.
2021-10-06 23:32:22 +11:00
bors
c6b915825f Auto merge of #7774 - dswij:useless-exponent, r=llogiq
Useless exponent

Closes #7745

I'm open to some thoughts on dropping the exponents on suggestions when it's zero. I personally don't see any problem on this.

changelog: [`useless_exponent`] suggestion drops exponent when exponent value is zero
2021-10-06 07:54:27 +00:00
bors
871b8b5d4c Auto merge of #7773 - Manishearth:update-lints-mods, r=flip1995
Move module declarations back into lib.rs

With #7673 we moved a lot of things from lib.rs to lib.foo.rs. Unfortunately, rustfmt doesn't seem to work when module declarations are included via `include!` (and trying the `mod foo; use foo::*;` trick doesn't seem to work much either in our specific case).

With this PR we continue generating everything in subfiles except for module declarations, which are now generated within lib.rs.

changelog: none
2021-10-06 07:38:38 +00:00
dswij
e476d05c8f Add tests for zero exponents in excessive_precision 2021-10-06 15:33:05 +08:00
Manish Goregaokar
d9488c50ce Regen update_lints 2021-10-06 00:12:58 -07:00
Manish Goregaokar
0e481b9452 Return to generating mod declarations in lib.rs 2021-10-06 00:12:38 -07:00
dswij
42f2304ce4 Drop exponent suggestion when 0
This commit changes numeric literal formatting to drop exponent when
exponent is 0.
2021-10-06 15:02:38 +08:00
bors
b9dedf3959 Auto merge of #7770 - zvavybir:master, r=xFrednet
improved help message for `suspicious_map`

`suspicious_map`'s help message assumes that the literal behavior is never the intended one, although it's sometimes.  This PR adds a mention of `inspect`, offering a idiomatic alternative.

fixes #7767

---

changelog: Improved help message of [`suspicious_map`].
2021-10-05 19:51:09 +00:00
Matthias Kaak
320ecb1f0b Mentioned inspect in lint description of suspicious_map 2021-10-05 19:40:15 +00:00
Matthias Kaak
7c82e78f30 improved help message for suspicious_map 2021-10-05 19:09:08 +00:00
bors
abe551ecb7 Auto merge of #7762 - HKalbasi:master, r=Manishearth
Add lint `equatable_if_let`

This is my attempt for #1716. There is a major false positive, which is people may implement `PartialEq` in a different way. It is unactionable at the moment so I put it into `nursery`.

There is a trait `StructuralPartialEq` for solving this problem which is promising but it has several problems currently:
* Integers and tuples doesn't implement it.
* Some types wrongly implement it, like `Option<T>` when `T` doesn't implement it.

I consider them bugs and against the propose of `StructuralPartialEq`. When they become fixed, this lint can become a useful lint with a single line change.

changelog: New lint: [`equatable_if_let`]
2021-10-04 19:38:04 +00:00
hkalbasi
388a3d0983 Implement equatable if let lint 2021-10-04 22:16:42 +03:30
bors
3311b366e9 Auto merge of #7761 - giraffate:fix_ice_in_inplicit_hasher, r=Manishearth
Fix ICE in `implicit_hasher`

close #7712

changelog: Fix ICE in [`implicit_hasher`]
2021-10-04 17:07:00 +00:00
Takayuki Nakata
72f0180f7b Fix ICE in implicit_hasher 2021-10-04 23:31:40 +09:00
bors
87bb18e7c2 Auto merge of #88175 - camsteffen:let-desugar-span, r=Manishearth
Add expansion to while desugar spans

In the same vein as #88163, this reverts a change in Clippy behavior as a result of #80357 (and reverts some `#[allow]`s): This changes `clippy::blocks_in_if_conditions` to not fire on `while` loops. Though we might actually want Clippy to lint those cases, we should introduce the change purposefully, with tests, and possibly under a different lint name.

The actual change here is to add a desugaring expansion to the spans when lowering a `while` loop.

r? `@Manishearth`
2021-10-03 21:44:10 +00:00
bors
63b04f7d7f Auto merge of #7755 - HKalbasi:master, r=xFrednet
exclude enum from derivable impls

fix #7753

changelog: Exclude enum from ``[`derivable_impls`]``
2021-10-03 10:30:16 +00:00
HKalbasi
0ebc656a9a
Change not enum to is struct 2021-10-03 13:01:57 +03:30
bors
33c34fb2d7 Auto merge of #7709 - Qwaz:drop_non_send, r=xFrednet
Implement `non_send_field_in_send_ty` lint

changelog: Implement [`non_send_fields_in_send_ty`] lint

Fixes #7703
2021-10-03 08:43:32 +00:00
hkalbasi
ea8e65f0da exclude enum from derivable impls 2021-10-03 11:58:27 +03:30
Cameron Steffen
e165c12932 Make diangostic item names consistent 2021-10-02 19:38:19 -05:00
Yechan Bae
fb0353b28d Update documentation and name for non_send_fields_in_send_ty lint 2021-10-02 19:22:37 -04:00
Cameron Steffen
9c2d52fabe Add desugaring mark to while loop 2021-10-02 17:41:14 -05:00
bors
da3b4b4594 Auto merge of #7747 - Manishearth:excessive-precision, r=xFrednet
Correctly handle signs in exponents in numeric_literal::format()

Fixes #7744

changelog: Correctly handle signs in exponents in `numeric_literal::format()`
2021-10-02 16:12:30 +00:00
Manish Goregaokar
6bf5c0b185 Correctly handle signs in exponents in numeric_literal::format() 2021-10-01 17:27:47 -07:00
Manish Goregaokar
51160808b8 Add regression test 2021-10-01 16:14:35 -07:00
bors
2cb37a1911 Auto merge of #89449 - Manishearth:rollup-3alb61f, r=Manishearth
Rollup of 7 pull requests

Successful merges:

 - #85223 (rustdoc: Clarified the attribute which prompts the warning)
 - #88847 (platform-support.md: correct ARMv7+MUSL platform triple notes)
 - #88963 (Coerce const FnDefs to implement const Fn traits )
 - #89376 (Fix use after drop in self-profile with llvm events)
 - #89422 (Replace whitespaces in doctests' name with dashes)
 - #89440 (Clarify a sentence in the documentation of Vec (#84488))
 - #89441 (Normalize after substituting via `field.ty()`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-10-01 22:47:22 +00:00
Manish Goregaokar
6d18c9912f Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obk
Coerce const FnDefs to implement const Fn traits

You can now pass a FnDef to a function expecting `F` where `F: ~const FnTrait`.

r? ``@oli-obk``

``@rustbot`` label T-compiler F-const_trait_impl
2021-10-01 14:46:48 -07:00
bors
72bf97f932 Auto merge of #88880 - cjgillot:no-krate, r=oli-obk
Rework HIR API to make invocations of the hir_crate query harder.

`hir_crate` forces the recomputation of queries that depend on it.

This PR aims at avoiding useless invocations of `hir_crate` by making dependent code go through `tcx.hir()`.
2021-10-01 20:06:34 +00:00
Yechan Bae
ef8df9df68 Forgot to bless ui-toml test 2021-10-01 14:26:04 -04:00
Yechan Bae
dfed2e31d5 Do not use full type path in help message 2021-10-01 14:04:20 -04:00
Yechan Bae
4f01656a7d Add ui-test for enable-raw-pointer-heuristic-for-send config 2021-10-01 14:04:20 -04:00
Yechan Bae
08f0aecffd Minor changes from PR feedback 2021-10-01 14:04:20 -04:00
Yechan Bae
427a09ba7b Add configuration for raw pointer heuristic 2021-10-01 14:04:20 -04:00
Yechan Bae
d413e157a5 Look into tuple, array, ADT args in raw pointer heuristic 2021-10-01 14:04:20 -04:00
Yechan Bae
ee74574876 Emit one report for all fields in the same ADT 2021-10-01 14:04:20 -04:00
Yechan Bae
a81a5ad1a8 Update documentation 2021-10-01 14:04:20 -04:00
Yechan Bae
6458630e1a typo 2021-10-01 14:04:20 -04:00
Yechan Bae
d7a9ec2c50 Fix attribute handling 2021-10-01 14:04:20 -04:00
Yechan Bae
e4c3000e5b Initial implementation 2021-10-01 14:04:20 -04:00
bors
fe999e88ed Auto merge of #7741 - surechen:fix_if_then_panic, r=flip1995
Make if_then_panic handle situation of BinOpKind::And || BinOpKind::Or

fixes #7731

Make if_then_panic handle situation of cond.kind = ExprKind::DropTemps(ExprKind::Binary(BinOpKind::And || BinOpKind::Or, left, right), ..) =

changelog: [`if_then_panic`] Fix suggestion for more complex conditions
2021-10-01 10:04:19 +00:00
surechen
41e2c68a6e use sugg::Sugg::maybe_par 2021-10-01 13:13:09 +08:00
Manish Goregaokar
730d86f521 Rollup merge of #88782 - asquared31415:issue-79559, r=cjgillot
Fix ICE when `start` lang item has wrong generics

In my previous pr #87875 I missed the requirements on the `start` lang item due to its relative difficulty to test and opting for more conservative estimates.  This fixes that by updating the requirement to be exactly one generic type.

The `start` lang item should have exactly one generic type for the return type of the `main` fn ptr passed to it.  I believe having zero would previously *sometimes* compile (often with the use of `fn() -> ()` as the fn ptr but it was likely UB to call if the return type of `main` was not `()` as far as I know) however it also sometimes would not for various errors including ICEs and LLVM errors depending on exact situations.  Having more than 1 generic has always failed with an ICE because only the one generic type is expected and provided.

Fixes #79559, fixes #73584, fixes #83117 (all duplicates)
Relevant to #9307

r? ````@cjgillot````
2021-09-30 18:05:20 -07:00
bors
f8303ada90 Auto merge of #7338 - camsteffen:shadow, r=llogic
Re-write shadow lints

changelog: Move shadow_unrelated to restriction
changelog: The shadow lints find a lot more shadows and are not limited to certain patterns

Drastically simplifies the implementation. Catches a lot more cases.

I removed the "initialization happens here" note. It is not helpful IMO.

Closes #318
Fixes #2890
Fixes #6563
Fixes #7588
Fixes #7620
2021-09-30 19:08:22 +00:00