about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
AgeCommit message (Collapse)AuthorLines
2022-05-02fix most compiler/ doctestsElliot Roberts-4/+4
2022-04-30Add `do yeet` expressions to allow experimentation in nightlyScott McMurray-1/+40
Using an obviously-placeholder syntax. An RFC would still be needed before this could have any chance at stabilization, and it might be removed at any point. But I'd really like to have it in nightly at least to ensure it works well with try_trait_v2, especially as we refactor the traits.
2022-04-30Save colon span to suggest bounds.Camille GILLOT-0/+5
2022-04-30Store all generic bounds as where predicates.Camille GILLOT-53/+143
2022-04-30Inline WhereClause into Generics.Camille GILLOT-14/+18
2022-04-30Box HIR Generics and Impl.Camille GILLOT-12/+12
2022-04-29Simplify `lower_mac_args`.Nicholas Nethercote-28/+14
The `token` is always an interpolated non-terminal expression, and always a literal in valid code. This commit simplifies the processing accordingly, by directly extracting and using the literal.
2022-04-28rustc_ast: Harmonize delimiter naming with `proc_macro::Delimiter`Vadim Petrochenkov-2/+2
2022-04-27Auto merge of #91557 - cjgillot:ast-lifetimes-named, r=petrochenkovbors-925/+540
Perform lifetime resolution on the AST for lowering Lifetime resolution is currently implemented several times. Once during lowering in order to introduce in-band lifetimes, and once in the resolve_lifetimes query. However, due to the global nature of lifetime resolution and how it interferes with hygiene, it is better suited on the AST. This PR implements a first draft of lifetime resolution on the AST. For now, we specifically target named lifetimes and everything we need to remove lifetime resolution from lowering. Some diagnostics have already been ported, and sometimes made more precise using available hygiene information. Follow-up PRs will address in particular the resolution of anonymous lifetimes on the AST. We reuse the rib design of the current resolution framework. Specific `LifetimeRib` and `LifetimeRibKind` types are introduced. The most important variant is `LifetimeRibKind::Generics`, which happens each time we encounter something which may introduce generic lifetime parameters. It can be an item or a `for<...>` binder. The `LifetimeBinderKind` specifies how this rib behaves with respect to in-band lifetimes. r? `@petrochenkov`
2022-04-27Collect extra lifetime parameters during late resolution.Camille GILLOT-213/+94
2022-04-27Refactor generic collection.Camille GILLOT-56/+37
2022-04-27Create a specific struct for lifetime capture.Camille GILLOT-139/+172
2022-04-27Handle TAIT.Camille GILLOT-96/+21
2022-04-27Use LifetimeRes during lowering.Camille GILLOT-747/+542
2022-04-23Drop vis in Item.Camille GILLOT-92/+12
2022-04-23Drop vis in ImplItem.Camille GILLOT-1/+1
2022-04-23Drop vis from ForeignItem.Camille GILLOT-1/+1
2022-04-23Drop vis in FieldDef.Camille GILLOT-1/+1
2022-04-23Stop visiting visibility.Camille GILLOT-12/+0
2022-04-17Lint elided lifetimes in path on the AST.Camille GILLOT-45/+13
2022-04-17Report undeclared lifetimes on AST.Camille GILLOT-19/+6
2022-04-16Auto merge of #94468 - Amanieu:global_asm_sym, r=nagisabors-5/+60
Implement sym operands for global_asm! Tracking issue: #93333 This PR is pretty much a complete rewrite of `sym` operand support for inline assembly so that the same implementation can be shared by `asm!` and `global_asm!`. The main changes are: - At the AST level, `sym` is represented as a special `InlineAsmSym` AST node containing a path instead of an `Expr`. - At the HIR level, `sym` is split into `SymStatic` and `SymFn` depending on whether the path resolves to a static during AST lowering (defaults to `SynFn` if `get_early_res` fails). - `SymFn` is just an `AnonConst`. It runs through typeck and we just collect the resulting type at the end. An error is emitted if the type is not a `FnDef`. - `SymStatic` directly holds a path and the `DefId` of the `static` that it is pointing to. - The representation at the MIR level is mostly unchanged. There is a minor change to THIR where `SymFn` is a constant instead of an expression. - At the codegen level we need to apply the target's symbol mangling to the result of `tcx.symbol_name()` depending on the target. This is done by calling the LLVM name mangler, which handles all of the details. - On Mach-O, all symbols have a leading underscore. - On x86 Windows, different mangling is used for cdecl, stdcall, fastcall and vectorcall. - No mangling is needed on other platforms. r? `@nagisa` cc `@eddyb`
2022-04-15Rollup merge of #95194 - kckeiks:update-algo-in-find-use-placement, r=pnkfelixDylan DPC-6/+11
remove find_use_placement A more robust solution to finding where to place use suggestions was added in #94584. 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 instead of calling `find_use_placement` Fixes #94941
2022-04-14Reimplement lowering of sym operands for asm! so that it also works with ↵Amanieu d'Antras-5/+60
global_asm!
2022-04-06Fix unit struct/enum variant in destructuring assignmentMichael Goulet-0/+37
2022-04-04diagnostics: use correct span for const genericsMichael Howell-1/+1
Fixes #95616
2022-03-31remove find_use_placementFausto-6/+11
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-31Record item-likes in ItemLowerer.Camille GILLOT-61/+69
2022-03-31Create a new LoweringContext for each item-like.Camille GILLOT-129/+104
2022-03-31Make lowering pull-based.Camille GILLOT-55/+120
2022-03-31Implement with_parent_item_lifetime_defs on ItemLowerer.Camille GILLOT-70/+62
2022-03-31Move lower_crate outside the LoweringContext.Camille GILLOT-41/+39
2022-03-31Stop emitting lints during lowering.Camille GILLOT-3/+0
2022-03-31Remove mutability in ResolverAstLowering.Camille GILLOT-7/+5
2022-03-31Rollup merge of #95011 - michaelwoerister:awaitee_field, r=tmandryDylan DPC-13/+16
async: Give predictable name to binding generated from .await expressions. This name makes it to debuginfo and allows debuggers to identify such bindings and their captured versions in suspended async fns. This will be useful for async stack traces, as discussed in https://internals.rust-lang.org/t/async-debugging-logical-stack-traces-setting-goals-collecting-examples/15547. I don't know if this needs some discussion by ````@rust-lang/compiler,```` e.g. about the name of the binding (`__awaitee`) or about the fact that this PR introduces a (soft) guarantee about a compiler generated name. Although, regarding the later, I think the same reasoning applies here as it does for debuginfo in general. r? ````@tmandry````
2022-03-30async: Give predictable, reserved name to binding generated from .await ↵Michael Woerister-13/+16
expressions. This name makes it to debuginfo and allows debuggers to identify such bindings and their captured versions in suspended async fns.
2022-03-30Spellchecking some commentsYuri Astrakhan-1/+1
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-17Rollup merge of #94960 - codehorseman:master, r=oli-obkDylan DPC-1/+1
Fix many spelling mistakes Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16rustc_error: make ErrorReported impossible to constructmark-1/+1
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-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-1/+1
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-15Auto merge of #94584 - pnkfelix:inject-use-suggestion-sites, r=ekuberbors-2/+2
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-13Update comments.Camille GILLOT-9/+5
2022-03-12Identify anonymous lifetimes by their DefId in HIR.Camille GILLOT-67/+102
2022-03-07remove unnecessary `..` patternsTakayuki Maeda-6/+2
2022-03-05Fallback to other where clause if preferred is missingJack Huey-8/+24
2022-03-05Change syntax for TyAlias where clausesJack Huey-9/+34
2022-03-03Adjusted diagnostic output so that if there is no `use` in a item sequence,Felix S. Klock II-1/+1
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-03Associate multiple with a crate too.Felix S. Klock II-1/+1
2022-03-03refactor: prepare to associate multiple spans with a module.Felix S. Klock II-1/+1
2022-03-01compiler: fix some typoscuishuang-1/+1