about summary refs log tree commit diff
path: root/src/libsyntax/attr
AgeCommit message (Collapse)AuthorLines
2018-12-12Rename `TokenStream::concat` and remove `TokenStream::concat_rc_vec`.Nicholas Nethercote-3/+3
`TokenStream::new` is a better name for the former, and the latter is now just equivalent to `TokenStream::Stream`.
2018-12-10Remove `tokenstream::Delimited`.Nicholas Nethercote-7/+8
Because it's an extra type layer that doesn't really help; in a couple of places it actively gets in the way, and overall removing it makes the code nicer. It does, however, move `tokenstream::TokenTree` further away from the `TokenTree` in `quote.rs`. More importantly, this change reduces the size of `TokenStream` from 48 bytes to 40 bytes on x86-64, which is enough to slightly reduce instruction counts on numerous benchmarks, the best by 1.5%. Note that `open_tt` and `close_tt` have gone from being methods on `Delimited` to associated methods of `TokenTree`.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-2/+2
2018-12-04updates all Filename variants to take a fingerprintMatthew Russo-1/+1
2018-10-31Fix feature gate only being checked on first repr attr.Cameron Hart-0/+5
2018-10-22optimize unsupported literal diag messagecsmoe-39/+70
2018-10-20update meta item checking testcsmoe-1/+3
2018-10-20suggest to trim prefix in nested meta itemscsmoe-3/+27
2018-10-20handle errors based on parse_sesscsmoe-31/+36
2018-10-20suggest to remove prefix `b` in lint stringcsmoe-45/+84
2018-10-05Stabilize `min_const_fn`Oliver Schneider-2/+1
2018-10-03Update error id to an unused oneOliver Schneider-1/+1
2018-10-03Only promote calls to `#[rustc_promotable]` const fnsOliver Schneider-1/+22
2018-09-09Auto merge of #53902 - dtolnay:group, r=petrochenkovbors-2/+2
proc_macro::Group::span_open and span_close Before this addition, every delimited group like `(`...`)` `[`...`]` `{`...`}` has only a single Span that covers the full source location from opening delimiter to closing delimiter. This makes it impossible for a procedural macro to trigger an error pointing to just the opening or closing delimiter. The Rust compiler does not seem to have the same limitation: ```rust mod m { type T = } ``` ```console error: expected type, found `}` --> src/main.rs:3:1 | 3 | } | ^ ``` On that same input, a procedural macro would be forced to trigger the error on the last token inside the block, on the entire block, or on the next token after the block, none of which is really what you want for an error like above. This commit adds `group.span_open()` and `group.span_close()` which access the Span associated with just the opening delimiter and just the closing delimiter of the group. Relevant to Syn as we implement real error messages for when parsing fails in a procedural macro: https://github.com/dtolnay/syn/issues/476. ```diff impl Group { fn span(&self) -> Span; + fn span_open(&self) -> Span; + fn span_close(&self) -> Span; } ``` Fixes #48187 r? @alexcrichton
2018-09-08Track distinct spans for open and close delimiterDavid Tolnay-2/+2
2018-09-06Validate syntax of `cfg` attributesVadim Petrochenkov-1/+15
2018-08-31Implement the `min_const_fn` feature gateOliver Schneider-15/+13
2018-08-19mv (mod) codemap source_mapDonato Sciarra-1/+1
2018-08-15syntax: Enforce attribute grammar in the parserVadim Petrochenkov-2/+2
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-1/+1
2018-08-02Auto merge of #52841 - petrochenkov:premacro, r=alexcrichtonbors-14/+1
resolve: Implement prelude search for macro paths, implement tool attributes When identifier is macro path is resolved in scopes (i.e. the first path segment - `foo` in `foo::mac!()` or `foo!()`), scopes are searched in the same order as for non-macro paths - items in modules, extern prelude, tool prelude (see later), standard library prelude, language prelude, but with some extra shadowing restrictions (names from globs and macro expansions cannot shadow names from outer scopes). See the comment in `fn resolve_lexical_macro_path_segment` for more details. "Tool prelude" currently contains two "tool modules" `rustfmt` and `clippy`, and is searched immediately after extern prelude. This makes the [possible long-term solution](https://github.com/rust-lang/rfcs/blob/master/text/2103-tool-attributes.md#long-term-solution) for tool attributes exactly equivalent to the existing extern prelude scheme, except that `--extern=my_crate` making crate names available in scope is replaced with something like `--tool=my_tool` making tool names available in scope. The `tool_attributes` feature is still unstable and `#![feature(tool_attributes)]` now implicitly enables `#![feature(use_extern_macros)]`. `use_extern_macros` is a prerequisite for `tool_attributes`, so their stabilization will happen in the same order. If `use_extern_macros` is not enabled, then tool attributes are treated as custom attributes (this is temporary, anyway). Fixes https://github.com/rust-lang/rust/issues/52576 Fixes https://github.com/rust-lang/rust/issues/52512 Fixes https://github.com/rust-lang/rust/issues/51277 cc https://github.com/rust-lang/rust/issues/52269
2018-08-01Switch syntax attribute tracking to BitVectorMark Rousskov-28/+4
2018-08-01resolve: Implement prelude search for macro pathsVadim Petrochenkov-14/+1
resolve/expansion: Implement tool attributes
2018-07-27Add the -Zcrate-attr=foo nightly rustc flag to inject crate attributesPietro Albini-2/+32
2018-07-04Improving span of unknown lint tool error messageflip1995-6/+8
2018-07-04Implementation of tool lintsflip1995-0/+11
2018-06-30add label to unknown meta item errorAndy Russell-11/+33
2018-06-30factor built-in attribute parsing into submoduleAndy Russell-0/+1518