Commit Graph

462 Commits

Author SHA1 Message Date
Matthias Krüger
1bafe0b020
Rollup merge of #101285 - TaKO8Ki:do-not-suggest-adding-move-when-closure-is-already-marked-as-move, r=oli-obk
Do not suggest adding `move` to closure when `move` is already used

Fixes #101227
2022-09-01 21:37:21 +02:00
Oli Scherer
1fc9ef1edd tracing::instrument cleanup 2022-09-01 14:54:27 +00:00
Oli Scherer
ee3c835018 Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
Oli Scherer
d3b22c7267 Directly use the instrument macro instead of its full path 2022-09-01 14:53:46 +00:00
Takayuki Maeda
78e9bea598 do not suggest adding move to closure when move is already used 2022-09-01 23:50:51 +09:00
bors
a0d07093f8 Auto merge of #100812 - Nilstrieb:revert-let-chains-nightly, r=Mark-Simulacrum
Revert let_chains stabilization

This is the revert against master, the beta revert was already done in #100538.

Bumps the stage0 compiler which already has it reverted.
2022-08-30 05:48:22 +00:00
Matthias Krüger
7b84298f1b
Rollup merge of #101146 - jackh726:borrowck-logging, r=compiler-errors
Various changes to logging of borrowck-related code

Cleanups found when doing other changes

r? `@compiler-errors`
2022-08-29 21:12:59 +02:00
Nilstrieb
d1ef8180f9 Revert let_chains stabilization
This reverts commit 3266460749.

This is the revert against master, the beta revert was already done in #100538.
2022-08-29 19:34:11 +02:00
Jack Huey
8033c3c27d Various changes to logging of borrowck-related code 2022-08-29 10:59:21 -04:00
Matthias Krüger
d182081de1
Rollup merge of #99027 - tmiasko:basic-blocks, r=oli-obk
Replace `Body::basic_blocks()` with field access

Since the refactoring in #98930, it is possible to borrow the basic blocks
independently from other parts of MIR by accessing the `basic_blocks` field
directly.

Replace unnecessary `Body::basic_blocks()` method with a direct field access,
which has an additional benefit of borrowing the basic blocks only.
2022-08-29 06:34:43 +02:00
Matthias Krüger
c5770219f2
Rollup merge of #101002 - estebank:hashmap-idx, r=davidtwco
Provide structured suggestion for `hashmap[idx] = val`
2022-08-28 09:35:18 +02:00
Tomasz Miąsko
b48870b451 Replace Body::basic_blocks() with field access 2022-08-26 14:27:08 +02:00
AndyJado
622217da59 diag-mig 2022-08-26 10:32:59 +08:00
Esteban Küber
752902957b Provide structured suggestion for hashmap[idx] = val 2022-08-25 08:44:36 -07:00
Matthias Krüger
75b1b69171
Rollup merge of #100940 - TaKO8Ki:do-not-suggest-adding-bound-to-opaque-type, r=fee1-dead
Do not suggest adding a bound to a opaque type

fixes #100442
2022-08-24 18:20:20 +02:00
Matthias Krüger
95135bed61
Rollup merge of #100906 - ChayimFriedman2:map-index-mut, r=davidtwco
Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing

The error can be quite confusing to newcomers.

Fixes #100873.

I'm not so sure about the message, open to wording suggestions.
2022-08-24 18:20:13 +02:00
Matthias Krüger
1c0f60f904
Rollup merge of #100901 - TaKO8Ki:make-some-methods-private, r=sanxiyn
Make some methods private
2022-08-24 18:20:12 +02:00
Takayuki Maeda
3855e039a2 do not suggest adding a bound to a opaque type 2022-08-24 11:34:14 +09:00
Chayim Refael Friedman
b0255a1849 Suggest alternatives when trying to mutate a HashMap/BTreeMap via indexing
The error can be quite confusing to newcomers.
2022-08-23 15:15:34 +00:00
SparrowLii
5d9e4d07fc get rid of RefCell in TransitiveRelation 2022-08-22 18:08:46 +08:00
Takayuki Maeda
000dc80221 make some methods private 2022-08-22 18:12:18 +09:00
Matthias Krüger
9cf3bacfb2
Rollup merge of #100761 - lcnr:mir-typeck-cleanup, r=compiler-errors
some general mir typeck cleanup

this pr contains the parts of #95763 which already work correctly.

the remaining commits of that PR have some issues which are more complex to fix.

r? types
2022-08-21 16:54:04 +02:00
Xiretza
7f3a6fd7f6 Replace #[lint/warning/error] with #[diag] 2022-08-21 09:17:43 +02:00
Matthias Krüger
3cca14093a
Rollup merge of #100186 - compiler-errors:or-as_mut, r=fee1-dead
Mention `as_mut` alongside `as_ref` in borrowck error message

