Commit graph

312 commits

Author SHA1 Message Date
Matthias Krüger
443ed7c620
Rollup merge of #91643 - Amanieu:r9x18, r=joshtriplett
asm: Allow using r9 (ARM) and x18 (AArch64) if they are not reserved by the current target

This supersedes https://github.com/rust-lang/rust/pull/88879.

cc `@Skirmisher`

r? `@joshtriplett`
2021-12-11 23:31:49 +01:00
Amanieu d'Antras
8716f2780e asm: Allow using r9 (ARM) and x18 (AArch64) if they are not reserved by
the current target.
2021-12-10 00:51:39 +00:00
Camille GILLOT
8576ab45e4 Store impl_trait_fn inside OpaqueTyOrigin. 2021-12-07 21:30:45 +01:00
Camille GILLOT
72b6f7049c Use collect_in_band_defs for async lifetime captures. 2021-12-07 21:21:57 +01:00
Camille GILLOT
6e7ec0c5b4 Simplify collect_in_band_defs. 2021-12-07 21:21:57 +01:00
Mara Bos
1acb44f03c Use IntoIterator for array impl everywhere. 2021-12-04 19:40:33 +01:00
cynecx
686ace3b41 add unwind_asm feature gate for may_unwind option 2021-12-03 23:51:49 +01:00
bors
532d2b14c0 Auto merge of #90737 - eholk:intofuture, r=tmandry
Reintroduce `into_future` in `.await` desugaring

This is a reintroduction of the remaining parts from https://github.com/rust-lang/rust/pull/65244 that have not been relanded yet.

This isn't quite ready to merge yet. The last attempt was reverting due to performance regressions, so we need to make sure this does not introduce those issues again.

Issues #67644, #67982

/cc `@yoshuawuyts`
2021-12-03 19:29:21 +00:00
Matthias Krüger
a5ee722f1e
Rollup merge of #91273 - Badel2:ice-index-str, r=estebank
Fix ICE #91268 by checking that the snippet ends with a `)`

Fix #91268

Previously it was assumed that the last character of `snippet` will be a `)`, so using `snippet.len() - 1` as an index should be safe. However as we see in the test, it is possible to enter that branch without a closing `)`, and it will trigger the panic if the last character happens to be multibyte.

The fix is to ensure that the snippet ends with `)`, and skip the suggestion otherwise.
2021-12-03 06:24:14 +01:00
Camille GILLOT
aa2450f41b Merge Implicit and ImplicitMissing. 2021-11-30 22:56:47 +01:00
Camille GILLOT
b621133200 Simplify lowering. 2021-11-30 22:55:07 +01:00
Camille GILLOT
5ea7ea8a57 Lint elided lifetimes in path during lifetime resolution. 2021-11-30 22:55:07 +01:00
Badel2
0da3a0f56e Fix ICE #91268 by checking that the snippet ends with a ) 2021-11-26 23:57:21 +01:00
bors
9adfd9db78 Auto merge of #85102 - estebank:point-at-assignment, r=oli-obk
Diagnostic tweaks

* On type mismatch caused by assignment, point at the source of the expectation
* Hide redundant errors
* Suggest `while let` when `let` is missing in some cases
2021-11-26 03:57:55 +00:00
Esteban Küber
37a11a96a1 On type mismatch caused by assignment, point at assignee
* Do not emit unnecessary E0308 after E0070
* Show fewer errors on `while let` missing `let`
* Hide redundant E0308 on `while let` missing `let`
* Point at binding definition when possible on invalid assignment
* do not point at closure twice
* do not suggest `if let` for literals in lhs
* account for parameter types
2021-11-25 18:04:33 +00:00
Camille GILLOT
ae126ad282 Do not visit attributes in ItemLowerer.
By default, AST visitors visit expressions that appear in key-value attributes.
Those expressions should not be lowered to HIR, as they do not correspond to actually compiled code.

Since an attribute cannot produce meaningful HIR, just skip them altogether.
2021-11-23 22:06:22 +01:00
Eric Holk
ca2057cedf Fix comments 2021-11-22 14:57:33 -08:00
Eric Holk
dfa0db5961 Reintroduce into_future in .await desugaring
This is a reintroduction of the remaining parts from
https://github.com/rust-lang/rust/pull/65244 that have not been relanded
yet.

Issues GH-67644, GH-67982
2021-11-22 14:57:27 -08:00
Cameron Steffen
9c83f8c4d1 Simplify for loop desugar 2021-11-21 08:15:21 -06:00
Yuki Okushi
1576a7cc81
Rollup merge of #90990 - nnethercote:arenas-cleanup, r=oli-obk
Arenas cleanup

I was looking closely at the arenas code and here are some small improvement to readability.
2021-11-19 13:06:38 +09:00
Vadim Petrochenkov
91e02177a1 rustc: Remove #[rustc_synthetic]
This function parameter attribute was introduced in https://github.com/rust-lang/rust/pull/44866 as an intermediate step in implementing `impl Trait`, it's not necessary or used anywhere by itself.
2021-11-18 14:32:29 +08:00
Nicholas Nethercote
552073701f Remove unnecessary lifetime argument from arena macros.
Because it's always `'tcx`. In fact, some of them use a mixture of
passed-in `$tcx` and hard-coded `'tcx`, so no other lifetime would even
work.

