Commit Graph

393 Commits

Author SHA1 Message Date
Dylan DPC
270a41c33e
Rollup merge of #94960 - codehorseman:master, r=oli-obk
Fix many spelling mistakes

Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-17 22:55:05 +01:00
mark
bb8d4307eb rustc_error: make ErrorReported impossible to construct
There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.
2022-03-16 10:35:24 -05:00
codehorseman
01dbfb3eb2 resolve the conflict in compiler/rustc_session/src/parse.rs
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16 20:12:30 +08:00
bors
95561b336c Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuber
More robust fallback for `use` suggestion

Our old way to suggest where to add `use`s would first look for pre-existing `use`s in the relevant crate/module, and if there are *no* uses, it would fallback on trying to use another item as the basis for the suggestion.

But this was fragile, as illustrated in issue #87613

This PR instead identifies span of the first token after any inner attributes, and uses *that* as the fallback for the `use` suggestion.

Fix #87613
2022-03-15 03:56:33 +00:00
Camille GILLOT
c8c691ff88 Update comments. 2022-03-13 23:13:58 +01:00
Camille GILLOT
d3b7ea6c9e Identify anonymous lifetimes by their DefId in HIR. 2022-03-12 14:18:56 +01:00
Takayuki Maeda
51a53bf4df remove unnecessary .. patterns 2022-03-07 02:18:36 +09:00
Jack Huey
c920eb88b2 Fallback to other where clause if preferred is missing 2022-03-05 13:15:00 -05:00
Jack Huey
c20b4f5584 Change syntax for TyAlias where clauses 2022-03-05 13:13:45 -05:00
Felix S. Klock II
d37da1e332 Adjusted diagnostic output so that if there is no use in a item sequence,
then we just suggest the first legal position where you could inject a use.

To do this, I added `inject_use_span` field to `ModSpans`, and populate it in
parser (it is the span of the first token found after inner attributes, if any).
Then I rewrote the use-suggestion code to utilize it, and threw out some stuff
that is now unnecessary with this in place. (I think the result is easier to
understand.)

Then I added a test of issue 87613.
2022-03-03 18:58:37 -05:00
Felix S. Klock II
b82795244e Associate multiple with a crate too. 2022-03-03 18:45:25 -05:00
Felix S. Klock II
e9035f7bef refactor: prepare to associate multiple spans with a module. 2022-03-03 14:38:50 -05:00
cuishuang
eb2b9441e7 compiler: fix some typos 2022-03-01 20:02:47 +08:00
bors
d981633ed6 Auto merge of #94290 - Mark-Simulacrum:bump-bootstrap, r=pietroalbini
Bump bootstrap to 1.60

This bumps the bootstrap compiler to 1.60 and cleans up cfgs and Span's rustc_pass_by_value (enabled by the bootstrap bump).
2022-02-25 18:34:02 +00:00
Mark Rousskov
22c3a71de1 Switch bootstrap cfgs 2022-02-25 08:00:52 -05:00
Michael Goulet
bb548a918a Remove in-band lifetimes 2022-02-24 18:50:33 -08: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
8ebec97e09 Auto merge of #93438 - spastorino:node_id_to_hir_id_refactor, r=oli-obk
Node id to hir id refactor

Related to #89278

r? `@oli-obk`
2022-02-24 01:26:57 +00:00
Santiago Pastorino
d82a7bc1b5
local_id is always != 0 at this point 2022-02-22 09:37:47 -03:00
Amanieu d'Antras
fc41d4bf35 Take CodegenFnAttrs into account when validating asm! register operands
Checking of asm! register operands now properly takes function
attributes such as #[target_feature] and #[instruction_set] into
account.
2022-02-21 18:28:22 +00:00
Amanieu d'Antras
1ceb104851 On ARM, use relocation_model to detect whether r9 should be reserved
The previous approach of checking for the reserve-r9 target feature
didn't actually work because LLVM only sets this feature very late when
initializing the per-function subtarget.
2022-02-21 18:28:22 +00:00
Santiago Pastorino
cbfa7cebee
Move trait_map to Lowering Context 2022-02-20 11:52:57 -03:00
Santiago Pastorino
7e2dd672da
Move local_id_to_def_id to Lowering Context 2022-02-20 11:47:49 -03:00
Santiago Pastorino
a8d24742f8
Avoid call to lower_node_id when not needed 2022-02-20 10:17:29 -03:00
Camille GILLOT
04d5f41c97
Make node_id_to_hir_id owner-local. 2022-02-20 10:17:27 -03:00
Matthias Krüger
f2d6770f77
Rollup merge of #94146 - est31:let_else, r=cjgillot
Adopt let else in more places

Continuation of #89933, #91018, #91481, #93046, #93590, #94011.

I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This is the biggest of these PRs and handles the changes outside of rustdoc, rustc_typeck, rustc_const_eval, rustc_trait_selection, which were handled in PRs #94139, #94142, #94143, #94144.
2022-02-20 00:37:34 +01:00
est31
2ef8af6619 Adopt let else in more places 2022-02-19 17:27:43 +01:00
Matthias Krüger
cb35370557
Rollup merge of #93877 - Amanieu:asm_fixes, r=nagisa
asm: Allow the use of r8-r14 as clobbers on Thumb1

