]> git.lizzy.rs Git - rust.git/log
rust.git
18 months agoUse ubuntu-20.04 instead of ubuntu-latest
xFrednet [Tue, 6 Dec 2022 18:13:53 +0000 (19:13 +0100)]
Use ubuntu-20.04 instead of ubuntu-latest

18 months agoAuto merge of #10027 - smoelius:fix-10021, r=dswij
bors [Sun, 4 Dec 2022 01:58:43 +0000 (01:58 +0000)]
Auto merge of #10027 - smoelius:fix-10021, r=dswij

Fix 10021

This PR proposes a fix for #10021.

The problem is similar to the one that `@mikerite` described in #9505. The compiler is generating an empty substitution for a call, even though the type of `Self` seems to be needed for a predicate. In `@mikerite's` case, the call was to [`IntoFuture::into_future`](https://doc.rust-lang.org/std/future/trait.IntoFuture.html#tymethod.into_future). In this case, the call is to [`Try::branch`](https://doc.rust-lang.org/std/ops/trait.Try.html#tymethod.branch).

The proposed fix is to verify that the parameter whose type is changing has an index within the substitution. The strikes me as a reasonable approach, since if the check were to fail, the following code would be a no-op:

https://github.com/rust-lang/rust-clippy/blob/4c123a06ba3c2ec17d3a4dfa251dccdc5368b712/clippy_lints/src/methods/unnecessary_to_owned.rs#L420-L428

Like `@mikerite's` original solution, this solution turns ICEs into false negatives.

changelog: fix `unnecessary_to_owned` false positive involving `Try::branch`

19 months agoFix #10021
Samuel Moelius [Sat, 3 Dec 2022 01:41:29 +0000 (20:41 -0500)]
Fix #10021

19 months agoAdd test for #10021
Samuel Moelius [Sat, 3 Dec 2022 01:39:38 +0000 (20:39 -0500)]
Add test for #10021

19 months agoAuto merge of #10026 - samueltardieu:missing-slash, r=flip1995
bors [Fri, 2 Dec 2022 16:27:29 +0000 (16:27 +0000)]
Auto merge of #10026 - samueltardieu:missing-slash, r=flip1995

Add missing slash to produce function documentation

changelog: none

19 months agoAdd missing slash to produce function documentation
Samuel Tardieu [Fri, 2 Dec 2022 15:26:15 +0000 (16:26 +0100)]
Add missing slash to produce function documentation

19 months agoAuto merge of #10022 - Jarcho:issue_10019, r=giraffate
bors [Fri, 2 Dec 2022 07:17:13 +0000 (07:17 +0000)]
Auto merge of #10022 - Jarcho:issue_10019, r=giraffate

Don't lint `implicit_clone` when the type doesn't implement clone

fixes #10019
changelog: `implicit_clone`: Don't lint when the type doesn't implement clone

19 months agoAuto merge of #9962 - mdgaziur:master, r=dswij
bors [Fri, 2 Dec 2022 05:49:26 +0000 (05:49 +0000)]
Auto merge of #9962 - mdgaziur:master, r=dswij

Fix #9958

This PR fixes #9958. In order to fix the issue, the lint will now peel reference operators and enclose the expression with parentheses when necessary.

changelog: [`comparison_to_empty`]: Peel deref operators in suggestions when necessary

19 months agoAuto merge of #9982 - Jarcho:issue_9935, r=flip1995
bors [Fri, 2 Dec 2022 04:31:55 +0000 (04:31 +0000)]
Auto merge of #9982 - Jarcho:issue_9935, r=flip1995

Don't lint `from_over_into` for opaque types

fixes #9935

This is stalled until the next sync. The impl in question can't be written on the pinned nightly.

changelog: Don't lint `from_over_into` for opaque types

19 months agoDon't lint `implicit_clone` when the type doesn't implement clone
Jason Newcomb [Fri, 2 Dec 2022 04:05:53 +0000 (23:05 -0500)]
Don't lint `implicit_clone` when the type doesn't implement clone

19 months agoAuto merge of #10013 - Jarcho:issue_9886, r=Manishearth
bors [Thu, 1 Dec 2022 22:49:40 +0000 (22:49 +0000)]
Auto merge of #10013 - Jarcho:issue_9886, r=Manishearth

Don't lint `manual_assert` in `else if`

fixes #9886
changelog: `manual_assert`: Don't lint in `else if`

19 months agoDon't lint `manual_assert` in `else if`
Jason Newcomb [Thu, 1 Dec 2022 17:30:19 +0000 (12:30 -0500)]
Don't lint `manual_assert` in `else if`

