about summary refs log tree commit diff
path: root/src/librustc_ast_lowering/lib.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-2737/+0
2020-08-24hir: consistent use and naming of lang itemsDavid Wood-1/+1
This commit adjusts the naming of various lang items so that they are consistent and don't include prefixes containing the target or "LangItem". In addition, lang item variants are no longer exported from the `lang_items` module. Signed-off-by: David Wood <david@davidtw.co>
2020-08-17Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obkbors-2/+1
rust_ast::ast => rustc_ast Rework of #71199 which is a rework #70621 Still working on this but just made the PR to track progress r? @Dylan-DPC
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-2/+1
2020-08-16hir: introduce `QPath::LangItem`David Wood-76/+34
This commit introduces `QPath::LangItem` to the HIR and uses it in AST lowering instead of constructing a `hir::Path` from a slice of symbols. This might be better for performance, but is also much cleaner as the previous approach is fragile. In addition, it resolves a bug (#61019) where an extern crate imported as "std" would result in the paths created during AST lowering being resolved incorrectly (or not at all). Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
2020-08-10Rollup merge of #75350 - estebank:foreign-fn-with-body-ice, r=davidtwcoYuki Okushi-1/+3
Do not ICE when lowering invalid extern fn with bodies Fix #75283.
2020-08-09Do not ICE when lowering invalid extern fn with bodiesEsteban Küber-1/+3
Fix #75283.
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-3/+2
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-06rustc_ast: Stop using "string typing" for doc comment tokensVadim Petrochenkov-1/+1
Explicitly store their kind and style retrieved during lexing in the token
2020-08-02Replace from log to tracingbishtpawan-1/+1
2020-08-02Replace from log to tracing in libsrustrustc_ast_lowering, ↵bishtpawan-1/+1
librustc_ast_passes, librustc_ast_pretty
2020-07-23cleanupBastian Kauschke-1/+1
2020-07-23stop sorting generic paramsBastian Kauschke-14/+1
2020-07-01Rollup merge of #73569 - Aaron1011:fix/macro-rules-group, r=petrochenkovManish Goregaokar-3/+8
Handle `macro_rules!` tokens consistently across crates When we serialize a `macro_rules!` macro, we used a 'lowered' `TokenStream` for its body, which has all `Nonterminal`s expanded in-place via `nt_to_tokenstream`. This matters when an 'outer' `macro_rules!` macro expands to an 'inner' `macro_rules!` macro - the inner macro may use tokens captured from the 'outer' macro in its definition. This means that invoking a foreign `macro_rules!` macro may use a different body `TokenStream` than when the same `macro_rules!` macro is invoked in the same crate. This difference is observable by proc-macros invoked by a `macro_rules!` macro - a `None`-delimited group will be seen in the same-crate case (inserted when convering `Nonterminal`s to the `proc_macro` crate's structs), but no `None`-delimited group in the cross-crate case. To fix this inconsistency, we now insert `None`-delimited groups when 'lowering' a `Nonterminal` `macro_rules!` body, just as we do in `proc_macro_server`. Additionally, we no longer print extra spaces for `None`-delimited groups - as far as pretty-printing is concerned, they don't exist (only their contents do). This ensures that `Display` output of a `TokenStream` does not depend on which crate a `macro_rules!` macro was invoked from. This PR is necessary in order to patch the `solana-genesis-programs` for the upcoming hygiene serialization breakage (https://github.com/rust-lang/rust/pull/72121#issuecomment-646924847). The `solana-genesis-programs` crate will need to use a proc macro to re-span certain tokens in a nested `macro_rules!`, which requires us to consistently use a `None`-delimited group. See `src/test/ui/proc-macro/nested-macro-rules.rs` for an example of the kind of nested `macro_rules!` affected by this crate.
2020-07-01Insert NoDelim groups around nonterminals when lowering macro_rulesAaron Hill-3/+8
2020-07-01Remove `token::FlattenGroup`Vadim Petrochenkov-1/+1
2020-06-27Rename two `Resolver` traitsVadim Petrochenkov-3/+3
2020-06-26Rollup merge of #73597 - ayazhafiz:i/const-span, r=ecstatic-morseManish Goregaokar-1/+1
Record span of `const` kw in GenericParamKind Context: this is needed for a fix of https://github.com/rust-lang/rustfmt/issues/4263, which currently records the span of a const generic param incorrectly because the location of the `const` kw is not known. I am not sure how to add tests for this; any guidance in how to do so would be appreciated :slightly_smiling_face:
2020-06-26proc_macro: Stop flattening groups with dummy spansVadim Petrochenkov-1/+1
2020-06-23Record span of `const` kw in GenericParamKindAyaz Hafiz-1/+1
Context: this is needed to fix https://github.com/rust-lang/rustfmt/issues/4263, which currently records the span of a const generic param incorrectly because the location of the `const` kw is not known. I am not sure how to add tests for this; any guidance in how to do so would be appreciated :slightly_smiling_face:
2020-06-21Always create a root definition when creating a new `Definitions` object.marmeladema-7/+7
2020-06-21Move remaining `NodeId` APIs from `Definitions` to `Resolver`marmeladema-13/+37
2020-06-20Rollup merge of #73378 - matthewjasper:arena-not-special, r=oli-obkManish Goregaokar-2/+0
Remove use of specialization from librustc_arena This reworks the macro so that specialization, `transmute` and `#[marker]` are not used. r? @oli-obk
2020-06-20Move `trait_map` into `hir::Crate`marmeladema-0/+10
2020-06-15Remove use of specialization from librustc_arenaMatthew Jasper-2/+0
2020-06-15Rollup merge of #72707 - matthewjasper:rustc_min_spec, r=oli-obkRalf Jung-1/+1
Use min_specialization in the remaining rustc crates This adds a lot of `transmute` calls to replace the unsound uses of specialization. It's ugly, but at least it's honest about what's going on. cc #71420, @RalfJung
2020-06-11Allow all impl trait types to capture bound lifetimesMatthew Jasper-28/+119
2020-06-11Rename `TyKind::Def` to `OpaqueDef`Matthew Jasper-1/+1
2020-06-11Forbid lifetime elision in let position impl TraitMatthew Jasper-5/+1
This is consistent with types.
2020-06-11Stop special casing top level TAITMatthew Jasper-2/+7
2020-06-10Use min_specialization in the remaining rustc cratesMatthew Jasper-1/+1
2020-06-02Rename the crates in source codeVadim Petrochenkov-1/+1
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