about summary refs log tree commit diff
path: root/src/librustc_ast/attr
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-684/+0
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-85/+12
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-10/+15
Explicitly store their kind and style retrieved during lexing in the token
2020-08-04rustc_ast: More detailed docs for `Attribute::check_name`Vadim Petrochenkov-1/+5
2020-08-04rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`Vadim Petrochenkov-6/+7
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either. Replace all uses of `check_name` with `has_name` outside of rustc
2020-07-09Eliminate confusing "globals" terminology.Nicholas Nethercote-18/+24
There are some structures that are called "globals", but are they global to a compilation session, and not truly global. I have always found this highly confusing, so this commit renames them as "session globals" and adds a comment explaining things. Also, the commit fixes an unnecessary nesting of `set()` calls `src/librustc_errors/json/tests.rs`
2020-07-01Rollup merge of #73569 - Aaron1011:fix/macro-rules-group, r=petrochenkovManish Goregaokar-4/+14
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-4/+14
2020-07-01Remove `token::FlattenGroup`Vadim Petrochenkov-1/+1
2020-06-26proc_macro: Stop flattening groups with dummy spansVadim Petrochenkov-1/+1
2020-05-08Remove ast::{Ident, Name} reexports.Camille GILLOT-3/+3
2020-04-19Dogfood more or_patterns in the compilerJosh Stone-2/+4
2020-03-21ast: Compress `AttrId` from `usize` to `u32`Vadim Petrochenkov-4/+4
Also stop encoding/decoding it entirely
2020-03-12ast: `Mac`/`Macro` -> `MacCall`Vadim Petrochenkov-2/+2
2020-03-09Use `Token::uninterpolate` in couple more places matching on `(Nt)Ident`Vadim Petrochenkov-3/+2
2020-03-09rustc_ast: Introduce `Token::uninterpolated_span`Vadim Petrochenkov-0/+4
2020-03-06Auto merge of #69586 - petrochenkov:unmerge, r=Centrilbors-1/+1
ast: Unmerge structures for associated items and foreign items Follow-up to https://github.com/rust-lang/rust/pull/69194. r? @Centril
2020-03-01encode `;` stmt w/o expr as `StmtKind::Empty`Mazdak Farrokhzad-4/+3
2020-03-01ast: Unmerge structures for associated items and foreign itemsVadim Petrochenkov-1/+1
2020-02-29Move directory `libsyntax` -> `librustc_ast`Vadim Petrochenkov-0/+727