summary refs log tree commit diff
path: root/src/librustc_ast_lowering/lib.rs
AgeCommit message (Collapse)AuthorLines
2020-05-24Collect tokens for `ast::Expr`Aaron Hill-0/+1
2020-05-24Rollup merge of #72284 - Aaron1011:feature/inline-macro-did, r=petrochenkovRalf Jung-1/+1
Remove `macro_defs` map We now store the `DefId` directly in `ExpnKind::Macro`. This will allow us to serialize `ExpnData` in PR #72121 without needing to manage a side table.
2020-05-22Remove `macro_defs` mapAaron Hill-1/+1
We store store the `DefId` directly in `ExpnData`. This will allow us to serialize `ExpnData` in PR #72121 without needing to manage a side table.
2020-05-22Use `OnceCell` instead of `Once`Dylan MacKenzie-1/+1
2020-05-10use min_specialization for some rustc crates where it requires no changesRalf Jung-1/+1
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-1/+1
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-11/+12
2020-04-14Do not use `DUMMY_HIR_ID` as placeholder value in node_id_to_hir_id tablemarmeladema-13/+10
Some helpers functions have been introduced to deal with (buggy) cases where either a `NodeId` or a `DefId` do not have a corresponding `HirId`. Those cases are tracked in issue #71104.
2020-04-08librustc_hir: return LocalDefId instead of DefId in local_def_idmarmeladema-9/+5
2020-03-30rustc -> rustc_middle part 1Mazdak Farrokhzad-1/+1
2020-03-27parse: move constraint/arg restriction to ast_validation.Mazdak Farrokhzad-0/+1
2020-03-21{rustc::hir::map -> rustc_hir}::definitionsMazdak Farrokhzad-1/+1
2020-03-21dep_graph.assert_ignored() -> rustc_interfaceMazdak Farrokhzad-7/+0
2020-03-21lowering: bug! -> panic!Mazdak Farrokhzad-6/+5
2020-03-21separate out an arena for HIRMazdak Farrokhzad-1/+4
2020-03-21Rollup merge of #69033 - jonas-schievink:resume-with-context, r=tmandryMazdak Farrokhzad-0/+5
Use generator resume arguments in the async/await lowering This removes the TLS requirement from async/await and enables it in `#![no_std]` crates. Closes https://github.com/rust-lang/rust/issues/56974 I'm not confident the HIR lowering is completely correct, there seem to be quite a few undocumented invariants in there. The `async-std` and tokio test suites are passing with these changes though.
2020-03-19rustc: use LocalDefId instead of DefIndex in hir::map::definitions.Eduard-Mihai Burtescu-14/+9
2020-03-19rustc: use LocalDefId instead of DefIndex in HirId.Eduard-Mihai Burtescu-19/+15
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