Kinda fixes #99426 but I guess that really might be better staying open to see if we could make it suggest `as_mut` in a structured way. Not sure how to change borrowck to know that info tho.
2022-08-20 07:08:57 +02:00
lcnr
56b5ec83f2 move type_check_internal into type_check 2022-08-19 16:41:48 +02:00
lcnr
7d2083c58e small mir typeck cleanup 2022-08-19 16:38:26 +02:00
Michael Goulet
e37565d2db Make as_ref suggestion a note 2022-08-16 03:02:04 +00:00
Yan Chen
15713e1717 Fix #95079 by adding help and suggestion for missing move in nested closure 2022-08-15 11:20:32 -07:00
Michael Goulet
84ba2289fd Suggest as_ref or as_mut 2022-08-14 20:23:52 +00:00
Michael Goulet
75dfe55a5d TypeError can be Copy 2022-08-14 19:58:46 +00:00
Mark Rousskov
154a09dd91 Adjust cfgs 2022-08-12 16:28:15 -04:00
Michael Goulet
a2b6744af0 Use &mut Diagnostic instead of &mut DiagnosticBuilder unless needed 2022-08-10 03:45:42 +00:00
lcnr
f25cb83296 don't normalize wf predicates
this allows us to soundly use unnormalized projections for wf
2022-08-09 12:54:32 +02:00
Matthias Krüger
01ccde5ec8
Rollup merge of #100095 - jackh726:early-binder, r=lcnr
More EarlyBinder cleanups

Each commit is independent

r? types
2022-08-04 22:25:04 +02:00
Matthias Krüger
6b938c8491
Rollup merge of #100093 - wcampbell0x2a:unused-parens-for-match-arms, r=petrochenkov
Enable unused_parens for match arms

Fixes: https://github.com/rust-lang/rust/issues/92751

Currently I can't get the `stderr` to work with `./x.py test`, but this should fix the issue. Help would be appreciated!
2022-08-04 22:25:02 +02:00
wcampbell
8dd44f1af4 Enable unused_parens for match arms 2022-08-04 07:16:39 -04:00
bors
caee496150 Auto merge of #100120 - matthiaskrgr:rollup-g6ycykq, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #98771 (Add support for link-flavor rust-lld for iOS, tvOS and watchOS)
 - #98835 (relate `closure_substs.parent_substs()` to parent fn in NLL)
 - #99746 (Use `TraitEngine` in more places that don't specifically need `FulfillmentContext::new_in_snapshot`)
 - #99786 (Recover from C++ style `enum struct`)
 - #99795 (Delay a bug when failed to normalize trait ref during specialization)
 - #100029 (Prevent ICE for `doc_alias` on match arm, statement, expression)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-08-04 03:52:29 +00:00
klensy
0548e8ed06 fix trailing whitespace in error message 2022-08-03 15:46:34 +03:00
Ali MJ Al-Nasrawy
78adc0139c cosmetic changes 2022-08-03 12:46:04 +03:00
Jack Huey
e21624dc80 Add bound_predicates_of and bound_explicit_predicates_of 2022-08-02 22:44:08 -04:00
Ali MJ Al-Nasrawy
f74d06c2d1 NLL: relate closure to parent fn 2022-08-02 15:20:57 +03:00
Obei Sideg
86dd457e6a Improve cannot move out of error message 2022-07-31 21:06:43 +03:00
Dylan DPC
403c1b3802
Rollup merge of #99186 - camsteffen:closure-localdefid, r=cjgillot
Use LocalDefId for closures more
2022-07-31 17:36:40 +05:30
Cameron Steffen
cf2433a74f Use LocalDefId for closures more 2022-07-30 15:59:17 -05:00
Miguel Guarniz
0c609a4c1f Change enclosing_body_owner to return LocalDefId
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:26:10 -04:00
Miguel Guarniz
25bdc8965e Change maybe_body_owned_by to take local def id
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:25:58 -04:00
bors
7dfdd64433 Auto merge of #99667 - ouz-a:some_branch, r=oli-obk
Optimize `UnDerefer`

Addresses the performance [issues](https://github.com/rust-lang/rust/pull/98145#issuecomment-1183548597) faced here.

r? `@oli-obk`
2022-07-29 07:11:50 +00:00
bors
ada80a13b9 Auto merge of #99725 - lcnr:dedup-region_bound_pairs, r=compiler-errors
use `FxIndexSet` for `region_bound_pairs`

should help with #99217 and might generally be a perf improvement.

r? types
2022-07-27 22:02:14 +00:00
Guillaume Gomez
c37ee1a7e0
Rollup merge of #99728 - cjgillot:ast-lifetimes-anon-clean, r=petrochenkov
Clean up HIR-based lifetime resolution

Based on https://github.com/rust-lang/rust/pull/97313.

Fixes #98932.

r? `@petrochenkov`
2022-07-27 17:55:07 +02:00
Yuki Okushi
3b780fc279
Rollup merge of #99079 - compiler-errors:issue-99073, r=oli-obk
Check that RPITs constrained by a recursive call in a closure are compatible

Fixes #99073

Adapts a similar visitor pattern to `find_opaque_ty_constraints` (that we use to check TAITs), but with some changes:
0. Only walk the "OnlyBody" children, instead of all items in the RPIT's defining scope
1. Only walk through the body's children if we found a constraining usage
2. Don't actually do any inference, just do a comparison and error if they're mismatched

----

r? `@oli-obk` -- you know all this impl-trait stuff best... is this the right approach? I can explain the underlying issue better if you'd like, in case that might reveal a better solution. Not sure if it's possible to gather up the closure's defining usages of the RPIT while borrowck'ing the outer function, that might be a better place to put this check...
2022-07-27 19:05:32 +09:00