]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoDocument string_lit_as_bytes known problems
David Tolnay [Thu, 8 Oct 2020 11:50:24 +0000 (04:50 -0700)]
Document string_lit_as_bytes known problems

3 years agoDowngrade string_lit_as_bytes to nursery
David Tolnay [Mon, 5 Oct 2020 19:19:35 +0000 (12:19 -0700)]
Downgrade string_lit_as_bytes to nursery

3 years agoAuto merge of #6124 - pickfire:patch-1, r=flip1995
bors [Tue, 6 Oct 2020 23:22:28 +0000 (23:22 +0000)]
Auto merge of #6124 - pickfire:patch-1, r=flip1995

Use more concrete explanation for methods

*Please keep the line below*
changelog: none

3 years agoAuto merge of #6127 - ebroto:reinstate_forbid_restriction, r=flip1995
bors [Tue, 6 Oct 2020 22:33:57 +0000 (22:33 +0000)]
Auto merge of #6127 - ebroto:reinstate_forbid_restriction, r=flip1995

Reinstate test for forbid(clippy::restriction)

In [this commit](https://github.com/rust-lang/rust-clippy/pull/6126/commits/5747c15961da9d2d0b0dd775174d39f3b5961597) coming from rust-lang/rust (#6126) the test for `#![forbid(clippy::restriction)]` was removed because some restriction lints were being allowed after the forbid.

This change reinstates the test for `forbid` by using a separate file.

changelog: none

r? `@flip1995`

3 years agoReinstate test for forbid blanket restriction
Eduardo Broto [Tue, 6 Oct 2020 22:02:28 +0000 (00:02 +0200)]
Reinstate test for forbid blanket restriction

3 years agoAuto merge of #6126 - flip1995:rustup, r=flip1995
bors [Tue, 6 Oct 2020 21:34:50 +0000 (21:34 +0000)]
Auto merge of #6126 - flip1995:rustup, r=flip1995

Rustup

Supersedes #6121. There was another breakage.

r? `@ghost`

changelog: none

3 years agoRun fmt
flip1995 [Tue, 6 Oct 2020 21:32:38 +0000 (23:32 +0200)]
Run fmt

3 years agoUse more concrete explanation for methods
Ivan Tham [Tue, 6 Oct 2020 15:58:32 +0000 (23:58 +0800)]
Use more concrete explanation for methods

Show some code rather than "a single method call".

3 years agoFix tools
Matthew Jasper [Tue, 30 Jun 2020 21:41:57 +0000 (22:41 +0100)]
Fix tools

3 years agoRollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr
Yuki Okushi [Tue, 6 Oct 2020 07:26:11 +0000 (16:26 +0900)]
Rollup merge of #77560 - rschoon:fix-litkind-rc-bytebuf, r=lcnr

Fix LitKind's byte buffer to use refcounted slice

While working on adding a new lint for clippy (see https://github.com/rust-lang/rust-clippy/pull/6044) for avoiding shared ownership of "mutable buffer" types (such as using `Rc<Vec<T>>` instead of `Rc<[T]>`), I noticed a type exported from rustc_ast and used by clippy gets caught by the lint. This PR fixes the exported type.

This PR includes the actual change to clippy too, but I will open a PR directly against clippy for that part (although it will currently fail to build there).

3 years agoRollup merge of #77534 - Mark-Simulacrum:issue-70819-disallow-override-forbid-in...
Yuki Okushi [Tue, 6 Oct 2020 07:26:04 +0000 (16:26 +0900)]
Rollup merge of #77534 - Mark-Simulacrum:issue-70819-disallow-override-forbid-in-same-scope, r=petrochenkov

Disallow overriding forbid in same scope

Rebased #73379.

Fixes #70819.

3 years agoAuto merge of #6078 - ebroto:unnecessary_sort_by_take_2, r=phansch
bors [Tue, 6 Oct 2020 06:59:33 +0000 (06:59 +0000)]
Auto merge of #6078 - ebroto:unnecessary_sort_by_take_2, r=phansch

unnecessary sort by: avoid dereferencing the suggested closure parameter

This change tries to simplify the solution for problematic cases but is less restrictive than  #6006.

* We can't dereference shared references to non-Copy types, so the new suggestion does not do that. Note that this implies that the suggested closure parameter will be a reference.
* We can't take a reference to the closure parameter in the returned key, so we don't lint in those cases. This can happen either because the key borrows from the parameter (e.g. `|a| a.borrows()`), or because we suggest `|a| Reverse(a)`. If we did we would hit this error:
```
error: lifetime may not live long enough
  --> /home/ebroto/src/ebroto-clippy/tests/ui/unnecessary_sort_by.fixed:19:25
   |
19 |     vec.sort_by_key(|b| Reverse(b));
   |                      -- ^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
   |                      ||
   |                      |return type of closure is Reverse<&'2 isize>
   |                      has type `&'1 isize`

error: aborting due to previous error
```

Note that Clippy does not currently have the (MIR-based) machinery necessary to check that what is borrowed is actually the closure parameter.

changelog: [`unnecessary_sort_by`]: avoid dereferencing the suggested closure parameter

Fixes #6001

3 years agoAuto merge of #6114 - FliegendeWurst:no-mistyped-fraction, r=Manishearth
bors [Mon, 5 Oct 2020 21:17:37 +0000 (21:17 +0000)]
Auto merge of #6114 - FliegendeWurst:no-mistyped-fraction, r=Manishearth

Do not lint float fractions in `mistyped_literal_suffixes`

As suggested in https://github.com/rust-lang/rust-clippy/issues/4706#issuecomment-544797928, the fractional part is now ignored (the integer part is checked instead).

Fixes: #4706
changelog: `mistyped_literal_suffixes` no longer warns on the fractional part of a float (e.g. 713.23_64)

3 years agoAuto merge of #6118 - ebroto:rustup, r=ebroto
bors [Mon, 5 Oct 2020 20:44:31 +0000 (20:44 +0000)]
Auto merge of #6118 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`

3 years agoFix rustup fallout
Eduardo Broto [Mon, 5 Oct 2020 20:32:04 +0000 (22:32 +0200)]
Fix rustup fallout

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Mon, 5 Oct 2020 20:13:44 +0000 (22:13 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoFix test formatting
FliegendeWurst [Mon, 5 Oct 2020 10:23:01 +0000 (12:23 +0200)]
Fix test formatting

3 years agoDo not lint float fractions in `mistyped_literal_suffixes` (fixes #4706)
FliegendeWurst [Mon, 5 Oct 2020 10:08:57 +0000 (12:08 +0200)]
Do not lint float fractions in `mistyped_literal_suffixes` (fixes #4706)

3 years agoclippy: `(Body, DefId)` -> `Body`
Dylan MacKenzie [Sun, 4 Oct 2020 22:23:20 +0000 (15:23 -0700)]
clippy: `(Body, DefId)` -> `Body`

3 years agoChange clippy's Constant back to refcount clone byte strings
Robin Schoonover [Sun, 4 Oct 2020 21:53:37 +0000 (15:53 -0600)]
Change clippy's Constant back to refcount clone byte strings

3 years agoPrevent forbid from being ignored if overriden at the same level.
Felix S. Klock II [Mon, 15 Jun 2020 18:17:35 +0000 (14:17 -0400)]
Prevent forbid from being ignored if overriden at the same level.

That is, this changes `#[forbid(foo)] #[allow(foo)]` from allowing foo to
forbidding foo.

3 years agoAuto merge of #6111 - flip1995:rustup, r=flip1995
bors [Sun, 4 Oct 2020 12:04:31 +0000 (12:04 +0000)]
Auto merge of #6111 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: Deprecate [`drop_bounds`] lint. This lint was uplifted to rustc with the same name.

3 years agoAuto merge of #6105 - bugadani:sus-char, r=ebroto
bors [Fri, 2 Oct 2020 22:22:37 +0000 (22:22 +0000)]
Auto merge of #6105 - bugadani:sus-char, r=ebroto

Lint for invisible Unicode characters other than ZWSP

This PR extends the existing `zero_width_space` lint to look for other invisible characters as well (in this case, `\\u{ad}` soft hyphen.

I feel like this lint is the logical place to add the check, but I also realize the lint name is not particularly flexible, but I also understand that it shouldn't be renamed for compatibility reasons.

Open questions:
 - What other characters should trigger the lint?
 - What should be done with the lint name?
 - How to indicate the change in functionality?

Motivation behind this PR: https://github.com/rust-lang/rust/issues/77417 - I managed to shoot myself in the foot by an invisible character pasted into my test case.

changelog: rename [`zero_width_space`] to [`invisible_characters`] and add SHY and WJ to the list.

3 years agoAdd WJ
Dániel Buga [Fri, 2 Oct 2020 22:07:56 +0000 (00:07 +0200)]
Add WJ

3 years agoRename lint to invisible_characters
Dániel Buga [Fri, 2 Oct 2020 22:03:33 +0000 (00:03 +0200)]
Rename lint to invisible_characters

3 years agoAuto merge of #6098 - longlb:interior_mut_const, r=ebroto
bors [Fri, 2 Oct 2020 21:21:49 +0000 (21:21 +0000)]
Auto merge of #6098 - longlb:interior_mut_const, r=ebroto

Downgrade interior_mutable_const lints to warn by default

This change updates the two lints in the file non_copy_const.rs to be warn by default rather than deny by default. It also updates the known problems for declare_interior_mutable_const to mention some issues that are affected by the lints.

This is a repeat pull request since I botched the first one (#6012). Apart from my messing up the commits of that one, I also had a problem where the stderr of the tests didn't change despite me changing both lints to warn by default. Is this normal behaviour for some lints or do I need to adjust the tests to accommodate the change?

fixes #5863
changelog: none

3 years agochanged non_copy_const lints to warn by default
Long Louis Bui [Wed, 30 Sep 2020 19:13:12 +0000 (12:13 -0700)]
changed non_copy_const lints to warn by default

3 years agoDeprecate clippy lint
Michael Howell [Fri, 2 Oct 2020 18:34:14 +0000 (11:34 -0700)]
Deprecate clippy lint

3 years agoRun update_lints
Dániel Buga [Fri, 2 Oct 2020 10:02:54 +0000 (12:02 +0200)]
Run update_lints

3 years agoLook for soft hyphens as well
Dániel Buga [Fri, 2 Oct 2020 09:54:31 +0000 (11:54 +0200)]
Look for soft hyphens as well

3 years agoAuto merge of #6104 - mikerite:fix-6096, r=ebroto
bors [Fri, 2 Oct 2020 08:36:54 +0000 (08:36 +0000)]
Auto merge of #6104 - mikerite:fix-6096, r=ebroto

Allow exponent separator

Fixes #6096

changelog: Fixed bug in `clippy::inconsistent_digit_grouping` when floating point exponent is used

3 years agoAllow exponent separator
Michael Wright [Fri, 2 Oct 2020 03:43:43 +0000 (05:43 +0200)]
Allow exponent separator

Fixes #6096

3 years agoAuto merge of #6102 - giraffate:no_lint_when_invalid_suggestion_in_needless_range_loo...
bors [Thu, 1 Oct 2020 16:29:08 +0000 (16:29 +0000)]
Auto merge of #6102 - giraffate:no_lint_when_invalid_suggestion_in_needless_range_loop, r=flip1995

Don't emit a lint for the suggestion leading to errors in `needless_range_loop`

Fix #5945

changelog: Don't emit a lint for the suggestion leading to errors in `needless_range_loop`

3 years agoDon't emit a lint for the suggestion leading to errors in `needless_range_loop`
Takayuki Nakata [Thu, 1 Oct 2020 14:53:05 +0000 (23:53 +0900)]
Don't emit a lint for the suggestion leading to errors in `needless_range_loop`

3 years agoAuto merge of #5978 - montrivo:needless-lifetime, r=ebroto
bors [Thu, 1 Oct 2020 13:43:24 +0000 (13:43 +0000)]
Auto merge of #5978 - montrivo:needless-lifetime, r=ebroto

needless-lifetime - nested elision sites

Closes #2944

changelog: fix needless-lifetime nested elision site FPs

3 years agoAuto merge of #6092 - jethrogb:jb/inline-asm-syntax-lint, r=ebroto
bors [Wed, 30 Sep 2020 21:44:29 +0000 (21:44 +0000)]
Auto merge of #6092 - jethrogb:jb/inline-asm-syntax-lint, r=ebroto

Add lint for inline assembly syntax style preference

changelog: Add lint for inline assembly syntax style preference

3 years agoUpdate tests/ui/asm_syntax.rs
Eduardo Broto [Wed, 30 Sep 2020 21:30:49 +0000 (23:30 +0200)]
Update tests/ui/asm_syntax.rs

Use a single `only` header command in asm_syntax test

3 years agoAdd lint for inline assembly syntax style preference
Jethro Beekman [Mon, 28 Sep 2020 13:30:47 +0000 (15:30 +0200)]
Add lint for inline assembly syntax style preference

3 years agoneedless-lifetime / pr remarks
Tim Nielens [Tue, 29 Sep 2020 22:33:46 +0000 (00:33 +0200)]
needless-lifetime / pr remarks

3 years agoneedless-lifetime / add known problem item
Tim Nielens [Tue, 29 Sep 2020 22:08:19 +0000 (00:08 +0200)]
needless-lifetime / add known problem item

3 years agoneedless-lifetime / fix master merge
Tim Nielens [Tue, 29 Sep 2020 21:06:08 +0000 (23:06 +0200)]
needless-lifetime / fix master merge

3 years agoMerge branch 'master' into needless-lifetime
Tim Nielens [Tue, 29 Sep 2020 20:51:59 +0000 (22:51 +0200)]
Merge branch 'master' into needless-lifetime

3 years agoAuto merge of #6093 - ebroto:6089_renamed_lifetimes, r=Manishearth
bors [Tue, 29 Sep 2020 08:41:39 +0000 (08:41 +0000)]
Auto merge of #6093 - ebroto:6089_renamed_lifetimes, r=Manishearth

needless arbitrary self: handle macros

This fixes two cases related to macros:

* If the parameter comes from expansion, do not lint as the user has no possibility of changing it. This is not directly related to the fixed issue, but we should probably do that.
* If *only* the lifetime name comes from expansion, lint, but allow the user decide the name of the lifetime. In the related issue, the lifetime was unnamed and then renamed by `async_trait`, so just removing the name in the suggestion would work, but in the general case a macro can rename a lifetime that was named differently, and we can't reliably know that name anymore.

As a hint for the reviewer, the expanded code for the test can be checked with this command (from the root dir of the repo):
```sh
rustc -L target/debug/test_build_base/needless_arbitrary_self_type_unfixable.stage-id.aux -Zunpretty=expanded tests/ui/needless_arbitrary_self_type_unfixable.rs
```

changelog: [`needless_arbitrary_self_type`]: handle macros

Fixes #6089

3 years agoAuto merge of #6094 - ebroto:rustup, r=ebroto
bors [Tue, 29 Sep 2020 03:27:59 +0000 (03:27 +0000)]
Auto merge of #6094 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Mon, 28 Sep 2020 21:05:40 +0000 (23:05 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoneedless arbitrary self: handle macros
Eduardo Broto [Mon, 28 Sep 2020 17:14:39 +0000 (19:14 +0200)]
needless arbitrary self: handle macros

3 years agoRollup merge of #76474 - bjorn3:driver_selected_codegen, r=oli-obk
Ralf Jung [Mon, 28 Sep 2020 16:39:40 +0000 (18:39 +0200)]
Rollup merge of #76474 - bjorn3:driver_selected_codegen, r=oli-obk

Add option to pass a custom codegen backend from a driver

This allows the driver to pass information to the codegen backend. For example the headcrab debugger may in the future want to use cg_clif to JIT code to be injected in the debuggee. This would PR make it possible to tell cg_clif which symbol can be found at which address and to tell it to inject the JITed code into the right process.

This PR may also help with https://github.com/rust-lang/miri/pull/1540 by allowing miri to provide a codegen backend that only emits metadata and doesn't perform any codegen.

cc @nbaksalyar (headcrab)
cc @RalfJung (miri)

3 years agoAuto merge of #6091 - ebroto:rustup, r=ebroto
bors [Sun, 27 Sep 2020 13:33:48 +0000 (13:33 +0000)]
Auto merge of #6091 - ebroto:rustup, r=ebroto

Rustup

changelog: none

r? `@ghost`

3 years agoFix dogfood
Eduardo Broto [Sun, 27 Sep 2020 13:20:19 +0000 (15:20 +0200)]
Fix dogfood

3 years agoRun cargo dev fmt
Eduardo Broto [Sun, 27 Sep 2020 13:17:13 +0000 (15:17 +0200)]
Run cargo dev fmt

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Sun, 27 Sep 2020 13:09:52 +0000 (15:09 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoAdd option to pass a custom codegen backend from a driver
bjorn3 [Tue, 8 Sep 2020 11:44:41 +0000 (13:44 +0200)]
Add option to pass a custom codegen backend from a driver

3 years agoAuto merge of #6090 - Fishrock123:rc_buffer-formatting-caveats, r=yaahc
bors [Sun, 27 Sep 2020 00:38:23 +0000 (00:38 +0000)]
Auto merge of #6090 - Fishrock123:rc_buffer-formatting-caveats, r=yaahc

lints: clarify rc_buffer and add caveats

This didn't display some types properly in the docs due the lack of code formatting.

Also, refs for the caveat:
https://github.com/rust-lang/rust-clippy/pull/6044#issuecomment-699559082
https://github.com/http-rs/surf/pull/242

Fwiw I can't get `cargo test` to run, even on nightly. I get:
```
error[E0463]: can't find crate for `rustc_ast`
```

*Please keep the line below*
changelog: none, nightly

3 years agolints: clarify rc_buffer and add caveats
Jeremiah Senkpiel [Sun, 27 Sep 2020 00:19:12 +0000 (17:19 -0700)]
lints: clarify rc_buffer and add caveats

This didn't display some types properly in the docs due the lack of code formatting.

Also, refs for the caveat:
https://github.com/rust-lang/rust-clippy/pull/6044#issuecomment-699559082
https://github.com/http-rs/surf/pull/242

3 years agoAuto merge of #6081 - ilknarf:master, r=matthiaskrgr
bors [Sat, 26 Sep 2020 20:55:53 +0000 (20:55 +0000)]
Auto merge of #6081 - ilknarf:master, r=matthiaskrgr

New Lint: disallowed_method

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

I added a `disallowed_method` lint that works similar to `blacklisted_name`, e.g allows config-defined disallowed method calls.

This lint allows advanced users to patch in undesired method calls for specific projects. It basically uses the DefId of method calls and matches it to parsed strings. Is there an alternative approach that could use more easily digestible configuration strings?

All tests pass as expected except for a linting error on `ui/redundant_pattern_matching_option`, which I am not sure how to resolve since I don't think I changed anything affecting it.

changelog: Add disallowed_method lint to warn on user-defined method calls

3 years agoAuto merge of #6079 - giraffate:print_stdout_in_build_rs, r=ebroto
bors [Sat, 26 Sep 2020 20:34:35 +0000 (20:34 +0000)]
Auto merge of #6079 - giraffate:print_stdout_in_build_rs, r=ebroto

Fix FP in `print_stdout`

Fix #6041

This lint shouldn't be emitted in `build.rs` as `println!` and `print!` are used for the build script.

changelog: none

3 years agoAdd missing attr to clippy_workspace_tests/build.rs
Eduardo Broto [Sat, 26 Sep 2020 20:22:47 +0000 (22:22 +0200)]
Add missing attr to clippy_workspace_tests/build.rs

3 years agoAdd build script but does not work in the dogfood test
Takayuki Nakata [Sat, 26 Sep 2020 14:54:18 +0000 (23:54 +0900)]
Add build script but does not work in the dogfood test

3 years agoRemove all unstable feature support in the `missing_const_for_fn` lint
Oliver Scherer [Sat, 26 Sep 2020 14:23:56 +0000 (16:23 +0200)]
Remove all unstable feature support in the `missing_const_for_fn` lint

3 years agoSome small fixes
Takayuki Nakata [Sat, 26 Sep 2020 14:10:25 +0000 (23:10 +0900)]
Some small fixes

3 years agoMove `qualify_min_const_fn` out of rustc into clippy
Oliver Scherer [Sat, 26 Sep 2020 14:08:24 +0000 (16:08 +0200)]
Move `qualify_min_const_fn` out of rustc into clippy

3 years agoupdate lint description
Frank [Fri, 25 Sep 2020 16:12:45 +0000 (11:12 -0500)]
update lint description

3 years agoremove useless test, update disallowed_method description
Frank [Fri, 25 Sep 2020 16:03:45 +0000 (11:03 -0500)]
remove useless test, update disallowed_method description

3 years agoupdate error message, refactor disallowed_method
Frank [Fri, 25 Sep 2020 14:38:19 +0000 (09:38 -0500)]
update error message, refactor disallowed_method

3 years agofix error message
Frank [Thu, 24 Sep 2020 21:43:29 +0000 (16:43 -0500)]
fix error message

3 years agochange config variables to reference, remove wildcard import
Frank [Thu, 24 Sep 2020 21:26:29 +0000 (16:26 -0500)]
change config variables to reference, remove wildcard import

3 years agoupdate toml_unknown_key test
Frank [Thu, 24 Sep 2020 21:15:24 +0000 (16:15 -0500)]
update toml_unknown_key test

3 years agorun cargo dev fmt
Frank [Thu, 24 Sep 2020 21:00:46 +0000 (16:00 -0500)]
run cargo dev fmt

3 years agorun cargo dev update_lints
Frank [Thu, 24 Sep 2020 20:52:25 +0000 (15:52 -0500)]
run cargo dev update_lints

3 years agoupdate unused variable
Frank [Thu, 24 Sep 2020 20:36:38 +0000 (15:36 -0500)]
update unused variable

3 years agoadd disallowed_method lint
Frank [Thu, 24 Sep 2020 20:32:03 +0000 (15:32 -0500)]
add disallowed_method lint

3 years agoFix the detection of build scripts
Takayuki Nakata [Fri, 25 Sep 2020 14:32:18 +0000 (23:32 +0900)]
Fix the detection of build scripts

3 years agoAuto merge of #6084 - ebroto:ui_tests_cleanup, r=flip1995
bors [Fri, 25 Sep 2020 14:14:25 +0000 (14:14 +0000)]
Auto merge of #6084 - ebroto:ui_tests_cleanup, r=flip1995

UI tests cleanup

`@matthiaskrgr` noticed some `run-pass` annotations in some crash tests that were added in #3922. At that moment they seemed to be necessary to make the tests fail in case of an ICE, but they do not seem to be needed anymore. To test this I forced an ICE in a file with and without annotations, with and without stderr files, and the ICE makes the test fail every time.

In addition, I've applied a suggestion from `@ehuss` and `@jyn514` to add `emit=metadata` to the rustc flags for the UI tests. In my machine this improved the run time from ~17 to ~12 seconds.

changelog: none

3 years agoUse emit=link for auxiliary proc macro crates
Eduardo Broto [Fri, 25 Sep 2020 13:46:32 +0000 (15:46 +0200)]
Use emit=link for auxiliary proc macro crates

3 years agoAdd emit=metadata to UI tests build flags
Eduardo Broto [Fri, 25 Sep 2020 13:20:04 +0000 (15:20 +0200)]
Add emit=metadata to UI tests build flags

This should improve the performance by avoiding codegen

3 years agoRemove run-pass annotations from crash tests
Eduardo Broto [Fri, 25 Sep 2020 13:19:36 +0000 (15:19 +0200)]
Remove run-pass annotations from crash tests

It does not seem to be necessary

3 years agoAuto merge of #77144 - flip1995:clippyup, r=Manishearth
bors [Fri, 25 Sep 2020 06:23:55 +0000 (06:23 +0000)]
Auto merge of #77144 - flip1995:clippyup, r=Manishearth

Update Clippy

Bi-weekly Clippy update.

This includes a `Cargo.lock` update (d445493479711389f4dea3a0f433041077ba2088), so probably needs `rollup=never`.

r? `@Manishearth`

3 years agoRollup merge of #76724 - ecstatic-morse:dataflow-pass-names, r=lcnr
Jonas Schievink [Fri, 25 Sep 2020 00:29:31 +0000 (02:29 +0200)]
Rollup merge of #76724 - ecstatic-morse:dataflow-pass-names, r=lcnr

Allow a unique name to be assigned to dataflow graphviz output

Previously, if the same analysis were invoked multiple times in a single compilation session, the graphviz output for later runs would overwrite that of previous runs. Allow callers to add a unique identifier to each run so this can be avoided.

3 years agoFix FP in `print_stdout`
Takayuki Nakata [Thu, 24 Sep 2020 14:22:54 +0000 (23:22 +0900)]
Fix FP in `print_stdout`

This lint shouldn't be emitted in `build.rs` as `println!` and `print!` are used for the build script.

3 years agoAuto merge of #6077 - ebroto:revert_or_fun_call_const, r=matthiaskrgr
bors [Thu, 24 Sep 2020 14:14:53 +0000 (14:14 +0000)]
Auto merge of #6077 - ebroto:revert_or_fun_call_const, r=matthiaskrgr

Revert: or_fun_call should lint calls to `const fn`s with no args

The changes in #5889 and #5984 were done under the incorrect assumption that a `const fn` with no args was guaranteed to be evaluated at compile time.  A `const fn` is only guaranteed to be evaluated at compile time if it's inside a const context (the initializer of a `const` or a `static`).

See this [zulip conversation](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Common.20misconception.3A.20.60const.20fn.60.20and.20its.20effect.20on.20codegen/near/208059113) for more details on this common misconception.

Given that none of the linted methods by `or_fun_call` can be called in const contexts, the lint should make no exceptions.

changelog: [`or_fun_call`] lints again calls to `const fn` with no args

3 years agoAuto merge of #6076 - rail-rain:fix_fp_explicit_counter_loop, r=matthiaskrgr
bors [Thu, 24 Sep 2020 13:45:24 +0000 (13:45 +0000)]
Auto merge of #6076 - rail-rain:fix_fp_explicit_counter_loop, r=matthiaskrgr

Fix a FP in `explicit_counter_loop`

Fixes #4677 and #6074

Fix a false positive in `explicit_counter_loop` where the loop counter is used after incremented, adjust the test so that counters are incremented at the end of the loop and add the test for this false positive.

---

changelog: Fix a false positive in `explicit_counter_loop` where the loop counter is used after incremented

3 years agoMerge commit 'e636b88aa180e8cab9e28802aac90adbc984234d' into clippyup
flip1995 [Thu, 24 Sep 2020 12:49:22 +0000 (14:49 +0200)]
Merge commit 'e636b88aa180e8cab9e28802aac90adbc984234d' into clippyup

3 years agounnecessary sort by: avoid dereferencing closure param
Eduardo Broto [Wed, 23 Sep 2020 21:33:50 +0000 (23:33 +0200)]
unnecessary sort by: avoid dereferencing closure param

3 years agoAuto merge of #6044 - rschoon:rc-buffer, r=yaahc
bors [Wed, 23 Sep 2020 18:35:08 +0000 (18:35 +0000)]
Auto merge of #6044 - rschoon:rc-buffer, r=yaahc

Add `rc_buffer` lint for checking Rc<String> and friends

Fixes #2623

This is a bit different from the original PR attempting to implement this type of lint.   Rather than linting against converting into the unwanted types, this PR lints against declaring the unwanted type in a struct or function definition.

I'm reasonably happy with what I have here, although I used the fully qualified type names for the Path and OsString suggestions, and I'm not sure if I should have just used the short versions instead, even if they might not have been declared via use.

Also, I don't know if "buffer type" is the best way to put it or not.  Alternatively I could call it a "growable type" or "growable buffer type", but I was thinking of PathBuf when I started making the lint.

changelog: Add `rc_buffer` lint

3 years agoSatisfy rc_buffer lint in Constant::Binary byte string by copying data
Robin Schoonover [Wed, 23 Sep 2020 02:34:38 +0000 (20:34 -0600)]
Satisfy rc_buffer lint in Constant::Binary byte string by copying data

We can avoid the data copy again by fixing rustc_ast::ast::LitKind
later.

3 years agoRevert "Avoid or_fun_call for const_fn with no args"
Eduardo Broto [Tue, 22 Sep 2020 22:39:00 +0000 (00:39 +0200)]
Revert "Avoid or_fun_call for const_fn with no args"

This reverts commit 5d66bd7bb3fd701d70ec11217e3f89fabe5cb0a7.

3 years agoRevert "or_fn_call: ignore nullary associated const fns"
Eduardo Broto [Tue, 22 Sep 2020 22:34:56 +0000 (00:34 +0200)]
Revert "or_fn_call: ignore nullary associated const fns"

This reverts commit 7a66e6502dc3c7085b3f4078c01d4957d96175ed.

3 years agoFix a FP in `explicit_counter_loop`
rail [Wed, 10 Jun 2020 02:05:32 +0000 (14:05 +1200)]
Fix a FP in `explicit_counter_loop`

Fix a false positive in `explicit_counter_loop` where the loop counter is used after incremented,
adjust the test so that counters are incremented at the end of the loop
and add the test for this false positive.

3 years agoAuto merge of #6069 - alex-700:redundant-pattern-matching-in-macro, r=Manishearth
bors [Tue, 22 Sep 2020 16:01:39 +0000 (16:01 +0000)]
Auto merge of #6069 - alex-700:redundant-pattern-matching-in-macro, r=Manishearth

Forbid redundant_pattern_matching triggering in macros

fixes #6065

changelog: forbid redundant_pattern_matching triggering in macros

3 years agoForbid redundant_pattern_matching triggering in macros
Aleksei Latyshev [Sun, 20 Sep 2020 09:38:23 +0000 (12:38 +0300)]
Forbid redundant_pattern_matching triggering in macros

- remove ice-2636 test

3 years agoAuto merge of #6071 - ebroto:rustup, r=ebroto
bors [Mon, 21 Sep 2020 13:43:01 +0000 (13:43 +0000)]
Auto merge of #6071 - ebroto:rustup, r=ebroto

Rustup

r? `@ghost`

changelog: none

3 years agoSplit redundant_pattern_matching tests
Eduardo Broto [Mon, 21 Sep 2020 13:32:26 +0000 (15:32 +0200)]
Split redundant_pattern_matching tests

This is to avoid the 200 lines stderr file limit

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
Eduardo Broto [Mon, 21 Sep 2020 13:11:24 +0000 (15:11 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoRemove `can_suggest` from Clippy.
Christiaan Dirkx [Sun, 20 Sep 2020 22:00:33 +0000 (00:00 +0200)]
Remove `can_suggest` from Clippy.

Removes `can_suggest` from as it is no longer used.
Reverts rust-clippy#5724.

3 years agoUpdate Clippy testcases
Christiaan Dirkx [Sun, 20 Sep 2020 21:59:34 +0000 (23:59 +0200)]
Update Clippy testcases

Update the test `redundant_pattern_matching`: check if `is_some` and `is_none` are suggested within const contexts.

3 years agoAuto merge of #76136 - CDirkx:const-result, r=dtolnay
bors [Sun, 20 Sep 2020 13:07:11 +0000 (13:07 +0000)]
Auto merge of #76136 - CDirkx:const-result, r=dtolnay

Stabilize some Result methods as const

Stabilize the following methods of Result as const:
 - `is_ok`
 - `is_err`
 - `as_ref`

A test is also included, analogous to the test for `const_option`.

These methods are currently const under the unstable feature `const_result` (tracking issue: #67520).
I believe these methods to be eligible for stabilization because of the stabilization of #49146 (Allow if and match in constants) and the trivial implementations, see also: [PR#75463](https://github.com/rust-lang/rust/pull/75463) and [PR#76135](https://github.com/rust-lang/rust/pull/76135).

Note: these methods are the only methods currently under the `const_result` feature, thus this PR results in the removal of the feature.

Related: #76225

3 years agoUpdate src/tools/clippy/clippy_lints/src/matches.rs
CDirkx [Sun, 20 Sep 2020 10:21:23 +0000 (12:21 +0200)]
Update src/tools/clippy/clippy_lints/src/matches.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoRemove `can_suggest` check for `is_ok` and `is_err`.
Christiaan Dirkx [Sun, 20 Sep 2020 08:46:30 +0000 (10:46 +0200)]
Remove `can_suggest` check for `is_ok` and `is_err`.

`is_ok` and `is_err` are stabilized as const and can thus always be suggested.

3 years agoUpdate Clippy testcases
Christiaan Dirkx [Sun, 20 Sep 2020 01:32:36 +0000 (03:32 +0200)]
Update Clippy testcases

Update the test `redundant_pattern_matching`: check if `is_ok` and `is_err` are suggested within const contexts.
Also removes the `redundant_pattern_matching_const_result` test, as it is no longer needed.

3 years agoAuto merge of #6046 - rail-rain:change_criteria_non_copy_const, r=flip1995
bors [Fri, 18 Sep 2020 14:34:04 +0000 (14:34 +0000)]
Auto merge of #6046 - rail-rain:change_criteria_non_copy_const, r=flip1995

Change the criteria of `interior_mutable_const`

This implements my suggestion [here](https://github.com/rust-lang/rust-clippy/issues/5050#issuecomment-680310889), and so hopefully fixes #5050.

* stop linting associated types and generic type parameters
* start linting ones in trait impls
  whose corresponding definitions in the traits are generic
* remove the `is_copy` check
  as presumably the only purpose of it is to allow
  generics with `Copy` bounds as `Freeze` is internal
  and generics are no longer linted
* remove the term 'copy' from the tests
  as being `Copy` no longer have meaning

---

changelog: Change the criteria of `declare_interior_mutable_const` and `borrow_interior_mutable_const` to narrow the lints to only lint things that defenitly is a interior mutable type, not potentially.