about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
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
2019-02-27Rollup merge of #58075 - asettouf:master, r=varkorMazdak Farrokhzad-6/+12
Fix for issue #58050 Hi, a quick PR to mention in the compiler error message that `?` is a macro operator, as according to issue #58050 It passed `python x.py test src/tools/tidy` locally, as well as the recommendation to run `/x.py test src/test/ui --stage 1 --bless`. Let me know if anything else is needed.
2019-02-26Changing error message to reflect changes with the 2018 editionAdonis-6/+12
Signed-off-by: Adonis <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr Co-Authored-By: asettouf <adonis.settouf@gmail.com> Update src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.stderr Co-Authored-By: asettouf <adonis.settouf@gmail.com> Stabilize split_ascii_whitespace Tracking issue FCP to merge: https://github.com/rust-lang/rust/issues/48656#issuecomment-442372750 fix stabilization order of uniform_paths. hir: add HirId to main Hir nodes Fix `std::os::fortanix_sgx::usercalls::raw::UsercallNrs` Fixes https://github.com/fortanix/rust-sgx/issues/88 Update src/libsyntax/ext/tt/quoted.rs Co-Authored-By: asettouf <adonis.settouf@gmail.com> Revert "Merge remote-tracking branch 'upstream/master'" This reverts commit 751f05bd155e2c55d4177fe8211df634faf3a644, reversing changes made to 545a3e62b0cb473108869a61b271bc589afb49da.
2019-02-24Deny `async fn` in 2015 editionNathan Corbyn-1/+1
Fix style issues and update diagnostic messages Update src/librustc_passes/diagnostics.rs Co-Authored-By: doctorn <me@nathancorbyn.com> Deny nested `async fn` in Rust 2015 edition Deny nested `async fn` in Rust 2015 edition Deny nested `async fn` in Rust 2015 edition
2019-02-23Rollup merge of #58476 - nnethercote:rm-LazyTokenStream, r=petrochenkovMazdak Farrokhzad-18/+20
Remove `LazyTokenStream`. `LazyTokenStream` was added in #40939. Perhaps it was an effective optimization then, but no longer. This PR removes it, making the code both simpler and faster. r? @alexcrichton
2019-02-22Rollup merge of #58589 - matklad:remove-hack, r=petrochenkovMazdak Farrokhzad-4/+2
cleanup macro after 2018 transition We can now use `?`
2019-02-20cleanup macro after 2018 transitionAleksey Kladov-4/+2
We can now use `?`
2019-02-20remove a bit of dead codeAleksey Kladov-6/+0
2019-02-18Avoid a `clone()` in `transcribe()`.Nicholas Nethercote-11/+11
The current code (expensively) clones the value within an `Rc`. This commit changes things so that the `Rc` itself is (cheaply) cloned instead, avoid some allocations. This requires converting a few `Rc` instances to `Lrc`.