Commit Graph

122 Commits

Author SHA1 Message Date
Dylan DPC e5a86d7358 Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot
Implement `for<>` lifetime binder for closures

This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362)) and allows code like the following:

```rust
let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) };
//       ^^^^^^^^^^^--- new!
```

cc ``@Aaron1011`` ``@cjgillot``
2022-07-14 14:14:21 +05:30
Maybe Waffle df4fee9841 Add an indirection for closures in hir::ExprKind
This helps bring `hir::Expr` size down, `Closure` was the biggest
variant, especially after `for<>` additions.
2022-07-12 21:00:13 +04:00
Ding Xiang Fei 1cd30e7b32 move else block into the Local struct 2022-07-11 23:20:37 +02:00
Ding Xiang Fei 6c529ded86 lower let-else in MIR instead 2022-07-11 23:20:36 +02:00
Cameron Steffen ec82bc1996 Factor out hir::Node::Binding 2022-07-01 10:04:19 -05:00
Camille GILLOT 3039cfeb6a Make ExprKind::Closure a struct variant. 2022-06-12 00:16:27 +02:00
Jack Huey 410dcc9674 Fully stabilize NLL 2022-06-03 17:16:41 -04:00
Kelsey Gilbert 5fde765df0 [save-analysis] Reference the variant not enum at struct-literal construction.
Closes #96985
2022-05-12 16:34:02 -07:00
Vadim Petrochenkov 5b5964f569 rustc: Panic by default in DefIdTree::parent
Only crate root def-ids don't have a parent, and in majority of cases the argument of `DefIdTree::parent` cannot be a crate root.
So we now panic by default in `parent` and introduce a new non-panicing function `opt_parent` for cases where the argument can be a crate root.

Same applies to `local_parent`/`opt_local_parent`.
2022-05-02 01:56:50 +03:00
Camille GILLOT 94449e6101 Store all generic bounds as where predicates. 2022-04-30 13:55:13 +02:00
Camille GILLOT 05b29f9a92 Inline WhereClause into Generics. 2022-04-30 13:51:49 +02:00
Camille GILLOT a6e3124d2c Drop vis in ImplItem. 2022-04-23 09:57:00 +02:00
Camille GILLOT a62680d108 Drop vis in FieldDef. 2022-04-23 09:56:15 +02:00
Camille GILLOT 4e8046f67a Stop pretty-printing HIR visibility. 2022-04-23 09:55:25 +02:00
Camille GILLOT 10d10efb21 Stop visiting visibility. 2022-04-23 09:53:45 +02:00
Fausto 8c2353b6c1 remove find_use_placement
A more robust solution to finding where to place use suggestions was added.
The algorithm uses the AST to find the span for the suggestion so we pass this span
down to the HIR during lowering and use it.

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-03-31 17:20:03 -04:00
Dylan DPC 1b7d6dbd30 Rollup merge of #95497 - nyurik:compiler-spell-comments, r=compiler-errors
Spellchecking compiler comments

This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-31 04:57:28 +02:00
Yuri Astrakhan 5160f8f843 Spellchecking compiler comments
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30 15:14:15 -04:00
Camille GILLOT 21a554caf6 Remember mutability in DefKind::Static.
This allows to compute the `BodyOwnerKind` from `DefKind` only, and
removes a direct dependency of some MIR queries onto HIR.

As a side effect, it also simplifies metadata, since we don't need 4
flavours of `EntryKind::*Static` any more.
2022-03-29 18:50:52 +02:00
Nicholas Nethercote ca5525d564 Improve AdtDef interning.
This commit makes `AdtDef` use `Interned`. Much the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.
2022-03-11 13:31:24 +11:00
Mark Rousskov 22c3a71de1 Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
Vadim Petrochenkov 17b1afdbb2 resolve: Fix incorrect results of opt_def_kind query for some built-in macros
Previously it always returned `MacroKind::Bang` while some of those macros are actually attributes and derives
2022-02-24 22:54:36 +03:00
bors 523a1b1d38 Auto merge of #94062 - Mark-Simulacrum:drop-print-cfg, r=oli-obk
Move ty::print methods to Drop-based scope guards

