Commit Graph

199717 Commits

Author SHA1 Message Date
Michael Goulet
bee48e3fdc Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments 2022-09-05 20:47:20 +00:00
Chayim Refael Friedman
fbf11cfc13 Recover from using ; as separator between fields 2022-09-05 19:15:23 +00:00
Camille GILLOT
fdf56cfc7c Add test. 2022-09-05 20:11:34 +02:00
Weihang Lo
11e66e155d Update cargo
8 commits in 4ed54cecce3ce9ab6ff058781f4c8a500ee6b8b5..646e9a0b9ea8354cc409d05f10e8dc752c5de78e
2022-08-27 18:41:39 +0000 to 2022-09-02 14:29:28 +0000
- Support inheriting jobserver fd for external subcommands (rust-lang/cargo#10511)
- refactor(cli): Lazy load config (rust-lang/cargo#11029)
- chore: Don't show genned docs in ripgrep (rust-lang/cargo#11040)
- Document private items for Cargo and publish under contributor guide (rust-lang/cargo#11019)
- Add names to CI jobs (rust-lang/cargo#11039)
- Rework test error handling (rust-lang/cargo#11028)
- Very slight `cargo add` documentation improvements (rust-lang/cargo#11033)
- Update compiling requirements. (rust-lang/cargo#11030)
2022-09-05 18:34:53 +01:00
Jhonny Bill Mena
31e9f40bcf FIX - broken translatable diagnostics tests 2022-09-05 12:59:56 -04:00
bors
b44197abb0 Auto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, r=cjgillot
Separate the receiver from arguments in HIR

Related to #100232

cc `@cjgillot`
2022-09-05 16:21:40 +00:00
bors
2ccf843471 Auto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, r=cjgillot
Separate the receiver from arguments in HIR

Related to #100232

cc `@cjgillot`
2022-09-05 16:21:40 +00:00
Jhonny Bill Mena
d14b3af6db [Gardening] UPDATE - tidy fixes 2022-09-05 12:09:10 -04:00
Jhonny Bill Mena
72f766ae71 FIX - broken translatable diagnostics tests 2022-09-05 12:07:48 -04:00
Jhonny Bill Mena
1524b59444 UPDATE - avoid exposing source_map methods from Handler 2022-09-05 11:42:48 -04:00
Thom Chiovoloni
850090d99c
Avoid UB in the Windows filesystem code in... bootstrap? 2022-09-05 08:39:11 -07:00
111
a42c0d79da fix comment 2022-09-05 23:18:18 +08:00
Takayuki Maeda
9cde34e180 use propagate_through_exprs instead of propagate_through_expr
fix `ExprKind` static_assert_size

fix hir-stats
2022-09-05 23:11:34 +09:00
Takayuki Maeda
8931da40e3 use propagate_through_exprs instead of propagate_through_expr
fix `ExprKind` static_assert_size

fix hir-stats
2022-09-05 23:11:34 +09:00
bors
2dc703fd6e Auto merge of #101228 - nnethercote:simplify-hir-PathSegment, r=petrochenkov
Simplify `hir::PathSegment`

r? `@petrochenkov`
2022-09-05 13:36:54 +00:00
bors
5ea99770d8 Auto merge of #101228 - nnethercote:simplify-hir-PathSegment, r=petrochenkov
Simplify `hir::PathSegment`

r? `@petrochenkov`
2022-09-05 13:36:54 +00:00
Takayuki Maeda
fea1c5f5c8 refactor: remove unnecessary variables 2022-09-05 22:31:02 +09:00
Takayuki Maeda
097ef517fe refactor: remove unnecessary variables 2022-09-05 22:31:02 +09:00
Takayuki Maeda
3955dc3480 separate the receiver from arguments in HIR under /clippy 2022-09-05 22:25:57 +09:00
Takayuki Maeda
4bcaddeeb2 separate the receiver from arguments in HIR under /clippy 2022-09-05 22:25:57 +09:00
Takayuki Maeda
87c6da363f separate the receiver from arguments in HIR 2022-09-05 22:25:49 +09:00
Nikita Popov
cbf3b2432e Add test for #98294
Add a test to make that the failure condition for this pattern is
optimized away.

Fixes #98294.
2022-09-05 15:24:18 +02:00
Eric Huss
ce3d526027 Add const_extern_fn to 1.62 release notes. 2022-09-05 05:57:46 -07:00
Camille GILLOT
037ab1d183 Remove generics_def_id_map from the resolver. 2022-09-05 13:32:13 +02:00
est31
2d8460ef43 Add matrix based test for documenting the let / let else temporary drop order
The drop order of let and let else is supposed to be the same,
and in order to ensure this, the test checks that this holds for
the given list of cases.

The test also ensures that we drop the temporaries of the
condition before executing the else block.

We made the test matrix based so it can check all the possible
combinations and find out possible edge cases.
2022-09-05 13:06:23 +02:00
Takayuki Maeda
016626ab12 suggest introducing an explicit lifetime if it does not exist 2022-09-05 19:45:53 +09:00
bors
6e4a9ab650 Auto merge of #101439 - Dylan-DPC:rollup-2wf1mtj, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #101142 (Improve HIR stats)
 - #101367 (Suggest `{Option,Result}::{copied,clone}()` to satisfy type mismatch)
 - #101391 (more clippy::perf fixes)
 - #101409 (Don't fire `rust_2021_incompatible_closure_captures` in `edition = 2021` crates)
 - #101420 (Fix `hir::Local` doc to match with the variable name used: `init`)
 - #101429 (Don't suggest reborrow if usage is inside a closure)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-05 09:48:49 +00:00
Dylan DPC
d2fdb5d1d6
Rollup merge of #101429 - compiler-errors:issue-101119, r=lcnr
Don't suggest reborrow if usage is inside a closure

I can't think of why we would ever be able to *successfully* suggest a mutable reborrow `&mut *` due to a move happening due to a closure, so just suppress it.

Fixes #101119
2022-09-05 14:15:55 +05:30
Dylan DPC
75e7bb842a
Rollup merge of #101420 - kraktus:doc_hir_local, r=cjgillot
Fix `hir::Local` doc to match with the variable name used: `init`
2022-09-05 14:15:54 +05:30
Dylan DPC
3a9e2ff3d8
Rollup merge of #101409 - WaffleLapkin:rust_2021_compatibility_no_warn_in_2021_crates, r=TaKO8Ki
Don't fire `rust_2021_incompatible_closure_captures` in `edition = 2021` crates

Fixes #101284
2022-09-05 14:15:53 +05:30
Dylan DPC
e4534fe6fe
Rollup merge of #101391 - matthiaskrgr:perf0309, r=oli-obk
more clippy::perf fixes
2022-09-05 14:15:52 +05:30
Dylan DPC
9ae329232b Rollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwco
Improve HIR stats

#100398 improve the AST stats collection done by `-Zhir-stats`. This PR does the same for HIR stats collection.

r? `@davidtwco`
2022-09-05 14:15:51 +05:30
Dylan DPC
d18dc3d2ab
Rollup merge of #101367 - compiler-errors:suggest-copied-or-cloned, r=lcnr
Suggest `{Option,Result}::{copied,clone}()` to satisfy type mismatch

Fixes #100699, but in the opposite direction (instead of suggesting to fix the signature, it fixes the body)
2022-09-05 14:15:51 +05:30
Dylan DPC
5d55009b79
Rollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwco
Improve HIR stats

#100398 improve the AST stats collection done by `-Zhir-stats`. This PR does the same for HIR stats collection.

r? `@davidtwco`
2022-09-05 14:15:51 +05:30
joboet
774cadfbfa
std: fix cleanup for uninitialized stdout (#101375) 2022-09-05 09:08:07 +02:00
bors
5b4bd154de Auto merge of #101414 - mystor:pm_nested_cross_thread, r=eddyb
proc_macro/bridge: use the cross-thread executor for nested proc-macros

While working on some other changes in the bridge, I noticed that when
running a nested proc-macro (which is currently only possible using
the unstable `TokenStream::expand_expr`), any symbols held by the
proc-macro client would be invalidated, as the same thread would be used
for the nested macro by default, and the interner doesn't handle nested
use.

After discussing with `@eddyb,` we decided the best approach might be to
force the use of the cross-thread executor for nested invocations, as it
will never re-use thread-local storage, avoiding the issue. This
shouldn't impact performance, as expand_expr is still unstable, and
infrequently used.

This was chosen rather than making the client symbol interner handle
nested invocations, as that would require replacing the internal
interner `Vec` with a `BTreeMap` (as valid symbol id ranges could now be
disjoint), and the symbol interner is known to be fairly perf-sensitive.

This patch adds checks to the execution strategy to use the cross-thread
executor when doing nested invocations. An alternative implementation
strategy could be to track this information in the `ExtCtxt`, however a
thread-local in the `proc_macro` crate was chosen to add an assertion so
that `rust-analyzer` is aware of the issue if it implements
`expand_expr` in the future.

r? `@eddyb`
2022-09-05 07:07:38 +00:00
Michael Goulet
76b494a9dd Normalize before erasing late-bound regions in equal_up_to_regions 2022-09-05 06:44:33 +00:00
Jakob Degen
46130a1d18 Remove unnecessary `EMIT_MIR_FOR_EACH_BITWIDTH 2022-09-04 23:25:25 -07:00
Jhonny Bill Mena
321e60bf34 UPDATE - into_diagnostic to take a Handler instead of a ParseSess
Suggested by the team in this Zulip Topic https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler

Handler already has almost all the capabilities of ParseSess when it comes to diagnostic emission, in this migration we only needed to add the ability to access source_map from the emitter in order to get a Snippet and the start_point. Not sure if this is the best way to address this gap
2022-09-05 02:18:45 -04:00
Nicholas Nethercote
2d4349c22d Pack Term in the same way as GenericArg.
This shrinks the `PredicateS` type, which is instanted frequently.
2022-09-05 15:08:52 +10:00
Nicholas Nethercote
79db32b64e Pack Term in the same way as GenericArg.
This shrinks the `PredicateS` type, which is instanted frequently.
2022-09-05 15:08:52 +10:00
bors
b763b14b2f Auto merge of #9342 - relrelb:or_default, r=dswij
Suggest `Entry::or_default` for `Entry::or_insert(Default::default())`

Unlike past similar work done in #6228, expand the existing `or_fun_call`
lint to detect `or_insert` calls with a `T::new()` or `T::default()`
argument, much like currently done for `unwrap_or` calls. In that case,
suggest the use of `or_default`, which is more idiomatic.

Note that even with this change, `or_insert_with(T::default)` calls
aren't detected as candidates for `or_default()`, in the same manner
that currently `unwrap_or_else(T::default)` calls aren't detected as
candidates for `unwrap_or_default()`.

Also, as a nearby cleanup, change `KNOW_TYPES` from `static` to `const`,
since as far as I understand it's preferred (should Clippy have a lint
for that?).

Addresses #3812.

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: [`or_fun_call`]: Suggest `Entry::or_default` for `Entry::or_insert(Default::default())`
2022-09-05 04:54:31 +00:00
Michael Goulet
41d4ea2314 Don't suggest reborrow if usage is inside a closure 2022-09-05 04:27:07 +00:00
Nicholas Nethercote
08a00eb0da Address review comments. 2022-09-05 14:20:29 +10:00
Nicholas Nethercote
25f6f18834 Make hir::PathSegment::res non-optional. 2022-09-05 14:20:25 +10:00
Nicholas Nethercote
bb0ae3c446 Make hir::PathSegment::hir_id non-optional. 2022-09-05 14:20:25 +10:00
Nicholas Nethercote
6d850d936b Make hir::PathSegment::res non-optional. 2022-09-05 14:20:25 +10:00
Nicholas Nethercote
ee244bf196 Remove dead code from print_generic_args. 2022-09-05 14:20:25 +10:00
Nicholas Nethercote
49b90573ac Add some blank lines to the definition of Res.
To make the spacing consistent.

Also shorten an overly long comment line.
2022-09-05 14:20:16 +10:00
bors
406e03fd02 Auto merge of #101386 - aDotInTheVoid:rdj-discriminant, r=GuillaumeGomez
Rustdoc-Json: Add enum discriminant

Does the first part of #101337, by adding it to `clean`, but doesn't change HTML output, as

1. [No Consensus has appeared on the UI for this](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Enum.20discriminant.20values.20in.20HTML.20output)
2. [When inlining across crates, information is lost](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60clean_variant_def.20.60vs.20.60clean_variant_data.60)

JSON doesn't have either of these limitations.

r? `@GuillaumeGomez`
2022-09-05 04:16:08 +00:00