about summary refs log tree commit diff
path: root/src/libsyntax/attr
AgeCommit message (Collapse)AuthorLines
2019-06-12Auto merge of #60669 - c410-f3r:attrs-fn, r=petrochenkovbors-1/+1
Allow attributes in formal function parameters Implements https://github.com/rust-lang/rust/issues/60406. This is my first contribution to the compiler and since this is a large and complex project, I am not fully aware of the consequences of the changes I have made. **TODO** - [x] Forbid some built-in attributes. - [x] Expand cfg/cfg_attr
2019-06-09Allow attributes in formal function parametersCaio-1/+1
2019-06-08syntax: Move most of the `TokenKind` methods to `Token`Vadim Petrochenkov-3/+2
2019-06-07parser: `self.span` -> `self.token.span`Vadim Petrochenkov-2/+2
2019-06-06Some code cleanup and tidy/test fixesVadim Petrochenkov-3/+6
2019-06-06syntax: Switch function parameter order in `TokenTree::token`Vadim Petrochenkov-5/+5
2019-06-06syntax: Use `Token` in some more placesVadim Petrochenkov-2/+2
2019-06-06syntax: Remove duplicate span from `token::Ident`Vadim Petrochenkov-5/+5
2019-06-06syntax: Add some helper methods to `Token`Vadim Petrochenkov-2/+2
2019-06-06syntax: Use `Token` in `TokenTree::Token`Vadim Petrochenkov-19/+18
2019-06-06syntax: Rename `Token` into `TokenKind`Vadim Petrochenkov-2/+2
2019-06-06Always use token kinds through `token` module rather than `Token` typeVadim Petrochenkov-11/+11
2019-05-31Remove GlobalArenas and use Arena insteadJohn Kåre Alsaker-3/+3
2019-05-25Reword malformed attribute input diagnosticsEsteban Küber-1/+9
- Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error - Use consistend error message: "malformed `attrname` attribute input" - Provide suggestions when possible - Move note/help to label/suggestion - Use consistent wording "ill-formed" -> "malformed" - Move diagnostic logic out of parser
2019-05-24Tweak macro parse errors when reaching EOF during macro call parseEsteban Küber-1/+8
- Add detail on origin of current parser when reaching EOF and stop saying "found <eof>" and point at the end of macro calls - Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error
2019-05-23syntax: Return named errors from literal parsing functionsVadim Petrochenkov-2/+2
2019-05-22Restore the old behavior of the rustdoc keyword check + Fix rebaseVadim Petrochenkov-2/+2
2019-05-22Simplify use of keyword symbolsVadim Petrochenkov-4/+4
2019-05-17Avoid unnecessary interning in `Ident::from_str()` calls.Nicholas Nethercote-3/+3
A lot of these static symbols are pre-interned.
2019-05-13Return a `Symbol` from `name_or_empty` functions.Nicholas Nethercote-49/+46
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-11/+11
And also the equality between `Path` and strings, because `Path` is made up of `Symbol`s.
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-26/+17
2019-05-11Move literal parsing code into a separate fileVadim Petrochenkov-99/+0
Remove some dead code
2019-05-11Simplify conversions between tokens and semantic literalsVadim Petrochenkov-46/+58
2019-05-11Eliminate `comments::Literal`Vadim Petrochenkov-3/+4
2019-05-11Keep the original token in `ast::Lit`Vadim Petrochenkov-25/+37
2019-05-11Turn `ast::Lit` into a structVadim Petrochenkov-6/+6
2019-04-23Add rustc_allow_const_fn_ptrTaylor Cramer-4/+14
2019-04-15Make check_name genericJohn Kåre Alsaker-24/+12
2019-04-15Use a proc macro to declare preallocated symbolsJohn Kåre Alsaker-0/+21
2019-03-17Make meta-item API compatible with `LocalInternedString::get` soundness fixVadim Petrochenkov-30/+30
2019-03-16Refactor away `NestedMetaItemKind`Vadim Petrochenkov-59/+48
Remove methods `Attribute::span` and `MetaItem::span` duplicating public fields
2019-03-16Rename `MetaItem::ident` to `MetaItem::path`Vadim Petrochenkov-25/+25
2019-03-16syntax: Do not accidentally treat multi-segment meta-items as single-segmentVadim Petrochenkov-90/+81
2019-02-27Mention `unwind(aborts)` in diagnostics for `#[unwind]`Vadim Petrochenkov-31/+17
Simplify input validation for `#[unwind]`, add tests
2019-02-18Remove `LazyTokenStream`.Nicholas Nethercote-2/+2
It's present within `Token::Interpolated` as an optimization, so that if a nonterminal is converted to a `TokenStream` multiple times, the first-computed value is saved and reused. But in practice it's not needed. `interpolated_to_tokenstream()` is a cold function: it's only called a few dozen times while compiling rustc itself, and a few hundred times across the entire `rustc-perf` suite. Furthermore, when it is called, it is almost always the first conversion, so no benefit is gained from it. So this commit removes `LazyTokenStream`, along with the now-unnecessary `Token::interpolated()`. As well as a significant simplification, the removal speeds things up slightly, mostly due to not having to `drop` the `LazyTokenStream` instances.
2019-02-13Rollup merge of #58273 - taiki-e:rename-dependency, r=matthewjasperMazdak Farrokhzad-1/+1
Rename rustc_errors dependency in rust 2018 crates I think this is a better solution than `use rustc_errors as errors` in `lib.rs` and `use crate::errors` in modules. Related: rust-lang/cargo#5653 cc #58099 r? @Centril
2019-02-13Rollup merge of #58166 - euclio:deprecation-shorthand, r=petrochenkovMazdak Farrokhzad-60/+69
allow shorthand syntax for deprecation reason Fixes #48271. Created based on discussion in #56896.
2019-02-12Auto merge of #58051 - SimonSapin:str_escape, r=alexcrichtonbors-1/+1
Stabilize str::escape_* methods with new return types… … that implement `Display` and `Iterator<Item=char>`, as proposed in FCP: https://github.com/rust-lang/rust/issues/27791#issuecomment-376864727
2019-02-13Cleanup importsTaiki Endo-1/+1
2019-02-13Rename rustc_errors dependency in rust 2018 cratesTaiki Endo-1/+1
2019-02-12New return types for str::escape_* that impl Display and Iterator<char>Simon Sapin-1/+1
As FCP’ed in the tracking issue: https://github.com/rust-lang/rust/issues/27791#issuecomment-376864727
2019-02-10rustc: doc commentsAlexander Regueiro-6/+6
2019-02-07libsyntax => 2018Taiki Endo-28/+31
2019-02-06Overhaul `syntax::fold::Folder`.Nicholas Nethercote-27/+33
This commit changes `syntax::fold::Folder` from a functional style (where most methods take a `T` and produce a new `T`) to a more imperative style (where most methods take and modify a `&mut T`), and renames it `syntax::mut_visit::MutVisitor`. The first benefit is speed. The functional style does not require any reallocations, due to the use of `P::map` and `MoveMap::move_{,flat_}map`. However, every field in the AST must be overwritten; even those fields that are unchanged are overwritten with the same value. This causes a lot of unnecessary memory writes. The imperative style reduces instruction counts by 1--3% across a wide range of workloads, particularly incremental workloads. The second benefit is conciseness; the imperative style is usually more concise. E.g. compare the old functional style: ``` fn fold_abc(&mut self, abc: ABC) { ABC { a: fold_a(abc.a), b: fold_b(abc.b), c: abc.c, } } ``` with the imperative style: ``` fn visit_abc(&mut self, ABC { a, b, c: _ }: &mut ABC) { visit_a(a); visit_b(b); } ``` (The reductions get larger in more complex examples.) Overall, the patch removes over 200 lines of code -- even though the new code has more comments -- and a lot of the remaining lines have fewer characters. Some notes: - The old style used methods called `fold_*`. The new style mostly uses methods called `visit_*`, but there are a few methods that map a `T` to something other than a `T`, which are called `flat_map_*` (`T` maps to multiple `T`s) or `filter_map_*` (`T` maps to 0 or 1 `T`s). - `move_map.rs`/`MoveMap`/`move_map`/`move_flat_map` are renamed `map_in_place.rs`/`MapInPlace`/`map_in_place`/`flat_map_in_place` to reflect their slightly changed signatures. - Although this commit renames the `fold` module as `mut_visit`, it keeps it in the `fold.rs` file, so as not to confuse git. The next commit will rename the file.
2019-02-05allow shorthand syntax for deprecation reasonAndy Russell-60/+69
2019-01-30Add suggestions to deprecation lintsOliver Scherer-1/+4
2019-01-26remove `_with_applicability` from suggestion fnsAndy Russell-3/+3
2019-01-24Implement optimize(size) and optimize(speed)Simonas Kazlauskas-2/+9
2019-01-20Auto merge of #57651 - JohnTitor:give-char-type, r=estebankbors-0/+1
Implement new literal type `Err` Fixes #57384 I removed `return Ok`, otherwise, two errors occur. Any solutions? r? @estebank