about summary refs log tree commit diff
path: root/src/librustc_ast_lowering/lib.rs
AgeCommit message (Collapse)AuthorLines
2020-03-19rustc: use LocalDefId instead of DefIndex in hir::lowering.Eduard-Mihai Burtescu-48/+58
2020-03-18Rollup merge of #69920 - Centril:hir-cleanup, r=ZoxcMazdak Farrokhzad-2/+1
Remove some imports to the rustc crate - When we have `NestedVisitorMap::None`, we use `type Map = dyn intravisit::Map<'v>;` instead of the actual map. This doesn't actually result in dynamic dispatch (in the future we may want to use an associated type default to simplify the code). - Use `rustc_session::` imports instead of `rustc::{session, lint}`. r? @Zoxc
2020-03-17Make async/await lowering use resume argumentsJonas Schievink-0/+5
2020-03-16Rollup merge of #69989 - petrochenkov:nolegacy, r=eddyb,matthewjasperDylan DPC-5/+8
resolve/hygiene: `macro_rules` are not "legacy" The "modern" vs "legacy" naming was introduced by jseyfried during initial implementation of macros 2.0. At this point it's clear that `macro_rules` are not going anywhere and won't be deprecated in the near future. So this PR changes the naming "legacy" (when it implies "macro_rules") to "macro_rules". This should also help people reading this code because it's wasn't obvious that "legacy" actually meant "macro_rules" in these contexts. The most contentious renaming here is probably ``` fn modern -> fn normalize_to_macros_2_0 fn modern_and_legacy -> fn normalize_to_macro_rules ``` Other alternatives that I could think of are `normalize_to_opaque`/`normalize_to_semitransparent`, or `strip_non_opaque`/`strip_transparent`, but they seemed less intuitive. The documentation to these functions can be found in `symbol.rs`. r? @matthewjasper
2020-03-16remove unnecessary hir::map importsMazdak Farrokhzad-2/+1
2020-03-16hygiene: `modern` -> `normalize_to_macros_2_0`Vadim Petrochenkov-5/+8
`modern_and_legacy` -> `normalize_to_macro_rules`
2020-03-15Auto merge of #68944 - Zoxc:hir-map, r=eddybbors-4/+2
Use queries for the HIR map r? @eddyb cc @michaelwoerister
2020-03-14Index HIR after creating TyCtxtJohn Kåre Alsaker-1/+1
2020-03-14Update `krate_attrs` and `get_module`John Kåre Alsaker-3/+1
2020-03-12ast: `Mac`/`Macro` -> `MacCall`Vadim Petrochenkov-2/+2
2020-03-06fix various typosMatthias Krüger-1/+1
2020-03-01encode `;` stmt w/o expr as `StmtKind::Empty`Mazdak Farrokhzad-0/+1
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-8/+8
2020-02-24parse/ast: move `Defaultness` into variants.Mazdak Farrokhzad-2/+2
2020-02-22parse: allow `type Foo: Ord` syntactically.Mazdak Farrokhzad-1/+1
2020-02-18Rollup merge of #69194 - Centril:assoc-extern-fuse, r=petrochenkovMazdak Farrokhzad-1/+1
parse: fuse associated and extern items up to defaultness Language changes: - The grammar of extern `type` aliases is unified with associated ones, and becomes: ```rust TypeItem = "type" ident generics {":" bounds}? where_clause {"=" type}? ";" ; ``` Semantic restrictions (`ast_validation`) are added to forbid any parameters in `generics`, any bounds in `bounds`, and any predicates in `where_clause`, as well as the presence of a type expression (`= u8`). (Work still remains to fuse this with free `type` aliases, but this can be done later.) - The grammar of constants and static items (free, associated, and extern) now permits the absence of an expression, and becomes: ```rust GlobalItem = {"const" {ident | "_"} | "static" "mut"? ident} {"=" expr}? ";" ; ``` - A semantic restriction is added to enforce the presence of the expression (the body). - A semantic restriction is added to reject `const _` in associated contexts. Together, these changes allow us to fuse the grammar of associated items and extern items up to `default`ness which is the main goal of the PR. ----------------------- We are now very close to fully fusing the entirely of item parsing and their ASTs. To progress further, we must make a decision: should we parse e.g. `default use foo::bar;` and whatnot? Accepting that is likely easiest from a parsing perspective, as it does not require using look-ahead, but it is perhaps not too onerous to only accept it for `fn`s (and all their various qualifiers), `const`s, `static`s, and `type`s. r? @petrochenkov
2020-02-17Rename `FunctionRetTy` to `FnRetTy`Yuki Okushi-9/+9
2020-02-15Record proc macro harness order for use during metadata deserializationAaron Hill-0/+2
Fixes #68690 When we generate the proc macro harness, we now explicitly recorder the order in which we generate entries. We then use this ordering data to deserialize the correct proc-macro-data from the crate metadata.
2020-02-15ast: move Generics into AssocItemKindsMazdak Farrokhzad-1/+1
2020-02-14Address review commentsMatthew Jasper-15/+17
2020-02-14Distinguish RPIT from other impl traitMatthew Jasper-16/+26
2020-02-13Constness -> enum Const { Yes(Span), No }Mazdak Farrokhzad-1/+1
Same idea for `Unsafety` & use new span for better diagnostics.
2020-02-05lowering: add recursion_limit = 256Mazdak Farrokhzad-0/+1
2020-02-05parser: merge `fn` grammars wrt. bodies & headersMazdak Farrokhzad-19/+8
also refactor `FnKind` and `visit_assoc_item` visitors
2020-02-01syntax::print -> new crate rustc_ast_prettyMazdak Farrokhzad-1/+1
2020-02-011. move node_id to syntaxMazdak Farrokhzad-4/+4
2. invert rustc_session & syntax deps 3. drop rustc_session dep in rustc_hir
2020-01-21Rollup merge of #68140 - ecstatic-morse:const-trait-bound-opt-out, r=oli-obkMazdak Farrokhzad-7/+15
Implement `?const` opt-out for trait bounds For now, such bounds are treated exactly the same as unprefixed ones in all contexts. [RFC 2632](https://github.com/rust-lang/rfcs/pull/2632) does not specify whether such bounds are forbidden outside of `const` contexts, so they are allowed at the moment. Prior to this PR, the constness of a trait bound/impl was stored in `TraitRef`. Now, the constness of an `impl` is stored in `ast::ItemKind::Impl` and the constness of a bound in `ast::TraitBoundModifer`. Additionally, constness of trait bounds is now stored in an additional field of `ty::Predicate::Trait`, and the combination of the constness of the item along with any `TraitBoundModifier` determines the constness of the bound in accordance with the RFC. Encoding the constness of impls at the `ty` level is left for a later PR. After a discussion in \#wg-grammar on Discord, it was decided that the grammar should not encode the mutual exclusivity of trait bound modifiers. The grammar for trait bound modifiers remains `[?const] [?]`. To encode this, I add a dummy variant to `ast::TraitBoundModifier` that is used when the syntax `?const ?` appears. This variant causes an error in AST validation and disappears during HIR lowering. cc #67794 r? @oli-obk
2020-01-21Add comment explaining `MaybeConstMaybe` loweringDylan MacKenzie-0/+5
2020-01-20Parse `?const ?Trait`Dylan MacKenzie-2/+7
2020-01-20Add `MaybeConst` variant to `{ast,hir}::TraitBoundModifier`Dylan MacKenzie-5/+3
2020-01-18remove rustc_error_codes deps except in rustc_driverMazdak Farrokhzad-1/+0
2020-01-14Rollup merge of #68143 - skinny121:const-param-type-elided-lifetime, ↵Yuki Okushi-6/+8
r=petrochenkov Forbid elided lifetimes within const generic parameter types Disallows `fn foo<const T: &u32>()`, the lifetime must be explicitly given, i.e. `fn foo<const T: &'static u32>()`. Fixes #67883
2020-01-12Forbid elided lifetimes within const generic parameter types.Ben Lewis-6/+8
2020-01-11move rustc::lint::{context, passes} to rustc_lint.Mazdak Farrokhzad-2/+1
Also do some cleanup of the interface.
2020-01-11Rollup merge of #68043 - Zoxc:missing-timers, r=wesleywiserMazdak Farrokhzad-1/+1
Add some missing timers Based on https://github.com/rust-lang/rust/pull/67988 r? @wesleywiser
2020-01-11buffered lint infra -> rustc_sessionMazdak Farrokhzad-3/+3
2020-01-10Rollup merge of #67922 - Centril:lowering-cleanup, r=petrochenkovMazdak Farrokhzad-711/+36
rustc_ast_lowering: misc cleanup & rustc dep reductions - The first two commits do some code simplification. - The next three do some file splitting (getting `lib.rs` below the 3kloc tidy lint). - The remaining commits reduce the number of `rustc::` imports. This works towards making lowering independent of the `rustc` crate. r? @oli-obk cc @Zoxc
2020-01-09Error when new syntax is loweredDylan MacKenzie-0/+4
This means the new syntax will always fail to compile, even when the feature gate is enabled. These checks will be removed in a later PR once the implementation is done.
2020-01-09Tweak timersJohn Kåre Alsaker-1/+1
2020-01-09add CStore::item_generics_num_lifetimesMazdak Farrokhzad-1/+1
2020-01-09rename a method in Resolver traitMazdak Farrokhzad-1/+1
2020-01-09lowering: remove dep on CrateStoreMazdak Farrokhzad-10/+3
2020-01-09lowering: rustc::session -> rustc_sessionMazdak Farrokhzad-2/+0
2020-01-09{rustc::util -> rustc_data_structures}::capturesMazdak Farrokhzad-1/+3
2020-01-09refactor 'Output = $ty' & reduce rustc depMazdak Farrokhzad-7/+1
2020-01-09extract path lowering -> path.rsMazdak Farrokhzad-401/+3
2020-01-09move lower_binding_mode -> pat.rsMazdak Farrokhzad-9/+0
2020-01-09extract pattern lowering -> pat.rsMazdak Farrokhzad-246/+3
2020-01-09lowering: elide some lifetimesMazdak Farrokhzad-1/+1
2020-01-09lowering: simplify HoFsMazdak Farrokhzad-36/+24