Commit Graph

118 Commits

Author SHA1 Message Date
Dylan DPC 4183a99dd8 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 cf6b70dd65 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 7bf03be5e0 move else block into the Local struct 2022-07-11 23:20:37 +02:00
Ding Xiang Fei a82c5aa797 lower let-else in MIR instead 2022-07-11 23:20:36 +02:00
Cameron Steffen 898b473f65 Factor out hir::Node::Binding 2022-07-01 10:04:19 -05:00
Camille GILLOT 828a5a7990 Make ExprKind::Closure a struct variant. 2022-06-12 00:16:27 +02:00
Jack Huey 82a42a8c73 Fully stabilize NLL 2022-06-03 17:16:41 -04:00
Kelsey Gilbert 5998f1db25 [save-analysis] Reference the variant not enum at struct-literal construction.
Closes #96985
2022-05-12 16:34:02 -07:00
Vadim Petrochenkov 7c5a9e16ed 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 a39b7ef53e Store all generic bounds as where predicates. 2022-04-30 13:55:13 +02:00
Camille GILLOT 4fc8a45d8f Inline WhereClause into Generics. 2022-04-30 13:51:49 +02:00
Camille GILLOT 62f024f264 Drop vis in ImplItem. 2022-04-23 09:57:00 +02:00
Camille GILLOT 41b8840306 Drop vis in FieldDef. 2022-04-23 09:56:15 +02:00
Camille GILLOT dc4e6f481d Stop pretty-printing HIR visibility. 2022-04-23 09:55:25 +02:00
Camille GILLOT 5f11be83b5 Stop visiting visibility. 2022-04-23 09:53:45 +02:00
Fausto 945218f2e7 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 5ca2327217 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 4b2b8734c7 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 bc84fad964 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 c4fb3e39fa 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 1be1cee840 Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
Vadim Petrochenkov 2b788835eb 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 b1063490e9 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 3ceec03f0f Adopt let else in more places 2022-02-19 17:27:43 +01:00
Mark Rousskov bbe17f6688 Move ty::print methods to Drop-based scope guards 2022-02-16 17:24:23 -05:00
Ellen ae8c5d2570 change to a struct variant 2022-02-12 11:23:53 +00:00
Frank Steffahn 0f70ea16e8 Remove further usage of &hir::Map 2022-02-10 13:04:59 +01:00
est31 0f0954d5d0 More let_else adoptions 2022-02-02 17:11:01 +01:00
lcnr 2b315440d3 add a rustc::query_stability lint 2022-02-01 10:15:59 +01:00
Matthias Krüger 5e0b23665e 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 9a8a27496e Remove a span from hir::ExprKind::MethodCall 2022-01-21 07:48:10 -06:00
Guillaume Gomez 4270dec766 Correctly handle starts in block doc comments 2022-01-19 11:18:17 +01:00
Cameron Steffen d09a12259a Replace NestedVisitorMap with NestedFilter 2022-01-16 16:02:36 -06:00
Matthew Jasper cdf8ecb370 Add trait_item_def_id to AssocItem
This allows avoiding some lookups by name
2022-01-07 12:28:12 -08:00
lcnr dee4440970 review 2022-01-03 11:59:01 +01:00
lcnr 089da0cfa4 implement generic_arg_infer for array lengths 2021-12-23 10:09:35 +01:00
bors b5f08995cd 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 68eee8e58e 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 d8c26eeb60 Remove unnecessary sigils around Ident::as_str() calls. 2021-12-15 17:32:42 +11:00
Nicholas Nethercote 41c6543547 Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
Matthias Krüger acb86cb2f7 fix clippy::single_char_pattern perf findings 2021-12-14 12:40:28 +01:00
Esteban Kuber b8c21c95dc 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 f0ff4c2d83 Give inline const separate DefKind 2021-11-07 03:59:06 +00:00
pierwill c8f9e9db94 Improve terminology around "after typeck" 2021-11-06 20:59:38 -05:00
Matthias Krüger a3af550711 clippy::perf fixes 2021-11-04 21:07:56 +01:00
Mark Rousskov ed9ff1b8fc Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
lcnr a55adf3606 allow potential_query_instability everywhere 2021-10-15 10:58:18 +02:00
bors e5f92e6edb 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 5997ba0be5 Move rustc_middle::middle::cstore to rustc_session. 2021-10-03 16:08:51 +02:00
Bruce Mitchener 600e8704c3 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