about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2023-12-04Fix some broken testsEric Holk-1/+1
2023-12-04Option<CoroutineKind>Eric Holk-14/+4
2023-12-04Merge Async and Gen into CoroutineKindEric Holk-32/+25
2023-12-04Lower return types for gen fn to impl IteratorEric Holk-22/+53
2023-12-03rustc: Harmonize `DefKind` and `DefPathData`Vadim Petrochenkov-11/+10
`DefPathData::(ClosureExpr,ImplTrait)` are renamed to match `DefKind::(Closure,OpaqueTy)`. `DefPathData::ImplTraitAssocTy` is replaced with `DefPathData::TypeNS(kw::Empty)` because both correspond to `DefKind::AssocTy`. It's possible that introducing `(DefKind,DefPathData)::AssocOpaqueTy` could be a better solution, but that would be a much more invasive change. Const generic parameters introduced for effects are moved from `DefPathData::TypeNS` to `DefPathData::ValueNS`, because constants are values. `DefPathData` is no longer passed to `create_def` functions to avoid redundancy.
2023-12-02Inline and remove `LoweringContext::handler()`.Nicholas Nethercote-5/+1
It has a single call site.
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-6/+7
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-29Auto merge of #118433 - matthiaskrgr:rollup-fi9lrwg, r=matthiaskrgrbors-3/+8
Rollup of 7 pull requests Successful merges: - #116839 (Implement thread parking for xous) - #118265 (remove the memcpy-on-equal-ptrs assumption) - #118269 (Unify `TraitRefs` and `PolyTraitRefs` in `ValuePairs`) - #118394 (Remove HIR opkinds) - #118398 (Add proper cfgs in std) - #118419 (Eagerly return `ExprKind::Err` on `yield`/`await` in wrong coroutine context) - #118422 (Fix coroutine validation for mixed panic strategy) r? `@ghost` `@rustbot` modify labels: rollup
2023-11-29Rollup merge of #118401 - nnethercote:rustc_ast_lowering, r=compiler-errorsMatthias Krüger-3/+42
`rustc_ast_lowering` cleanups Just some cleanups I found while looking through this code. r? `@spastorino`
2023-11-28Fix spans for bad await in inline constMichael Goulet-3/+8
2023-11-28resolve: Feed the `def_kind` query immediately on `DefId` creationVadim Petrochenkov-9/+14
2023-11-28Remove unnecessary `Option` from ↵Nicholas Nethercote-7/+7
`LoweringContext::allow_{try_trait,gen_future}`. Also remove some unnecessary slicing.
2023-11-28Add `LoweringContext::new`.Nicholas Nethercote-0/+40
2023-11-28Remove unused feature.Nicholas Nethercote-1/+0
2023-11-25Rollup merge of #118158 - nnethercote:reduce-fluent-boilerplate, ↵Michael Goulet-5/+2
r=compiler-errors Reduce fluent boilerplate Best reviewed one commit at a time. r? `@davidtwco`
2023-11-26Use `rustc_fluent_macro::fluent_messages!` directly.Nicholas Nethercote-2/+1
Currently we always do this: ``` use rustc_fluent_macro::fluent_messages; ... fluent_messages! { "./example.ftl" } ``` But there is no need, we can just do this everywhere: ``` rustc_fluent_macro::fluent_messages! { "./example.ftl" } ``` which is shorter.
2023-11-26Avoid need for `{D,Subd}iagnosticMessage` imports.Nicholas Nethercote-3/+1
The `fluent_messages!` macro produces uses of `crate::{D,Subd}iagnosticMessage`, which means that every crate using the macro must have this import: ``` use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; ``` This commit changes the macro to instead use `rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the imports.
2023-11-25Remove HirId from QPath::LangItemMichael Goulet-6/+5
2023-11-24Add `Span` to `TraitBoundModifier`Deadbeef-2/+2
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-9/+7
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-11-17Rollup merge of #117549 - DaniPopes:more-copied, r=b-naberMatthias Krüger-2/+2
Use `copied` instead of manual `map`
2023-11-15Bump cfg(bootstrap)sMark Rousskov-3/+3
2023-11-10Remove `-Zkeep-hygiene-data`.Nicholas Nethercote-5/+0
It was added way back in #28585 under the name `-Zkeep-mtwt-tables`. The justification was: > This is so that the resolution results can be used after analysis, > potentially for tool support. There are no uses of significance in the code base, and various Google searches for both option names (and variants) found nothing of interest. @petrochenkov says removing this part (and it's only part) of the hygiene data is dubious. It doesn't seem that big, so let's just keep it around.
2023-11-03compiler: use `copied` instead of manual `map`DaniPopes-2/+2
2023-11-02Minimize `pub` usage in `source_map.rs`.Nicholas Nethercote-2/+1
Most notably, this commit changes the `pub use crate::*;` in that file to `use crate::*;`. This requires a lot of `use` items in other crates to be adjusted, because everything defined within `rustc_span::*` was also available via `rustc_span::source_map::*`, which is bizarre. The commit also removes `SourceMap::span_to_relative_line_string`, which is unused.
2023-10-30Rollup merge of #117147 - DaniPopes:pphir-fn-variadic, r=compiler-errorsLeón Orell Valerian Liehr-8/+1
Print variadic argument pattern in HIR pretty printer Variadic argument name/pattern was ignored during HIR pretty printing. Could not figure out why it only works on normal functions (`va2`) and not in foreign ones (`va1`).
2023-10-26Deny providing explicit effect paramsDeadbeef-1/+7
2023-10-25Remove unnecessary CVarArgs name skipping logicDaniPopes-8/+1
2023-10-20s/generator/coroutine/Oli Scherer-2/+2
2023-10-20s/Generator/Coroutine/Oli Scherer-1/+1
2023-10-16docs: add Rust logo to more compiler cratesMichael Howell-0/+3
c6e6ecb1afea9695a42d0f148ce153536b279eb5 added it to some of the compiler's crates, but avoided adding it to all of them to reduce bit-rot. This commit adds to more.
2023-10-15Auto merge of #116688 - compiler-errors:rustfmt-up, r=WaffleLapkin,Nilstriebbors-1/+1
Format all the let-chains in compiler crates Since rust-lang/rustfmt#5910 has landed, soon we will have support for formatting let-chains (as soon as rustfmt syncs and beta gets bumped). This PR applies the changes [from master rustfmt to rust-lang/rust eagerly](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/out.20formatting.20of.20prs/near/374997516), so that the next beta bump does not have to deal with a 200+ file diff and can remain concerned with other things like `cfg(bootstrap)` -- #113637 was a pain to land, for example, because of let-else. I will also add this commit to the ignore list after it has landed. The commands that were run -- I'm not great at bash-foo, but this applies rustfmt to every compiler crate, and then reverts the two crates that should probably be formatted out-of-tree. ``` ~/rustfmt $ ls -1d ~/rust/compiler/* | xargs -I@ cargo run --bin rustfmt -- `@/src/lib.rs` --config-path ~/rust --edition=2021 # format all of the compiler crates ~/rust $ git checkout HEAD -- compiler/rustc_codegen_{gcc,cranelift} # revert changes to cg-gcc and cg-clif ``` cc `@rust-lang/rustfmt` r? `@WaffleLapkin` or `@Nilstrieb` who said they may be able to review this purely mechanical PR :> cc `@Mark-Simulacrum` and `@petrochenkov,` who had some thoughts on the order of operations with big formatting changes in https://github.com/rust-lang/rust/pull/95262#issue-1178993801. I think the situation has changed since then, given that let-chains support exists on master rustfmt now, and I'm fairly confident that this formatting PR should land even if *bootstrap* rustfmt doesn't yet format let-chains in order to lessen the burden of the next beta bump.
2023-10-13Deprecate E0706Michael Goulet-13/+2
2023-10-13Stabilize AFIT and RPITITMichael Goulet-53/+17
2023-10-13Format all the let chains in compilerMichael Goulet-1/+1
2023-10-03Point to full async fn for futureMichael Goulet-2/+3
2023-09-26subst -> instantiatelcnr-1/+1
2023-09-19Auto merge of #113955 - cjgillot:name-apit, r=WaffleLapkinbors-6/+6
Pretty-print argument-position impl trait to name it. This removes a corner case. RPIT and TAIT keep having no name, and it would be wrong to use the one in HIR (Ident::empty), so I make this case ICE.
2023-09-07Enable incremental-relative-spans by default.Camille GILLOT-1/+1
2023-09-02Don't hold the definitions' lock across `index_hir`John Kåre Alsaker-2/+1
2023-08-30Pretty-print impl trait to name it.Camille GILLOT-6/+6
2023-08-30Capture lifetimes for associated type bounds destined to be lowered to opaquesMichael Goulet-0/+11
2023-08-28RPITITs capture all their lifetimesMichael Goulet-22/+31
2023-08-24Auto merge of #115131 - frank-king:feature/unnamed-fields-lite, r=petrochenkovbors-0/+12
Parse unnamed fields and anonymous structs or unions (no-recovery) It is part of #114782 which implements #49804. Only parse anonymous structs or unions in struct field definition positions. r? `@petrochenkov`
2023-08-24Parse unnamed fields and anonymous structs or unionsFrank King-0/+12
Anonymous structs or unions are only allowed in struct field definitions. Co-authored-by: carbotaniuman <41451839+carbotaniuman@users.noreply.github.com>
2023-08-14Remove constness from `ImplSource::Param`Deadbeef-27/+23
2023-08-09rustc: Move `crate_types` from `Session` to `GlobalCtxt`Vadim Petrochenkov-2/+2
Removes a piece of mutable state. Follow up to #114578.
2023-08-08Auto merge of #114545 - fee1-dead-contrib:lower-impl-effect, r=oli-obkbors-8/+87
correctly lower `impl const` to bind to host effect param r? `@oli-obk`
2023-08-08Unconditionally record lifetime mappingMichael Goulet-5/+1
2023-08-07Fix ICEDeadbeef-3/+13