about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2019-06-05Aggregation of drive-by cosmetic changes.Alexander Regueiro-18/+15
2019-06-03syntax: revert `ast::AsyncArgument` and associated changes.Eduard-Mihai Burtescu-25/+4
Here follows the main reverts applied in order to make this commit: Revert "Rollup merge of #60676 - davidtwco:issue-60674, r=cramertj" This reverts commit 45b09453dbf120cc23d889435aac3ed7d2ec8eb7, reversing changes made to f6df1f6c30b469cb9e65c5453a0efa03cbb6005e. Revert "Rollup merge of #60437 - davidtwco:issue-60236, r=nikomatsakis" This reverts commit 16939a50ea440e72cb6ecefdaabb988addb1ec0e, reversing changes made to 12bf98155249783583a91863c5dccf9e346f1226. Revert "Rollup merge of #59823 - davidtwco:issue-54716, r=cramertj" This reverts commit 62d1574876f5531bce1b267e62dff520d7adcbbb, reversing changes made to 4eff8526a789e0dfa8b97f7dec91b7b5c18e8544.
2019-05-29Introduce and use `SyntaxContext::outer_expn_info()`.Nicholas Nethercote-1/+1
It reduces two `hygiene_data` accesses to one on some hot paths.
2019-05-27Auto merge of #61140 - estebank:attr-diagnostics, r=michaelwoeristerbors-2/+8
Reword malformed attribute input diagnostics - 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 Split up from https://github.com/rust-lang/rust/pull/61026, where there's prior conversation.
2019-05-27Use `Symbol` equality in `may_begin_with` and `parse_nt`.Nicholas Nethercote-27/+27
2019-05-27Pass symbols to `ExtCtxt::std_path` instead of strings.Nicholas Nethercote-26/+16
Because this function is hot. Also remove the dead `ty_option` function.
2019-05-27Avoid unnecessary internings.Nicholas Nethercote-7/+4
Most involving `Symbol::intern` on string literals.
2019-05-25Reword malformed attribute input diagnosticsEsteban Küber-2/+8
- 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-24Revert changes that belong to separate PREsteban Küber-5/+2
2019-05-24review commentsEsteban Küber-7/+3
2019-05-24Tweak macro parse errors when reaching EOF during macro call parseEsteban Küber-5/+19
- 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-23Auto merge of #61075 - Centril:rollup-1ugmcqu, r=Centrilbors-8/+10
Rollup of 7 pull requests Successful merges: - #60981 (Bump compiler-builtins to 0.1.15) - #61014 (Make -Zemit-artifact-notifications also emit the artifact type) - #61043 (Disable LLVM/debug assertions in gnu-full-bootstrap) - #61046 (Fix ICE with inconsistent macro matchers) - #61055 (Solaris CI: Build with dilos2 stable) - #61057 (Revert "Add implementations of last in terms of next_back on a bunch of DoubleEndedIterators.") - #61073 (librustc_errors: Remove unused annotation style `OldSchoolNoteText`) Failed merges: r? @ghost
2019-05-23Rollup merge of #61046 - mark-i-m:transcribe-fix, r=petrochenkovMazdak Farrokhzad-8/+10
Fix ICE with inconsistent macro matchers Fixes #61033 r? @petrochenkov
2019-05-23Auto merge of #60174 - matthewjasper:add-match-arm-scopes, r=pnkfelixbors-1/+2
Add match arm scopes and other scope fixes * Add drop and lint scopes for match arms. * Lint attributes are now respected on match arms. * Make sure we emit a StorageDead if we diverge when initializing a temporary. * Adjust MIR pretty printing of scopes for locals. * Don't generate duplicate lint scopes for `let statements`. * Add some previously missing fake borrows for matches. closes #46525 cc @rust-lang/compiler
2019-05-22Restore the old behavior of the rustdoc keyword check + Fix rebaseVadim Petrochenkov-6/+6
2019-05-22Eliminate unnecessary `Ident::with_empty_ctxt`sVadim Petrochenkov-9/+8
2019-05-22Simplify use of keyword symbolsVadim Petrochenkov-26/+26
2019-05-22these errors can happen after allMark Mansi-8/+10
2019-05-21Give match arms an HirId and a SpanMatthew Jasper-1/+2
2019-05-21Move `edition` outside the hygiene lock and avoid accessing itJohn Kåre Alsaker-9/+11
2019-05-20Remove `Symbol::gensym()`.Nicholas Nethercote-2/+2
2019-05-17Avoid unnecessary interning in `Ident::from_str()` calls.Nicholas Nethercote-4/+4
A lot of these static symbols are pre-interned.
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-17/+22
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-23/+23
2019-05-11Simplify conversions between tokens and semantic literalsVadim Petrochenkov-6/+5
2019-05-11Keep the original token in `ast::Lit`Vadim Petrochenkov-2/+4
2019-05-11Turn `ast::Lit` into a structVadim Petrochenkov-5/+5
2019-05-10turn a couple of fixmes into span_bugsMark Mansi-9/+7
2019-05-08fix incorrect assertMark Mansi-1/+4
2019-05-07lots of comments + minor cleanupMark Mansi-16/+139
2019-05-07avoid extra copyMark Mansi-13/+12
2019-05-06rustfmtMark Mansi-50/+50
2019-05-06Auto merge of #60261 - matklad:one-escape, r=petrochenkovbors-0/+1
introduce unescape module A WIP PR to gauge early feedback Currently, we deal with escape sequences twice: once when we [lex](https://github.com/rust-lang/rust/blob/112f7e9ac564e2cfcfc13d599c8376a219fde1bc/src/libsyntax/parse/lexer/mod.rs#L928-L1065) a string, and a second time when we [unescape](https://github.com/rust-lang/rust/blob/112f7e9ac564e2cfcfc13d599c8376a219fde1bc/src/libsyntax/parse/mod.rs#L313-L366) literals. Note that we also produce different sets of diagnostics in these two cases. This PR aims to remove this duplication, by introducing a new `unescape` module as a single source of truth for character escaping rules. I think this would be a useful cleanup by itself, but I also need this for https://github.com/rust-lang/rust/pull/59706. In the current state, the PR has `unescape` module which fully (modulo bugs) deals with string and char literals. I am quite happy about the state of this module What this PR doesn't have yet are: * [x] handling of byte and byte string literals (should be simple to add) * [x] good diagnostics * [x] actual removal of code from lexer (giant `scan_char_or_byte` should go away completely) * [x] performance check * [x] general cleanup of the new code Diagnostics will be the most labor-consuming bit here, but they are mostly a question of just correctly adjusting spans to sub-tokens. The current setup for diagnostics is that `unescape` produces a plain old `enum` with various problems, and they are rendered into `Handler` separately. This bit is not actually required (it is possible to just pass the `Handler` in), but I like the separation between diagnostics and logic this approach imposes, and such separation should again be useful for #59706 cc @eddyb , @petrochenkov
2019-05-02don't amplify errors in format! with bad literalsAleksey Kladov-0/+1
2019-05-01Ensure that drop order of `async fn` matches `fn`.David Wood-1/+4
This commit modifies the lowering of `async fn` arguments so that the drop order matches the equivalent `fn`. Previously, async function arguments were lowered as shown below: async fn foo(<pattern>: <ty>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>) { async move { let <pattern> = __arg0; } // <-- dropped as you "exit" the async block } After this PR, async function arguments will be lowered as: async fn foo(<pattern>: <ty>, <pattern>: <ty>, <pattern>: <ty>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>, __arg1: <ty>, __arg2: <ty>) { async move { let __arg2 = __arg2; let <pattern> = __arg2; let __arg1 = __arg1; let <pattern> = __arg1; let __arg0 = __arg0; let <pattern> = __arg0; } // <-- dropped as you "exit" the async block } If `<pattern>` is a simple ident, then it is lowered to a single `let <pattern> = <pattern>;` statement as an optimization.
2019-04-21Introduce `ArgSource` for diagnostics.David Wood-1/+2
This commit introduces an `ArgSource` enum that is lowered into the HIR so that diagnostics can correctly refer to the argument pattern's original name rather than the generated pattern.
2019-04-21Add `AsyncArgument` to AST.David Wood-3/+17
This commit adds an `AsyncArgument` struct to the AST that contains the generated argument and statement that will be used in HIR lowering, name resolution and def collection.
2019-04-21Introduce `LocalSource` into the AST.David Wood-0/+3
This will be used to keep track of the origin of a local in the AST. In particular, it will be used by `async fn` lowering for the locals in `let <pat>: <ty> = __arg0;` statements.
2019-04-10make duplicate matcher bindings a hard errorMark Mansi-12/+4
2019-03-27Rollup merge of #57565 - petrochenkov:turbowarn, r=CentrilJosh Stone-1/+1
syntax: Remove warning for unnecessary path disambiguators `rustfmt` is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in https://github.com/rust-lang/rust/pull/43540 (where it was introduced). One hardcoded warning less. Closes https://github.com/rust-lang/rust/issues/58055 r? @nikomatsakis
2019-03-24Separate variant id and variant constructor id.David Wood-0/+1
This commit makes two changes - separating the `NodeId` that identifies an enum variant from the `NodeId` that identifies the variant's constructor; and no longer creating a `NodeId` for `Struct`-style enum variants and structs. Separation of the variant id and variant constructor id will allow the rest of RFC 2008 to be implemented by lowering the visibility of the variant's constructor without lowering the visbility of the variant itself. No longer creating a `NodeId` for `Struct`-style enum variants and structs mostly simplifies logic as previously this `NodeId` wasn't used. There were various cases where the `NodeId` wouldn't be used unless there was an unit or tuple struct or enum variant but not all uses of this `NodeId` had that condition, by removing this `NodeId`, this must be explicitly dealt with. This change mostly applied cleanly, but there were one or two cases in name resolution and one case in type check where the existing logic required a id for `Struct`-style enum variants and structs.
2019-03-23syntax: Remove warning for unnecessary path disambiguatorsVadim Petrochenkov-1/+1
2019-03-16Refactor away `NestedMetaItemKind`Vadim Petrochenkov-7/+7
Remove methods `Attribute::span` and `MetaItem::span` duplicating public fields
2019-03-16Rename `MetaItem::ident` to `MetaItem::path`Vadim Petrochenkov-1/+1
2019-03-16syntax_ext: Validate `#[proc_macro_derive]` input betterVadim Petrochenkov-2/+2
Tweak some error wording
2019-03-16syntax: Do not accidentally treat multi-segment meta-items as single-segmentVadim Petrochenkov-3/+8
2019-03-06Panic when unmatched delimiters aren't emittedEsteban Küber-1/+1
2019-02-28Auto merge of #57760 - dlrobertson:varargs1, r=alexregbors-1/+1
Support defining C compatible variadic functions ## Summary Add support for defining C compatible variadic functions in unsafe rust with `extern "C"` according to [RFC 2137]. ## Details ### Parsing When parsing a user defined function that is `unsafe` and `extern "C"` allow variadic signatures and inject a "spoofed" `VaList` in the new functions signature. This allows the user to interact with the variadic arguments via a `VaList` instead of manually using `va_start` and `va_end` (See [RFC 2137] for details). ### Codegen When running codegen for a variadic function, remove the "spoofed" `VaList` from the function signature and inject `va_start` when the arg local references are created for the function and `va_end` on return. ## TODO - [x] Get feedback on injecting `va_start/va_end` in MIR vs codegen - [x] Properly inject `va_end` - It seems like it should be possible to inject `va_end` on the `TerminatorKind::Return`. I just need to figure out how to get the `LocalRef` here. - [x] Properly call Rust defined C variadic functions in Rust - The spoofed `VaList` causes problems here. Related to: #44930 r? @ghost [RFC 2137]: https://github.com/rust-lang/rfcs/blob/master/text/2137-variadic.md
2019-02-27Rename variadic to c_variadicDan Robertson-1/+1
Function signatures with the `variadic` member set are actually C-variadic functions. Make this a little more explicit by renaming the `variadic` boolean value, `c_variadic`.
2019-02-27Rollup merge of #58678 - doctorn:refuse-async-fn-2015-edition, r=varkorMazdak Farrokhzad-1/+1
Deny `async fn` in 2015 edition This commit prevents code using `async fn` from being compiled in Rust 2015 edition. Compiling code of the form: ```rust async fn foo() {} ``` Will now result in the error: ``` error[E0670]: `async fn` is not permitted in the 2015 edition --> async.rs:1:1 | 1 | async fn foo() {} | ^^^^^ error: aborting due to error For more information about an error, try `rustc --explain E0670`. ``` This resolves #58652 and also resolves #53714. r? @varkor