about summary refs log tree commit diff
path: root/src/libsyntax/mut_visit.rs
AgeCommit message (Collapse)AuthorLines
2019-06-06syntax: Use `Token` in visitors and fix a mut visitor testVadim Petrochenkov-8/+16
2019-06-06syntax: Remove duplicate span from `token::Ident`Vadim Petrochenkov-1/+0
2019-06-06syntax: Remove duplicate span from `token::Lifetime`Vadim Petrochenkov-1/+0
2019-06-06syntax: Use `Token` in `TokenTree::Token`Vadim Petrochenkov-3/+3
2019-06-06syntax: Rename `Token` into `TokenKind`Vadim Petrochenkov-3/+3
2019-06-05Implemented for function bounds, type bounds, and named existential types.Alexander Regueiro-7/+16
2019-06-03syntax: revert `ast::AsyncArgument` and associated changes.Eduard-Mihai Burtescu-39/+3
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-24Remove `ObsoleteInPlace`varkor-4/+0
2019-05-23Auto merge of #60174 - matthewjasper:add-match-arm-scopes, r=pnkfelixbors-1/+5
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-22Eliminate unnecessary `Ident::with_empty_ctxt`sVadim Petrochenkov-2/+1
2019-05-22Simplify use of keyword symbolsVadim Petrochenkov-2/+2
2019-05-21Give match arms an HirId and a SpanMatthew Jasper-1/+5
2019-05-21Move `edition` outside the hygiene lock and avoid accessing itJohn Kåre Alsaker-3/+3
2019-05-12syntax: Remove some legacy nonterminal tokensVadim Petrochenkov-4/+0
2019-05-07Implement built-in await syntaxTaylor Cramer-0/+1
Adds support for .await under the existing async_await feature gate. Moves macro-like await! syntax to the await_macro feature gate. Removes support for `await` as a non-keyword under the `async_await` feature.
2019-05-01Ensure that drop order of `async fn` matches `fn`.David Wood-3/+11
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/+13
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-1/+9
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-1/+9
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-03-24Separate variant id and variant constructor id.David Wood-3/+4
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-17Do not complain about non-existing fields after parse recoveryEsteban Küber-1/+1
When failing to parse struct-like enum variants, the ADT gets recorded as having no fields. Record that we have actually recovered during parsing of this variant to avoid complaing about non-existing fields when actually using it.
2019-03-16Refactor away `NestedMetaItemKind`Vadim Petrochenkov-5/+3
Remove methods `Attribute::span` and `MetaItem::span` duplicating public fields
2019-03-16Rename `MetaItem::ident` to `MetaItem::path`Vadim Petrochenkov-2/+1
2019-02-28Auto merge of #57760 - dlrobertson:varargs1, r=alexregbors-2/+3
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-27Support defining C compatible variadic functionsDan Robertson-1/+2
Add support for defining C compatible variadic functions in unsafe rust with extern "C".
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 #58630 - nnethercote:fix-fold_clobber, r=petrochenkovMazdak Farrokhzad-2/+10
Make `visit_clobber` panic-safe. Local measurements indicate the performance effect is negligible. r? @petrochenkov
2019-02-26Make `visit_clobber` panic-safe.Nicholas Nethercote-2/+10
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-3/+2
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-18Fix style nitsDan Robertson-1/+1
Fix style nits discovered in reading code.
2019-02-18Remove `LazyTokenStream`.Nicholas Nethercote-3/+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-07Add lowering errors for const genericsvarkor-0/+4
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07libsyntax => 2018Taiki Endo-16/+17
2019-02-06Rename `fold.rs` as `mut_visit.rs`.Nicholas Nethercote-0/+1330