This makes the code easier to read.
2021-11-17 09:38:30 +11:00
asquared31415
b233d3b5da Add support for specifying multiple clobber_abi in asm!
Allow multiple clobber_abi in asm

Update docs
Fix aarch64 test
Combine abis
Emit duplicate ABI error, empty ABI list error
multiple clobber_abi
2021-11-10 01:06:03 -05:00
Vadim Petrochenkov
2834f57c45 ast: Fix naming conventions in AST structures
TraitKind -> Trait
TyAliasKind -> TyAlias
ImplKind -> Impl
FnKind -> Fn

All `*Kind`s in AST are supposed to be enums.

Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order.

Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-07 21:38:17 +08:00
Amanieu d'Antras
eb32c00216 Add features gates for experimental asm features 2021-11-07 01:23:53 +00:00
bors
88a5a984fe Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnr
Revert "Add rustc lint, warning when iterating over hashmaps"

Fixes perf regressions introduced in https://github.com/rust-lang/rust/pull/90235 by temporarily reverting the relevant PR.
2021-10-29 04:55:51 +00:00
Mark Rousskov
3215eeb99f
Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
bors
c4ff03f689 Auto merge of #90145 - cjgillot:sorted-map, r=michaelwoerister
Use SortedMap in HIR.

Closes https://github.com/rust-lang/rust/issues/89788
r? `@ghost`
2021-10-28 13:04:40 +00:00
Yuki Okushi
630df7c54a
Remove unnecessary check for registers
`is_clobber()` already checks if `reg` is a register and the both
values should be the same.
2021-10-26 11:02:51 +09:00
Yuki Okushi
f5cbb9b9e6
Fix some typos 2021-10-26 11:02:47 +09:00
Matthias Krüger
87822b27ee
Rollup merge of #89558 - lcnr:query-stable-lint, r=estebank
Add rustc lint, warning when iterating over hashmaps

r? rust-lang/wg-incr-comp
2021-10-24 15:48:42 +02:00
Yuki Okushi
91fb223f59
Rollup merge of #89895 - camsteffen:for-loop-head-span, r=davidtwco
Don't mark for loop iter expression as desugared

We typically don't mark spans of lowered things as desugared. This helps Clippy rightly discern when code is (not) from expansion. This was discovered by ``@flip1995`` at https://github.com/rust-lang/rust-clippy/pull/7789#issuecomment-939289501.
2021-10-22 19:42:45 +09:00
Camille GILLOT
6f6fa8b954 Use SortedMap in HIR. 2021-10-21 23:08:57 +02:00
bors
bd41e09da3 Auto merge of #89124 - cjgillot:owner-info, r=michaelwoerister
Index and hash HIR as part of lowering

Part of https://github.com/rust-lang/rust/pull/88186
~Based on https://github.com/rust-lang/rust/pull/88880 (see merge commit).~

Once HIR is lowered, it is later indexed by the `index_hir` query and hashed for `crate_hash`. This PR moves those post-processing steps to lowering itself. As a side objective, the HIR crate data structure is refactored as an `IndexVec<LocalDefId, Option<OwnerInfo<'hir>>>` where `OwnerInfo` stores all the relevant information for an HIR owner.

r? `@michaelwoerister`
cc `@petrochenkov`
2021-10-18 19:53:05 +00:00
Vadim Petrochenkov
a6808335d4 rustc_span: Ident::invalid -> Ident::empty
The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s.
2021-10-17 23:20:30 +03:00
Cameron Steffen
a697aa63d6 Use more lowered spans in for loop 2021-10-15 08:04:51 -05:00
Cameron Steffen
bd1a1e4f0d Don't mark for loop head span with desugaring 2021-10-15 08:04:50 -05:00
lcnr
00e5abe9b6 allow potential_query_instability everywhere 2021-10-15 10:58:18 +02:00
Camille GILLOT
c5628a5e65 Use invalid local id for zeroth node parent. 2021-10-12 08:41:53 +02:00
Camille GILLOT
12b39e5912 Make naming more explicit. 2021-10-11 22:36:37 +02:00
Camille GILLOT
0431fdb113 Compute full HIR hash during lowering. 2021-10-10 00:05:49 +02:00
Camille GILLOT
41e80b85cf Directly use AttributeMap inside OwnerInfo. 2021-10-10 00:05:35 +02:00
Camille GILLOT
1c7f85f17c Perform indexing during lowering.
Do not access DefId<->HirId maps before they are initialized.
2021-10-09 23:47:59 +02:00
Camille GILLOT
ed3c8e86cb Hash during lowering. 2021-10-09 19:44:55 +02:00
Camille GILLOT
457de08487 Forbid hashing HIR outside of indexing. 2021-10-09 18:38:28 +02:00
Camille GILLOT
cd1ace488f Use an IndexVec for bodies. 2021-10-09 14:01:09 +02:00
Camille GILLOT
48a339ddbb Store lowering outputs per owner. 2021-10-09 11:56:29 +02:00
Matthias Krüger
5ebb6a8fd9
Rollup merge of #89641 - asquared31415:asm-feature-attr-regs, r=oli-obk
make #[target_feature] work with `asm` register classes

Fixes #89289
2021-10-09 11:56:00 +02:00
Matthias Krüger
e6f77a1787 clippy::complexity fixes 2021-10-08 20:07:44 +02:00
asquared31415
271da7d8bc make #[target_feature] work with asm register classes 2021-10-07 15:42:18 -04:00