about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2018-04-16Auto merge of #49719 - mark-i-m:no_sep, r=petrochenkovbors-67/+22
Update `?` repetition disambiguation. **Do not merge** (yet) This is a test implementation of some ideas from discussion in https://github.com/rust-lang/rust/issues/48075 . This PR - disallows `?` repetition from taking a separator, since the separator is never used. - disallows the use of `?` as a separator. This allows patterns like `$(a)?+` to match `+` and `a+` rather than `a?a?a`. This is a _breaking change_, but maybe that's ok? Perhaps a crater run is the right approach? cc @durka @alexreg @nikomatsakis
2018-04-14Add error codes for libsyntax_extGuillaume Gomez-1/+4
2018-04-12Avoid comparing fields by name when possibleVadim Petrochenkov-2/+2
Resolve them into field indices once and then use those resolutions + Fix rebase
2018-04-12AST/HIR: Merge field access expressions for named and numeric fieldsVadim Petrochenkov-2/+2
2018-04-10Auto merge of #49390 - Zoxc:sync-syntax, r=michaelwoeristerbors-9/+11
More thread-safety changes r? @michaelwoerister
2018-04-06Use `Ident` instead of `Name` in `MetaItem`Vadim Petrochenkov-12/+14
2018-04-06Make lifetime nonterminals closer to identifier nonterminalsVadim Petrochenkov-2/+2
2018-04-06Remove more duplicated spansVadim Petrochenkov-11/+13
2018-04-06Rename `ast::Variant_::name` into `ident` + Fix rebaseVadim Petrochenkov-2/+2
2018-04-06Use `Span::apply_mark` where possibleVadim Petrochenkov-5/+5
2018-04-06Get rid of `SpannedIdent`Vadim Petrochenkov-19/+14
2018-04-06Rename `PathSegment::identifier` to `ident`Vadim Petrochenkov-9/+9
2018-04-06Use `Span` instead of `SyntaxContext` in `Ident`Vadim Petrochenkov-11/+8
2018-04-05No separator for `?`. No `?` as a separator.Mark Mansi-67/+22
2018-04-03expand macro invocations in `extern {}` blocksAustin Bonander-0/+97
2018-04-02Expand attribute macros on statements and expressions.Austin Bonander-19/+78
Retains the `stmt_expr_attributes` feature requirement for attributes on expressions. closes #41475 cc #38356
2018-03-28Make SyntaxExtension thread-safeJohn Kåre Alsaker-9/+11
2018-03-27Auto merge of #49279 - varkor:generated-closure-return-type, r=alexcrichtonbors-5/+5
Fix implicit closure return type generation for libsyntax The `lambda` function for constructing closures in libsyntax was explicitly setting the return type to `_`, which resulted in incorrect corresponding syntax (as `|| -> _ x` is not valid, without the enclosing brackets). This meant the generated code, when printed, was invalid. I also took the opportunity to slightly improve the generated code for the `RustcEncodable::encode` method for unit structs. Fixes #42213.
2018-03-22Use FunctionRetTy::Default rather than an explicit TyKind::Infer for ↵varkor-5/+5
lambda-building This prevents explicit `-> _` return type annotations for closures generated by `lambda`.
2018-03-22Clean up raw identifier handling when recovering tokens from AST.Lymia Aluysia-3/+4
2018-03-18Return a is_raw parameter from Token::ident rather than having separate methods.Lymia Aluysia-4/+4
2018-03-18Initial implementation of RFC 2151, Raw IdentifiersLymia Aluysia-21/+24
2018-03-18Auto merge of #48917 - petrochenkov:import, r=oli-obkbors-13/+16
syntax: Make imports in AST closer to the source and cleanup their parsing This is a continuation of https://github.com/rust-lang/rust/pull/45846 in some sense.
2018-03-17Rename `Span::empty` to `Span::shrink_to_lo`, add `Span::shrink_to_hi`Vadim Petrochenkov-4/+4
2018-03-17AST: Keep distinction between `path` and `::path` in imports and visibilitiesVadim Petrochenkov-3/+7
Add the root segment for name resolution purposes only
2018-03-17AST: Make renames in imports closer to the sourceVadim Petrochenkov-6/+5
Fix `unused_import_braces` lint false positive on `use prefix::{self as rename}`
2018-03-17Reject `_` in `ident` matcherVadim Petrochenkov-17/+19
2018-03-17syntax: Make `_` an identifierVadim Petrochenkov-3/+1
2018-03-16Auto merge of #48524 - abonander:check-macro-stability, r=petrochenkovbors-17/+56
check stability of macro invocations I haven't implemented tests yet but this should be a pretty solid prototype. I think as-implemented it will also stability-check macro invocations in the same crate, dunno if we want that or not. I don't know if we want this to go through `rustc::middle::stability` or not, considering the information there wouldn't be available at the time of macro expansion (even for external crates, right?). r? @nrc closes #34079 cc @petrochenkov @durka @jseyfried #38356
2018-03-13Fix ICE on malformed plugin attributesMichael Lamparski-2/+4
2018-03-07check stability of macro invocationsAustin Bonander-17/+56
2018-03-05Turn features() into a query.Michael Woerister-17/+15
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-24/+27
2018-02-28Auto merge of #48056 - ExpHP:macro-commas, r=dtolnaybors-2/+4
Comprehensively support trailing commas in std/core macros I carefully organized the changes into four commits: * Test cases * Fixes for `macro_rules!` macros * Fixes for builtin macros * Docs for builtins **I can easily scale this back to just the first two commits for now if such is desired.** ### Breaking (?) changes * This fixes #48042, which is a breaking change that I hope people can agree is just a bugfix for an extremely dark corner case. * To fix five of the builtins, this changes `syntax::ext::base::get_single_str_from_tts` to accept a trailing comma, and revises the documentation so that this aspect is not surprising. **I made this change under the (hopefully correct) understanding that `libsyntax` is private rustc implementation detail.** After reviewing all call sites (which were, you guessed it, *precisely those five macros*), I believe the revised semantics are closer to the intended spirit of the function. ### Changes which may require concensus Up until now, it could be argued that some or all the following macros did not conceptually take a comma-separated list, because they only took one argument: * **`cfg(unix,)`** (most notable since cfg! is unique in taking a meta tag) * **`include{,_bytes,_str}("file.rs",)`** (in item form this might be written as "`include!{"file.rs",}`" which is even slightly more odd) * **`compile_error("message",);`** * **`option_env!("PATH",)`** * **`try!(Ok(()),)`** So I think these particular changes may require some sort of consensus. **All of the fixes for builtins are included this list, so if we want to defer these decisions to later then I can scale this PR back to just the first two commits.** ### Other notes/general requests for comment * Do we have a big checklist somewhere of "things to do when adding macros?" My hope is for `run-pass/macro-comma-support.rs` to remain comprehensive. * Originally I wanted the tests to also comprehensively forbid double trailing commas. However, this didn't work out too well: [see this gist and the giant FIXME in it](https://gist.github.com/ExpHP/6fc40e82f3d73267c4e590a9a94966f1#file-compile-fail_macro-comma-support-rs-L33-L50) * I did not touch `select!`. It appears to me to be a complete mess, and its trailing comma mishaps are only the tip of the iceberg. * There are [some compile-fail test cases](https://github.com/ExpHP/rust/blob/5fa97c35da2f0ee/src/test/compile-fail/macro-comma-behavior.rs#L49-L52) that didn't seem to work (rustc emits errors, but compile-fail doesn't acknowledge them), so they are disabled. Any clues? (Possibly related: These happen to be precisely the set of errors which are tagged by rustc as "this error originates in a macro outside of the current crate".) --- Fixes #48042 Closes #46241
2018-02-24Rollup merge of #48143 - nikomatsakis:termination_trait_in_tests, r=eddybManish Goregaokar-7/+3
Termination trait in tests Support the `Termination` trait in unit tests (cc https://github.com/rust-lang/rust/issues/43301) Also, a drive-by fix for #47075. This is joint work with @bkchr.
2018-02-22begin crate-relative paths with `crate`Niko Matsakis-7/+3
2018-02-18Replace dummy spans with empty spansSeiichi Uchida-5/+5
2018-02-18Change ast::Visibility to Spanned typeSeiichi Uchida-7/+16
2018-02-11Auto merge of #47752 - mark-i-m:at-most-once-rep, r=nikomatsakisbors-53/+171
Implement `?` macro repetition See rust-lang/rfcs#2298 (with disposition merge)
2018-02-07libsyntax/ext: trailing commas in builtin macrosMichael Lamparski-2/+4
Most notably this changes 'syntax::ext::base::get_single_str_from_tts' to accept a trailing comma, and revises the documentation so that this aspect is not surprising. I made this change under the understanding that this crate is private rustc implementation detail (I hope this is correct!). After reviewing all call sites, I believe the revised semantics are closer to the intended spirit of the function.
2018-01-30Update a few commentsMark Mansi-1/+4
2018-01-30stabilize match_beginning_vertJonathan Goodman-1/+0
2018-01-30Fix trailing whitespaceMark Mansi-1/+1
2018-01-30Improved tests + typo fixes + assertMark Mansi-0/+2
2018-01-30Add feature gate + testsMark Mansi-10/+68
2018-01-30Fix typo in error message + update testsMark Mansi-1/+1
2018-01-30Attempted fix for `?` kleene opMark Mansi-23/+21
2018-01-30Run rustfmt on macro_parser.rsMark Mansi-4/+6
2018-01-30Run rustfmt on quoted.rsMark Mansi-10/+21
2018-01-30Update the macro parser to allow at most once repetitions for `?` KleeneMark Mansi-16/+22