Primary goal is reducing codegen of the TLS access for each closure, which shaves ~3 seconds of bootstrap time over rustc as a whole.
2022-02-20 18:12:59 +00:00
est31 2ef8af6619 Adopt let else in more places 2022-02-19 17:27:43 +01:00
Mark Rousskov 9763486034 Move ty::print methods to Drop-based scope guards 2022-02-16 17:24:23 -05:00
Ellen e81e09a24e change to a struct variant 2022-02-12 11:23:53 +00:00
Frank Steffahn 7eff2feb62 Remove further usage of &hir::Map 2022-02-10 13:04:59 +01:00
est31 670f5c6ef3 More let_else adoptions 2022-02-02 17:11:01 +01:00
lcnr a1a30f7548 add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
Matthias Krüger 6749f32c33 Rollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726
Improve terminology around "after typeck"

Closes #70258.
2022-01-31 06:58:26 +01:00
Cameron Steffen b11733534d Remove a span from hir::ExprKind::MethodCall 2022-01-21 07:48:10 -06:00
Guillaume Gomez 2938be612d Correctly handle starts in block doc comments 2022-01-19 11:18:17 +01:00
Cameron Steffen 45db716902 Replace NestedVisitorMap with NestedFilter 2022-01-16 16:02:36 -06:00
Matthew Jasper d7595853a2 Add trait_item_def_id to AssocItem
This allows avoiding some lookups by name
2022-01-07 12:28:12 -08:00
lcnr a02bf76c96 review 2022-01-03 11:59:01 +01:00
lcnr e3f5cc6c38 implement generic_arg_infer for array lengths 2021-12-23 10:09:35 +01:00
bors a41a6925ba Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obk
Remove `SymbolStr`

This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences.

Best reviewed one commit at a time.

r? `@oli-obk`
2021-12-19 09:31:37 +00:00
Matthias Krüger 9ca0bd518a Rollup merge of #91880 - matthiaskrgr:clippy_perf_dec, r=jyn514
fix clippy::single_char_pattern perf findings
2021-12-15 10:56:58 +01:00
Nicholas Nethercote b1c934ebb8 Remove unnecessary sigils around Ident::as_str() calls. 2021-12-15 17:32:42 +11:00
Nicholas Nethercote 056d48a2c9 Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
Matthias Krüger 97e844a032 fix clippy::single_char_pattern perf findings 2021-12-14 12:40:28 +01:00
Esteban Kuber f640438b40 Keep info on pre-desugaring expression for better "incorrect .await" suggestion
Keep the `HirId` of `.await`ed expressions so in the case of a `fn` call
on on a sync `fn`, we can suggest maybe turning it into an `async fn`.
2021-12-13 17:09:16 +00:00
Gary Guo 02c1774cd3 Give inline const separate DefKind 2021-11-07 03:59:06 +00:00
pierwill 521b1ee974 Improve terminology around "after typeck" 2021-11-06 20:59:38 -05:00
Matthias Krüger 28ef4169cc clippy::perf fixes 2021-11-04 21:07:56 +01:00
Mark Rousskov 3215eeb99f Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
lcnr 00e5abe9b6 allow potential_query_instability everywhere 2021-10-15 10:58:18 +02:00
bors 55111d656f Auto merge of #89266 - cjgillot:session-ich, r=michaelwoerister
Move ICH to rustc_query_system

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

The StableHashingContext does not need to be in rustc_middle.

This PR moves it to rustc_query_system. This will avoid a dependency between rustc_ast_lowering and rustc_middle in https://github.com/rust-lang/rust/pull/89124.
2021-10-05 09:45:11 +00:00
Camille GILLOT 8961616e60 Move rustc_middle::middle::cstore to rustc_session. 2021-10-03 16:08:51 +02:00
Bruce Mitchener 058a21d5cf Consistently use 'supertrait'.
A subset of places referred to 'super-trait', so this changes them
to all use 'supertrait'. This matches 'supertype' and some other
usages. An exception is 'auto-trait' which is consistently used
in that manner.
2021-10-02 08:05:44 +07:00