Previously these were entirely disallowed, except for r11 which was allowed by accident.

cc `@hudson-ayers`
2022-02-18 23:23:08 +01:00
Matthias Krüger
5c08c39121
Rollup merge of #92806 - compiler-errors:better-impl-trait-deny, r=estebank
Add more information to `impl Trait` error

Fixes #92458

Let me know if I went overboard here, or if the suggestions could use some refinement.

r? `@estebank`
Feel free to reassign to someone else
2022-02-18 23:23:04 +01:00
Amanieu d'Antras
11250b8661 asm: Allow the use of r8-r14 as clobbers on Thumb1
Previously these were entirely disallowed, except for r11 which was
allowed by accident.
2022-02-18 20:26:40 +00:00
Michael Goulet
207fb5f070 fix impl trait message, bless tests 2022-02-17 19:18:42 -08:00
Michael Goulet
f04f732503 Add more information to impl Trait deny error 2022-02-17 18:45:53 -08:00
Oli Scherer
86d17b98f2 Revert "Auto merge of #91403 - cjgillot:inherit-async, r=oli-obk"
This reverts commit 3cfa4def7c, reversing
changes made to 5d8767cb22.
2022-02-17 16:00:04 +00:00
bors
3cfa4def7c Auto merge of #91403 - cjgillot:inherit-async, r=oli-obk
Inherit lifetimes for async fn instead of duplicating them.

The current desugaring of `async fn foo<'a>(&usize) -> &u8` is equivalent to
```rust
fn foo<'a, '0>(&'0 usize) -> foo<'static, 'static>::Opaque<'a, '0, '_>;
type foo<'_a, '_0>::Opaque<'a, '0, '1> = impl Future<Output = &'1 u8>;
```
following the RPIT model.

Duplicating all the inherited lifetime parameters and setting the inherited version to `'static` makes lowering more complex and causes issues like #61949. This PR removes the duplication of inherited lifetimes to directly use
```rust
fn foo<'a, '0>(&'0 usize) -> foo<'a, '0>::Opaque<'_>;
type foo<'a, '0>::Opaque<'1> = impl Future<Output = &'1 u8>;
```
following the TAIT model.

Fixes https://github.com/rust-lang/rust/issues/61949
2022-02-12 21:42:10 +00:00
Camille GILLOT
a4da6308b7 Inherit lifetimes for async fn instead of duplicating them. 2022-02-12 01:26:11 +01:00
Amanieu d'Antras
20e6c1d013 Fix incorrect register conflict detection in asm!
This would previously incorrectly reject two subregisters that were
distinct but part of the same larger register, for example `al` and
`ah`.
2022-02-10 18:04:09 +00:00
Yuki Okushi
e5ac08779b
Rollup merge of #93746 - cjgillot:nodefii, r=nikomatsakis
Remove defaultness from ImplItem.

This information is not really used anywhere, except HIR pretty-printing. This makes ImplItem and TraitItem more similar.
2022-02-09 14:12:22 +09:00
Camille GILLOT
710662c8ac Remove defaultness from ImplItem. 2022-02-03 18:56:08 +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
Camille GILLOT
a0bcce4884
Store def_id_to_hir_id as variant in hir_owner.
If hir_owner is Owner(_), the LocalDefId is pointing to an owner, so the ItemLocalId is 0.
If the HIR node does not exist, we store Phantom.
Otherwise, we store the HirId associated to the LocalDefId.
2022-01-27 10:46:40 -03:00
Santiago Pastorino
384189c3d9
Filter out local_id == 0, those are already considered on the call site 2022-01-26 12:25:31 -03:00
Camille GILLOT
80132c3ce4
Store hir_id_to_def_id in OwnerInfo. 2022-01-25 15:05:19 -03:00
Matthias Krüger
a15252817a
Rollup merge of #93103 - estebank:await-span, r=nagisa
Tweak `expr.await` desugaring `Span`

Fix #93074
2022-01-23 01:09:43 +01:00
Cameron Steffen
b11733534d Remove a span from hir::ExprKind::MethodCall 2022-01-21 07:48:10 -06:00
Esteban Kuber
7356e28abb Tweak expr.await desugaring Span
Fix #93074
2022-01-20 04:09:46 +00:00
Caio
5f74ef4fb1 Formally implement let chains 2022-01-18 19:38:17 -03:00
bors
9ad5d82f82 Auto merge of #92731 - bjorn3:asm_support_changes, r=nagisa
Avoid unnecessary monomorphization of inline asm related functions

This should reduce build time for codegen backends by avoiding duplicated monomorphization of certain inline asm related functions for each passed in closure type.
2022-01-18 14:32:52 +00:00
bors
7bc7be860f Auto merge of #87648 - JulianKnodt:const_eq_constrain, r=oli-obk
allow eq constraints on associated constants

Updates #70256

(cc `@varkor,` `@Centril)`
2022-01-18 09:58:39 +00:00
kadmin
67f56671d0 Use Term in ProjectionPredicate
ProjectionPredicate should be able to handle both associated types and consts so this adds the
first step of that. It mainly just pipes types all the way down, not entirely sure how to handle
consts, but hopefully that'll come with time.
2022-01-17 17:44:56 +00:00