19 months agoAuto merge of #10008 - Jarcho:issue_9882, r=Manishearth
bors [Thu, 1 Dec 2022 22:37:15 +0000 (22:37 +0000)]
Auto merge of #10008 - Jarcho:issue_9882, r=Manishearth

Treat custom enum discriminant values as constants

fixes #9882
changelog: All lints: Don't lint in enum discriminant values when the suggestion won't work in a const context

19 months agoAuto merge of #10006 - Jarcho:issue_9890, r=Manishearth
bors [Thu, 1 Dec 2022 22:25:38 +0000 (22:25 +0000)]
Auto merge of #10006 - Jarcho:issue_9890, r=Manishearth

Don't suggest removing `mut` from references in `redundant_static_lifetimes`

fixes #9890
changelog: `redundant_static_lifetimes`: Don't suggest removing `mut` from references

19 months agoAuto merge of #9966 - alex-semenyuk:manual_let_else_paren, r=xFrednet
bors [Thu, 1 Dec 2022 22:11:01 +0000 (22:11 +0000)]
Auto merge of #9966 - alex-semenyuk:manual_let_else_paren, r=xFrednet

Fix manual_let_else produces a wrong suggestion with or-patterns

Fix #9938
changelog: Sugg: [`manual_let_else`]: Suggestions for or-patterns now include required brackets.
[#9966](https://github.com/rust-lang/rust-clippy/pull/9966)

19 months agoAuto merge of #10012 - Jarcho:issue_9885, r=Alexendoo
bors [Thu, 1 Dec 2022 20:26:46 +0000 (20:26 +0000)]
Auto merge of #10012 - Jarcho:issue_9885, r=Alexendoo

Don't lint `string_lit_as_bytes` in match scrutinees

fixes #9885
changelog: `string_lit_as_bytes`: Don't lint in match scrutinees

19 months agoDon't lint `string_lit_as_bytes` in match scrutinees
Jason Newcomb [Thu, 1 Dec 2022 17:17:38 +0000 (12:17 -0500)]
Don't lint `string_lit_as_bytes` in match scrutinees

19 months agoFix manual_let_else produces a wrong suggestion with or-patterns
alex-semenyuk [Sat, 26 Nov 2022 16:21:07 +0000 (19:21 +0300)]
Fix manual_let_else produces a wrong suggestion with or-patterns

19 months agoDon't lint `from_over_into` for opaque types
Jason Newcomb [Tue, 29 Nov 2022 05:20:53 +0000 (00:20 -0500)]
Don't lint `from_over_into` for opaque types

19 months agoAuto merge of #10010 - flip1995:rustup, r=flip1995
bors [Thu, 1 Dec 2022 13:21:51 +0000 (13:21 +0000)]
Auto merge of #10010 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

19 months agoBump nightly version -> 2022-12-01
Philipp Krones [Thu, 1 Dec 2022 11:55:29 +0000 (12:55 +0100)]
Bump nightly version -> 2022-12-01

19 months agoMerge remote-tracking branch 'upstream/master' into rustup
Philipp Krones [Thu, 1 Dec 2022 11:39:42 +0000 (12:39 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

19 months agoAuto merge of #10007 - Jarcho:issue_10005, r=giraffate
bors [Thu, 1 Dec 2022 07:20:06 +0000 (07:20 +0000)]
Auto merge of #10007 - Jarcho:issue_10005, r=giraffate

Fix ICE in `result_large_err` with uninhabited enums

fixes #10005
changelog: `result_large_err`: Fix ICE with uninhabited enums

19 months agoTreat custom enum discriminant values as constants
Jason Newcomb [Thu, 1 Dec 2022 03:34:42 +0000 (22:34 -0500)]
Treat custom enum discriminant values as constants

19 months agoFix ICE in `result large_err` with uninhabited enums
Jason Newcomb [Thu, 1 Dec 2022 02:44:18 +0000 (21:44 -0500)]
Fix ICE in `result large_err` with uninhabited enums

19 months agoDon't suggest removing `mut` from references in `redundant_static_lifetimes`
Jason Newcomb [Thu, 1 Dec 2022 02:29:48 +0000 (21:29 -0500)]
Don't suggest removing `mut` from references in `redundant_static_lifetimes`

19 months agoAuto merge of #9943 - dswij:pr-9940, r=Jarcho
bors [Wed, 30 Nov 2022 21:23:10 +0000 (21:23 +0000)]
Auto merge of #9943 - dswij:pr-9940, r=Jarcho

manual_let_else: keep macro call on suggestion blocks

Closes #9940

changelog: [`manual_let_else`]: Do not expand macro calls on suggestions

19 months agoAuto merge of #10001 - Jarcho:issue_9866, r=llogiq
bors [Wed, 30 Nov 2022 19:54:25 +0000 (19:54 +0000)]
Auto merge of #10001 - Jarcho:issue_9866, r=llogiq

Fix ICE in `unused_rounding`

fixes #9866
changelog: `unused_rounding`: Fix ICE when using the `_` separator

19 months agoAuto merge of #9996 - Jarcho:issue_9906, r=Alexendoo
bors [Wed, 30 Nov 2022 19:40:22 +0000 (19:40 +0000)]
Auto merge of #9996 - Jarcho:issue_9906, r=Alexendoo

Fix `unnecessary_cast` suggestion when taking a reference

fixes #9906
changelog: `unnecessary_cast`: Fix suggestion when taking a reference

19 months agoAuto merge of #9997 - Jarcho:issue_9901, r=llogiq
bors [Wed, 30 Nov 2022 19:29:40 +0000 (19:29 +0000)]
Auto merge of #9997 - Jarcho:issue_9901, r=llogiq

Don't lint `explicit_auto_deref` when the initial type is neither a reference, nor a receiver

fixes #9901
fixes #9777
changelog: `explicit_auto_deref`: Don't lint when the initial value is neither a reference, nor a receiver

19 months agoFix ICE in `unused_rounding`
Jason Newcomb [Wed, 30 Nov 2022 17:31:38 +0000 (12:31 -0500)]
Fix ICE in `unused_rounding`

19 months agoAuto merge of #9987 - Jarcho:issue_9957, r=flip1995
bors [Wed, 30 Nov 2022 16:31:56 +0000 (16:31 +0000)]
Auto merge of #9987 - Jarcho:issue_9957, r=flip1995

Don't cross contexts while building the suggestion for `redundant_closure_call`

fixes #9957

changelog: `redundant_closure_call`: Don't cross macro contexts while building the suggestion

19 months agoDon't lint `explicit_auto_deref` when the initial type is neither a reference, nor...
Jason Newcomb [Wed, 30 Nov 2022 16:15:49 +0000 (11:15 -0500)]
Don't lint `explicit_auto_deref` when the initial type is neither a reference, nor a receiver

19 months agoFix `unnecessary_cast` suggestion when taking a reference
Jason Newcomb [Wed, 30 Nov 2022 15:48:53 +0000 (10:48 -0500)]
Fix `unnecessary_cast` suggestion when taking a reference

19 months agoDon't cross contexts while building the suggestion for `redundant_closure_call`
Jason Newcomb [Tue, 29 Nov 2022 15:36:43 +0000 (10:36 -0500)]
Don't cross contexts while building the suggestion for `redundant_closure_call`

19 months agoFix #9958
mdgaziur [Sat, 26 Nov 2022 06:17:49 +0000 (12:17 +0600)]
Fix #9958

19 months agoAuto merge of #9989 - xFrednet:9986-move-safety-thingy, r=flip1995
bors [Wed, 30 Nov 2022 12:44:45 +0000 (12:44 +0000)]
Auto merge of #9989 - xFrednet:9986-move-safety-thingy, r=flip1995

Move `unnecessary_unsafety_doc` to `pedantic`

This lint was added in #9822. I like the idea, but also agree with #9986 as well. I think it should at least not be warn-by-default. This is one of these cases, where I'd like a group between pedantic and restriction. But I believe that users using `#![warn(clippy::pedantic)]` will know how to enable the lint if they disagree with it.

---

Since the lint is new:

changelog: none

r? `@flip1995` since I'd suggest back porting this, the original PR was merged 16 days ago.

Closes: #9986 (While it doesn't address everything, I believe that this is the best compromise)
19 months agoMove `unnecessary_unsafety_doc` to `pedantic`
xFrednet [Tue, 29 Nov 2022 17:22:02 +0000 (18:22 +0100)]
Move `unnecessary_unsafety_doc` to `pedantic`

19 months agoAuto merge of #104905 - compiler-errors:normalization-changes, r=spastorino
bors [Wed, 30 Nov 2022 11:13:09 +0000 (11:13 +0000)]
Auto merge of #104905 - compiler-errors:normalization-changes, r=spastorino

Some initial normalization method changes

1. Rename `AtExt::normalize` to `QueryNormalizeExt::query_normalize` (using the `QueryNormalizer`)
2. Introduce `NormalizeExt::normalize` to replace `partially_normalize_associated_types_in` (using the `AssocTypeNormalizer`)
3. Rename `FnCtxt::normalize_associated_types_in` to `FnCtxt::normalize`
4. Remove some unused other normalization fns in `Inherited` and `FnCtxt`

Also includes one drive-by where we're no longer creating a `FnCtxt` inside of `check_fn`, but passing it in. This means we don't need such weird `FnCtxt` construction logic.

Stacked on top of #104835 for convenience.

r? types

19 months agoUse `snippet_with_context` instead of `_with_macro_callsite`
dswij [Wed, 30 Nov 2022 06:50:13 +0000 (14:50 +0800)]
Use `snippet_with_context` instead of `_with_macro_callsite`

19 months agoAuto merge of #9985 - ehuss:triagebot-autolabel, r=xFrednet
bors [Tue, 29 Nov 2022 13:30:15 +0000 (13:30 +0000)]
Auto merge of #9985 - ehuss:triagebot-autolabel, r=xFrednet

Add S-waiting-on-review autolabel.

This adds the S-waiting-on-review autolabel feature for new PRs.  This was previously handled by highfive, but I neglected to include it in #9963.

changelog: none

19 months agoAdd S-waiting-on-review autolabel.
Eric Huss [Tue, 29 Nov 2022 13:18:43 +0000 (05:18 -0800)]
Add S-waiting-on-review autolabel.

19 months agoAuto merge of #9975 - xFrednet:0000-refutable-slice-pedantic, r=llogiq
bors [Tue, 29 Nov 2022 11:16:01 +0000 (11:16 +0000)]
Auto merge of #9975 - xFrednet:0000-refutable-slice-pedantic, r=llogiq

Move `index_refutable_slice` to `pedantic`

During the creation, I out this lint into the nursery group to let it run in the wild before moving it to a commonly used group. This move never happened until now, though. It should be safe, as Clippy and I have been using it for months and there are no open issues for is :)

---

changelog: Move `index_refutable_slice` to `pedantic` (Now warn-by-default)
[#9975](https://github.com/rust-lang/rust-clippy/pull/9975)

19 months agoAuto merge of #9981 - Jarcho:issue_9954, r=flip1995
bors [Tue, 29 Nov 2022 09:49:46 +0000 (09:49 +0000)]
Auto merge of #9981 - Jarcho:issue_9954, r=flip1995

Don't lint `unnecessary_operation` in mixed macro contexts

fixes #9954

changelog: `unnecessary_operation`: Don't lint in mixed macro contexts.

19 months agoAuto merge of #9980 - Jarcho:issue_9960, r=xFrednet
bors [Tue, 29 Nov 2022 09:10:14 +0000 (09:10 +0000)]
Auto merge of #9980 - Jarcho:issue_9960, r=xFrednet

Don't lint `unnecessary_cast` in mixed macro context

fixes #9960

Time to start making a dent in this onslaught.

changelog: `unnecessary_cast`: Don't lint when the identifiers context differs from its binding's context for locals

19 months agoDon't lint `unnecessary_cast` in mixed macro context
Jason Newcomb [Tue, 29 Nov 2022 04:30:56 +0000 (23:30 -0500)]
Don't lint `unnecessary_cast` in mixed macro context

19 months agoDon't lint `unnecessary_operation` in mixed macro contexts
Jason Newcomb [Tue, 29 Nov 2022 04:56:02 +0000 (23:56 -0500)]
Don't lint `unnecessary_operation` in mixed macro contexts

19 months agoMove `index_refutable_slice` to `pedantic`
xFrednet [Mon, 28 Nov 2022 19:23:09 +0000 (20:23 +0100)]
Move `index_refutable_slice` to `pedantic`

19 months agoFnCtxt normalization stuff
Michael Goulet [Fri, 25 Nov 2022 17:28:50 +0000 (17:28 +0000)]
FnCtxt normalization stuff

19 months agopartially_normalize_... -> At::normalize
Michael Goulet [Fri, 25 Nov 2022 17:11:15 +0000 (17:11 +0000)]
partially_normalize_... -> At::normalize

19 months agoAuto merge of #9865 - nyurik:allow-mixed, r=xFrednet
bors [Mon, 28 Nov 2022 17:22:36 +0000 (17:22 +0000)]
Auto merge of #9865 - nyurik:allow-mixed, r=xFrednet

Add allow-mixed-uninlined-format-args config

Implement `allow-mixed-uninlined-format-args` config param to change the behavior of the `uninlined_format_args` lint. Now it is a part of `style` per [Zulip chat](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/.60uninlined_format_args.60.20category), and won't propose inlining in case of a mixed usage, e.g. `print!("{} {}", var, 1+2)`. If the user sets `allow-mixed-uninlined-format-args` config param to `false`, the lint would behave like it did before -- proposing to inline args even in the mixed case.

---

changelog: [`uninlined_format_args`]: Added a new config `allow-mixed-uninlined-format-args` to allow the lint, if only some arguments can be inlined
[#9865](https://github.com/rust-lang/rust-clippy/pull/9865)
changelog: Moved [`uninlined_format_args`] to `style` (Now warn-by-default)
[#9865](https://github.com/rust-lang/rust-clippy/pull/9865)

19 months agoRollup merge of #104804 - nnethercote:MetaItemLit, r=petrochenkov
Matthias Krüger [Mon, 28 Nov 2022 16:25:46 +0000 (17:25 +0100)]
Rollup merge of #104804 - nnethercote:MetaItemLit, r=petrochenkov

Rename `ast::Lit` as `ast::MetaItemLit`.

And some other literal cleanups.

r? `@petrochenkov`

19 months agofix clippy tests
Esteban Küber [Mon, 28 Nov 2022 08:41:31 +0000 (00:41 -0800)]
fix clippy tests

19 months agoRename `ast::Lit` as `ast::MetaItemLit`.
Nicholas Nethercote [Wed, 23 Nov 2022 04:39:42 +0000 (15:39 +1100)]
Rename `ast::Lit` as `ast::MetaItemLit`.

19 months agoAuto merge of #9967 - koka831:fix/9416, r=llogiq
bors [Sun, 27 Nov 2022 19:03:06 +0000 (19:03 +0000)]
Auto merge of #9967 - koka831:fix/9416, r=llogiq

Remove blank lines when needless_return returns no value

fix https://github.com/rust-lang/rust-clippy/issues/9416

changelog: [`needless_return`] improve result format

r? `@llogiq`

19 months agoAuto merge of #9963 - ehuss:highfive-triagebot, r=xFrednet
bors [Sun, 27 Nov 2022 16:20:05 +0000 (16:20 +0000)]
Auto merge of #9963 - ehuss:highfive-triagebot, r=xFrednet

Migrate from highfive to triagebot

This migrates this repository from using the highfive bot to using triagebot (aka rustbot).

This should not be merged without coordinating the removal of the highfive webhook and/or merging https://github.com/rust-lang/highfive/pull/435.

changelog: none

19 months agoaddressed review feedback
Yuri Astrakhan [Sun, 27 Nov 2022 15:34:13 +0000 (10:34 -0500)]
addressed review feedback

19 months agoMigrate from highfive to triagebot
Eric Huss [Mon, 24 Oct 2022 23:33:53 +0000 (16:33 -0700)]
Migrate from highfive to triagebot

19 months agoAdd allow-mixed-uninlined-format-args config
Yuri Astrakhan [Sun, 27 Nov 2022 15:12:51 +0000 (10:12 -0500)]
Add allow-mixed-uninlined-format-args config

Implement `allow-mixed-uninlined-format-args` config param to change the behavior of the `uninlined_format_args` lint. Now it is a part of `style`, and won't propose inlining in case of a mixed usage, e.g. `print!("{} {}", var, 1+2)`. If the user sets allow-mixed-uninlined-format-args config param to `false`, then it would behave like before, proposing to inline args even in the mixed case.

19 months agoAuto merge of #9919 - Alexendoo:configuration-link, r=xFrednet
bors [Sun, 27 Nov 2022 14:42:54 +0000 (14:42 +0000)]
Auto merge of #9919 - Alexendoo:configuration-link, r=xFrednet

Link to a list of configurable lints in documentation

changelog: none

19 months agoAuto merge of #104048 - cjgillot:split-lifetime, r=compiler-errors
bors [Sun, 27 Nov 2022 14:30:19 +0000 (14:30 +0000)]
Auto merge of #104048 - cjgillot:split-lifetime, r=compiler-errors

Separate lifetime ident from lifetime resolution in HIR

Drive-by: change how suggested generic args are computed.
Fixes https://github.com/rust-lang/rust/issues/103815

I recommend reviewing commit-by-commit.

19 months agoRefactor BytePos handling
koka [Sun, 27 Nov 2022 13:41:06 +0000 (22:41 +0900)]
Refactor BytePos handling

19 months agoRemove blank lines when needless_return returns no value
koka [Sun, 27 Nov 2022 13:01:21 +0000 (22:01 +0900)]
Remove blank lines when needless_return returns no value

fix https://github.com/rust-lang/rust-clippy/issues/9416

19 months agoAuto merge of #9860 - Alexendoo:msrv-outer-attr, r=Jarcho
bors [Sun, 27 Nov 2022 12:58:54 +0000 (12:58 +0000)]
Auto merge of #9860 - Alexendoo:msrv-outer-attr, r=Jarcho

Allow using `clippy::msrv` as an outer attribute

changelog: Allow specifying `#[clippy::msrv]` as an outer attribute

Probably not too useful to clippy users, but it makes the MSRV tests slightly cleaner

19 months agoAllow using `clippy::msrv` as an outer attribute
Alex Macleod [Sat, 19 Nov 2022 12:50:02 +0000 (12:50 +0000)]
Allow using `clippy::msrv` as an outer attribute

19 months agoLink to a list of configurable lints in documentation
Alex Macleod [Sun, 20 Nov 2022 13:27:55 +0000 (13:27 +0000)]
Link to a list of configurable lints in documentation

19 months agoAuto merge of #9950 - xFrednet:0000-improve-exit-docs, r=llogiq
bors [Sun, 27 Nov 2022 08:47:20 +0000 (08:47 +0000)]
Auto merge of #9950 - xFrednet:0000-improve-exit-docs, r=llogiq

Improve `EXIT` lint docs

Super simple change, hopefully fast and fun to review. Have a great start to the weekend!

changelog: none

19 months agoImprove `EXIT` lint docs
xFrednet [Fri, 25 Nov 2022 20:50:38 +0000 (21:50 +0100)]
Improve `EXIT` lint docs

19 months agoAuto merge of #9945 - kraktus:uninlined_multiple_lines, r=llogiq
bors [Fri, 25 Nov 2022 18:36:50 +0000 (18:36 +0000)]
Auto merge of #9945 - kraktus:uninlined_multiple_lines, r=llogiq

Re-enable `uninlined_format_args` on multiline `format!`

fix https://github.com/rust-lang/rust-clippy/issues/9719

There was an issue with the code suggestion which can be sometimes completely broken (fortunately when applied it's valid), so we do not show it.

changelog: [`uninlined_format_args`] re-enable for multiline format expression, but do not show the literal code suggestion in those cases

19 months agoAuto merge of #9944 - flip1995:move-syntax-tree-patterns, r=Manishearth
bors [Fri, 25 Nov 2022 15:59:47 +0000 (15:59 +0000)]
Auto merge of #9944 - flip1995:move-syntax-tree-patterns, r=Manishearth

Move syntax tree patterns RFC to the book

r? `@Manishearth`

Follow up to #3875

changelog: none

19 months agoAuto merge of #104846 - spastorino:santa-clauses-make-goals-early-christmas-🎄, r...
bors [Fri, 25 Nov 2022 15:59:31 +0000 (15:59 +0000)]
Auto merge of #104846 - spastorino:santa-clauses-make-goals-early-christmas-🎄, r=oli-obk

Branch Clause from Predicate

r? `@oli-obk`

This is part of what's proposed in https://github.com/rust-lang/compiler-team/issues/531

19 months agodogfood with expanded `uninlined_format_args`
kraktus [Fri, 25 Nov 2022 15:41:08 +0000 (16:41 +0100)]
dogfood with expanded `uninlined_format_args`

19 months agoRe-enable `uninlined_format_args` on multiline `format!`
kraktus [Fri, 25 Nov 2022 15:36:22 +0000 (16:36 +0100)]
Re-enable `uninlined_format_args` on multiline `format!`

But do not display the code suggestion which can be sometimes completely broken (fortunately when applied it's valid)

19 months agoAuto merge of #9851 - Veykril:unnecessary-safety-comment, r=giraffate
bors [Fri, 25 Nov 2022 12:55:24 +0000 (12:55 +0000)]
Auto merge of #9851 - Veykril:unnecessary-safety-comment, r=giraffate

Lint unnecessary safety comments

changelog: [`unnecessary_safety_comment`]: Add unnecessary safety comment lint

Addresses https://github.com/rust-lang/rust-clippy/issues/7954

This does not necessarily catch all occurences, as doing so would require checking all expressions in the entire source which seems rather expensive. Instead what the lint does is it checks items, statements and the tail expression of blocks for safety comments, then checks if those comments are necessary or not, then linting for the unnecessary ones.

I kept the tests in one file to check that the lints do not clash with each other.

19 months agoBook: Format syntax tree pattern proposal
Philipp Krones [Fri, 25 Nov 2022 10:39:36 +0000 (11:39 +0100)]
Book: Format syntax tree pattern proposal

19 months agoMove syntax tree patterns RFC to the book
Philipp Krones [Fri, 25 Nov 2022 10:39:04 +0000 (11:39 +0100)]
Move syntax tree patterns RFC to the book

19 months ago`manual_let_else`: Add test with expanded macros
dswij [Fri, 25 Nov 2022 10:04:31 +0000 (18:04 +0800)]
`manual_let_else`: Add test with expanded macros

19 months ago`manual_let_else`: keep macro call on suggestion blocks
dswij [Fri, 25 Nov 2022 10:04:17 +0000 (18:04 +0800)]
`manual_let_else`: keep macro call on suggestion blocks

19 months agoRollup merge of #104873 - RalfJung:therefore, r=Dylan-DPC
Matthias Krüger [Fri, 25 Nov 2022 09:44:40 +0000 (10:44 +0100)]
Rollup merge of #104873 - RalfJung:therefore, r=Dylan-DPC

RefCell::get_mut: fix typo

and fix the same typo in a bunch of other places

19 months agoAddress reviews
Lukas Wirth [Thu, 24 Nov 2022 08:47:50 +0000 (09:47 +0100)]
Address reviews

19 months agoSimplify
Lukas Wirth [Thu, 17 Nov 2022 14:17:28 +0000 (15:17 +0100)]
Simplify

19 months agoLint unnecessary safety comments on statements and block tail expressions
Lukas Wirth [Thu, 17 Nov 2022 14:14:03 +0000 (15:14 +0100)]
Lint unnecessary safety comments on statements and block tail expressions

19 months agoAdd some more test cases for undocumented_unsafe_blocks
Lukas Wirth [Thu, 17 Nov 2022 10:00:51 +0000 (11:00 +0100)]
Add some more test cases for undocumented_unsafe_blocks

19 months agoLint unnecessary safety comments on items
Lukas Wirth [Mon, 14 Nov 2022 12:42:47 +0000 (13:42 +0100)]
Lint unnecessary safety comments on items

19 months agoRefCell::get_mut: fix typo
Ralf Jung [Fri, 25 Nov 2022 07:47:59 +0000 (08:47 +0100)]
RefCell::get_mut: fix typo

and fix the same typo in a bunch of other places

19 months agoIntroduce PredicateKind::Clause
Santiago Pastorino [Thu, 24 Nov 2022 21:14:58 +0000 (18:14 -0300)]
Introduce PredicateKind::Clause

19 months agoSimplify a bunch of trait ref obligation creations
Oli Scherer [Fri, 18 Nov 2022 21:29:26 +0000 (21:29 +0000)]
Simplify a bunch of trait ref obligation creations

19 months agoAuto merge of #9941 - Alexendoo:syntax-tree-rfc-remark, r=Manishearth
bors [Thu, 24 Nov 2022 23:46:59 +0000 (23:46 +0000)]
Auto merge of #9941 - Alexendoo:syntax-tree-rfc-remark, r=Manishearth

Fix remark for `rfcs/0001-syntax-tree-patterns.md`

https://github.com/rust-lang/rust-clippy/actions/runs/3542472739/jobs/5948006255#step:6:37

Removes the unused definitions, for the line length I disabled the lint for now as I gather it's going to be moved into the book in the future

r? `@Manishearth`

changelog: none

19 months agoFix remark for `rfcs/0001-syntax-tree-patterns.md`
Alex Macleod [Thu, 24 Nov 2022 21:33:25 +0000 (21:33 +0000)]
Fix remark for `rfcs/0001-syntax-tree-patterns.md`

19 months agoAuto merge of #103693 - HKalbasi:master, r=oli-obk
bors [Thu, 24 Nov 2022 20:29:13 +0000 (20:29 +0000)]
Auto merge of #103693 - HKalbasi:master, r=oli-obk

Make rustc_target usable outside of rustc

I'm working on showing type size in rust-analyzer (https://github.com/rust-lang/rust-analyzer/pull/13490) and I currently copied rustc code inside rust-analyzer, which works, but is bad. With this change, I would become able to use `rustc_target` and `rustc_index` directly in r-a, reducing the amount of copy needed.

This PR contains some feature flag to put nightly features behind them to make crates buildable on the stable compiler + makes layout related types generic over index type + removes interning of nested layouts.

19 months agoUse kw::Empty for elided lifetimes in path.
Camille GILLOT [Sun, 6 Nov 2022 11:40:31 +0000 (11:40 +0000)]
Use kw::Empty for elided lifetimes in path.

19 months agoAuto merge of #104321 - Swatinem:async-gen, r=oli-obk
bors [Thu, 24 Nov 2022 17:14:42 +0000 (17:14 +0000)]
Auto merge of #104321 - Swatinem:async-gen, r=oli-obk

Avoid `GenFuture` shim when compiling async constructs

Previously, async constructs would be lowered to "normal" generators, with an additional `from_generator` / `GenFuture` shim in between to convert from `Generator` to `Future`.

The compiler will now special-case these generators internally so that async constructs will *directly* implement `Future` without the need to go through the `from_generator` / `GenFuture` shim.

The primary motivation for this change was hiding this implementation detail in stack traces and debuginfo, but it can in theory also help the optimizer as there is less abstractions to see through.

---

Given this demo code:

```rust
pub async fn a(arg: u32) -> Backtrace {
    let bt = b().await;
    let _arg = arg;
    bt
}

pub async fn b() -> Backtrace {
    Backtrace::force_capture()
}
```

I would get the following with the latest stable compiler (on Windows):

```
   4: async_codegen::b::async_fn$0
             at .\src\lib.rs:10
   5: core::future::from_generator::impl$1::poll<enum2$<async_codegen::b::async_fn_env$0> >
             at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91
   6: async_codegen::a::async_fn$0
             at .\src\lib.rs:4
   7: core::future::from_generator::impl$1::poll<enum2$<async_codegen::a::async_fn_env$0> >
             at /rustc/897e37553bba8b42751c67658967889d11ecd120\library\core\src\future\mod.rs:91
```

whereas now I get a much cleaner stack trace:

```
   3: async_codegen::b::async_fn$0
             at .\src\lib.rs:10
   4: async_codegen::a::async_fn$0
             at .\src\lib.rs:4
```

19 months agomove some layout logic to rustc_target::abi::layout
hkalbasi [Tue, 1 Nov 2022 16:20:30 +0000 (19:50 +0330)]
move some layout logic to rustc_target::abi::layout

19 months agoAvoid `GenFuture` shim when compiling async constructs
Arpad Borsos [Fri, 18 Nov 2022 21:56:22 +0000 (22:56 +0100)]
Avoid `GenFuture` shim when compiling async constructs

Previously, async constructs would be lowered to "normal" generators,
with an additional `from_generator` / `GenFuture` shim in between to
convert from `Generator` to `Future`.

The compiler will now special-case these generators internally so that
async constructs will *directly* implement `Future` without the need
to go through the `from_generator` / `GenFuture` shim.

The primary motivation for this change was hiding this implementation
detail in stack traces and debuginfo, but it can in theory also help
the optimizer as there is less abstractions to see through.

19 months agoRollup merge of #104742 - WaffleLapkin:forbidden-SUPER-deref, r=compiler-errors
Matthias Krüger [Thu, 24 Nov 2022 07:42:34 +0000 (08:42 +0100)]
Rollup merge of #104742 - WaffleLapkin:forbidden-SUPER-deref, r=compiler-errors

Make `deref_into_dyn_supertrait` lint the impl and not the usage

Proposed by ``@compiler-errors`` in https://github.com/rust-lang/rust/issues/89460#issuecomment-1320806785
r? ``@crlf0710``

19 months agoMerge pull request #3875 from fkohlgrueber/syntax-tree-patterns
Manish Goregaokar [Wed, 23 Nov 2022 22:24:17 +0000 (17:24 -0500)]
Merge pull request #3875 from fkohlgrueber/syntax-tree-patterns

RFC: syntax tree patterns

19 months agoFix clippy code
Esteban Küber [Thu, 3 Nov 2022 16:19:23 +0000 (09:19 -0700)]
Fix clippy code

19 months agoSeparate lifetime ident from resolution in HIR.
Camille GILLOT [Sat, 5 Nov 2022 22:41:07 +0000 (22:41 +0000)]
Separate lifetime ident from resolution in HIR.

19 months agoMove `get_associated_type` from `clippy` to `rustc_lint`
Maybe Waffle [Tue, 22 Nov 2022 19:52:46 +0000 (19:52 +0000)]
Move `get_associated_type` from `clippy` to `rustc_lint`

19 months agoRollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnr
Manish Goregaokar [Wed, 23 Nov 2022 03:54:38 +0000 (22:54 -0500)]
Rollup merge of #103488 - oli-obk:impl_trait_for_tait, r=lcnr

Allow opaque types in trait impl headers and rely on coherence to reject unsound cases

r? ````@lcnr````

fixes #99840