summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
AgeCommit message (Collapse)AuthorLines
2022-02-18Rollup merge of #93877 - Amanieu:asm_fixes, r=nagisaMatthias Krüger-5/+6
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-18Rollup merge of #92806 - compiler-errors:better-impl-trait-deny, r=estebankMatthias Krüger-90/+240
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-18asm: Allow the use of r8-r14 as clobbers on Thumb1Amanieu d'Antras-5/+6
Previously these were entirely disallowed, except for r11 which was allowed by accident.
2022-02-17fix impl trait message, bless testsMichael Goulet-4/+3
2022-02-17Add more information to `impl Trait` deny errorMichael Goulet-90/+241
2022-02-17Revert "Auto merge of #91403 - cjgillot:inherit-async, r=oli-obk"Oli Scherer-19/+50
This reverts commit 3cfa4def7c87d571bd46d92fed608edf8fad236e, reversing changes made to 5d8767cb229b097fedb1dd4bd9420d463c37774f.
2022-02-12Auto merge of #91403 - cjgillot:inherit-async, r=oli-obkbors-50/+19
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-12Inherit lifetimes for async fn instead of duplicating them.Camille GILLOT-50/+19
2022-02-10Fix incorrect register conflict detection in asm!Amanieu d'Antras-1/+3
This would previously incorrectly reject two subregisters that were distinct but part of the same larger register, for example `al` and `ah`.
2022-02-09Rollup merge of #93746 - cjgillot:nodefii, r=nikomatsakisYuki Okushi-4/+0
Remove defaultness from ImplItem. This information is not really used anywhere, except HIR pretty-printing. This makes ImplItem and TraitItem more similar.
2022-02-03Remove defaultness from ImplItem.Camille GILLOT-4/+0
2022-02-02More let_else adoptionsest31-3/+2
2022-02-01add a rustc::query_stability lintlcnr-0/+1
2022-01-27Store def_id_to_hir_id as variant in hir_owner.Camille GILLOT-24/+22
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-26Filter out local_id == 0, those are already considered on the call siteSantiago Pastorino-2/+6
2022-01-25Store hir_id_to_def_id in OwnerInfo.Camille GILLOT-1/+17
2022-01-23Rollup merge of #93103 - estebank:await-span, r=nagisaMatthias Krüger-10/+10
Tweak `expr.await` desugaring `Span` Fix #93074
2022-01-21Remove a span from hir::ExprKind::MethodCallCameron Steffen-6/+1
2022-01-20Tweak `expr.await` desugaring `Span`Esteban Kuber-10/+10
Fix #93074
2022-01-18Formally implement let chainsCaio-6/+12
2022-01-18Auto merge of #92731 - bjorn3:asm_support_changes, r=nagisabors-3/+3
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-18Auto merge of #87648 - JulianKnodt:const_eq_constrain, r=oli-obkbors-6/+10
allow eq constraints on associated constants Updates #70256 (cc `@varkor,` `@Centril)`
2022-01-17Use Term in ProjectionPredicatekadmin-6/+9
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-17Add termkadmin-6/+4
Instead of having a separate enum variant for types and consts have one but have either a const or type.
2022-01-17add eq constraints on associated constantskadmin-3/+6
2022-01-17Pass target_features set instead of has_feature closurebjorn3-2/+2
This avoids unnecessary monomorphizations in codegen backends
2022-01-17Use Symbol for target features in asm handlingbjorn3-3/+3
This saves a couple of Symbol::intern calls
2022-01-17Auto merge of #90986 - camsteffen:nested-filter, r=cjgillotbors-13/+1
Replace `NestedVisitorMap` with generic `NestedFilter` This is an attempt to make the `intravisit::Visitor` API simpler and "more const" with regard to nested visiting. With this change, `intravisit::Visitor` does not visit nested things by default, unless you specify `type NestedFilter = nested_filter::OnlyBodies` (or `All`). `nested_visit_map` returns `Self::Map` instead of `NestedVisitorMap<Self::Map>`. It panics by default (unreachable if `type NestedFilter` is omitted). One somewhat trixty thing here is that `nested_filter::{OnlyBodies, All}` live in `rustc_middle` so that they may have `type Map = map::Map` and so that `impl Visitor`s never need to specify `type Map` - it has a default of `Self::NestedFilter::Map`.
2022-01-17Auto merge of #92816 - tmiasko:rm-llvm-asm, r=Amanieubors-33/+0
Remove deprecated LLVM-style inline assembly The `llvm_asm!` was deprecated back in #87590 1.56.0, with intention to remove it once `asm!` was stabilized, which already happened in #91728 1.59.0. Now it is time to remove `llvm_asm!` to avoid continued maintenance cost. Closes #70173. Closes #92794. Closes #87612. Closes #82065. cc `@rust-lang/wg-inline-asm` r? `@Amanieu`
2022-01-16Replace NestedVisitorMap with NestedFilterCameron Steffen-13/+1
2022-01-15Auto merge of #92441 - cjgillot:resolve-trait-impl-item, r=matthewjasperbors-1/+3
Link impl items to corresponding trait items in late resolver. Hygienically linking trait impl items to declarations in the trait can be done directly by the late resolver. In fact, it is already done to diagnose unknown items. This PR uses this resolution work and stores the `DefId` of the trait item in the HIR. This avoids having to do this resolution manually later. r? `@matthewjasper` Related to #90639. The added `trait_item_id` field can be moved to `ImplItemRef` to be used directly by your PR.
2022-01-12Remove deprecated LLVM-style inline assemblyTomasz Miąsko-33/+0
2022-01-10Use pre-interned symbols in a couple of placesbjorn3-6/+8
2022-01-08Link impl items to corresponding trait items in late resolver.Camille GILLOT-1/+3
2022-01-04Rollup merge of #91907 - lcnr:const-arg-infer, r=BoxyUwUMatthias Krüger-2/+23
Allow `_` as the length of array types and repeat expressions r? `@BoxyUwU` cc `@varkor`
2022-01-01Move `PatKind::Lit` checking from ast_validation to ast loweringAaron Hill-3/+34
Fixes #92074 This allows us to insert an `ExprKind::Err` when an invalid expression is used in a literal pattern, preventing later stages of compilation from seeing an unexpected literal pattern.
2021-12-27Tighten span when suggesting lifetime on pathMichael Goulet-1/+3
2021-12-23implement `generic_arg_infer` for array lengthslcnr-2/+23
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-1/+1
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-18Rollup merge of #89090 - cjgillot:bare-dyn, r=jackh726Matthias Krüger-45/+3
Lint bare traits in AstConv. Removing the lint from lowering allows to: - make lowering querification easier; - have the lint implementation in only one place. r? `@estebank`
2021-12-17Auto merge of #89841 - cormacrelf:let-else-typed, r=nagisabors-27/+19
Implement let-else type annotations natively Tracking issue: #87335 Fixes #89688, fixes #89807, edit: fixes #89960 as well As explained in https://github.com/rust-lang/rust/issues/89688#issuecomment-940405082, the previous desugaring moved the let-else scrutinee into a dummy variable, which meant if you wanted to refer to it again in the else block, it had moved. This introduces a new hir type, ~~`hir::LetExpr`~~ `hir::Let`, which takes over all the fields of `hir::ExprKind::Let(...)` and adds an optional type annotation. The `hir::Let` is then treated like a `hir::Local` when type checking a function body, specifically: * `GatherLocalsVisitor` overrides a new `Visitor::visit_let_expr` and does pretty much exactly what it does for `visit_local`, assigning a local type to the `hir::Let` ~~(they could be deduplicated but they are right next to each other, so at least we know they're the same)~~ * It reuses the code in `check_decl_local` to typecheck the `hir::Let`, simply returning 'bool' for the expression type after doing that. * ~~`FnCtxt::check_expr_let` passes this local type in to `demand_scrutinee_type`, and then imitates check_decl_local's pattern checking~~ * ~~`demand_scrutinee_type` (the blindest change for me, please give this extra scrutiny) uses this local type instead of of creating a new one~~ * ~~Just realised the `check_expr_with_needs` was passing NoExpectation further down, need to pass the type there too. And apparently this Expectation API already exists.~~ Some other misc notes: * ~~Is the clippy code supposed to be autoformatted? I tried not to give huge diffs but maybe some rustfmt changes simply haven't hit it yet.~~ * in `rustc_ast_lowering/src/block.rs`, I noticed some existing `self.alias_attrs()` calls in `LoweringContext::lower_stmts` seem to be copying attributes from the lowered locals/etc to the statements. Is that right? I'm new at this, I don't know.
2021-12-15Rollup merge of #91888 - BoxyUwU:generic_arg_infer_aaaa, r=lcnrMatthias Krüger-2/+1
Handle unordered const/ty generics for object lifetime defaults *feel like I should have a PR description but cant think of what to put here* r? ```@lcnr```
2021-12-15Rollup merge of #90521 - jhpratt:stabilize-destructuring_assignment, ↵Matthias Krüger-19/+0
r=jackh726,pnkfelix Stabilize `destructuring_assignment` Closes #71126 - [Stabilization report](https://github.com/rust-lang/rust/issues/71126#issuecomment-941148058) - [Completed FCP](https://github.com/rust-lang/rust/issues/71126#issuecomment-954914819) `@rustbot` label +F-destructuring-assignment +T-lang Also needs +relnotes but I don't have permission to add that tag.
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-1/+1
2021-12-14Stabilize `destructuring_assignment`Jacob Pratt-19/+0
2021-12-15Rollup merge of #91881 - Patrick-Poitras:stabilize-iter-zip, r=scottmcmMatthias Krüger-1/+0
Stabilize `iter::zip` Hello all! As the tracking issue (#83574) for `iter::zip` completed the final commenting period without any concerns being raised, I hereby submit this stabilization PR on the issue. As the pull request that introduced the feature (#82917) states, the `iter::zip` function is a shorter way to zip two iterators. As it's generally a quality-of-life/ergonomic improvement, it has been integrated into the codebase without any trouble, and has been used in many places across the rust compiler and standard library since March without any issues. For more details, I would refer to `@cuviper's` original PR, or the [function's documentation](https://doc.rust-lang.org/std/iter/fn.zip.html).
2021-12-14Stabilize iter::zip.PFPoitras-1/+0
2021-12-14awdawdawdEllen-2/+1
2021-12-13Fix rebase and clippy testsEsteban Kuber-7/+17
2021-12-13Keep info on pre-desugaring expression for better "incorrect `.await`" ↵Esteban Kuber-16/+46
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`.