about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
AgeCommit message (Collapse)AuthorLines
2019-07-28Adjust and document 'Pat::to_ty' accordingly.Mazdak Farrokhzad-4/+11
2019-07-28Adjust 'ast::PatKind::{TupleStruct,Tuple,Slice}'.Mazdak Farrokhzad-19/+9
2019-07-28Introduce 'ast::Pat::is_rest(&self) -> bool'.Mazdak Farrokhzad-0/+8
2019-07-28Add 'ast::PatKind::Rest'.Mazdak Farrokhzad-0/+15
2019-07-27Lint attributes on function argumentsCaio-0/+2
2019-07-23cleanup: Remove `extern crate serialize as rustc_serialize`sVadim Petrochenkov-5/+4
2019-07-19Adjust other names after the `Mark` renamingVadim Petrochenkov-3/+3
2019-07-19libsyntax: Remove `Mark` into `ExpnId`Vadim Petrochenkov-4/+4
2019-07-15pprust: Use `print_mac_common` for delimited token groupsVadim Petrochenkov-1/+11
2019-07-10Move lifetime_to_string to Display implMark Rousskov-1/+7
2019-06-26Fix clippy::redundant_field_namesIgor Matuszewski-2/+2
2019-06-24Auto merge of #62075 - Centril:guardless-match-arms, r=petrochenkovbors-6/+1
Remove `ast::Guard` With the introduction of `ast::ExprKind::Let` in https://github.com/rust-lang/rust/pull/60861, the `ast::Guard` structure is now redundant in terms of representing [`if let` guards](https://github.com/rust-lang/rust/issues/51114) in AST since it can be represented by `ExprKind::Let` syntactically. Therefore, we remove `ast::Guard` here. However, we keep `hir::Guard` because the semantic representation is a different matter and this story is more unclear right now (might involve `goto 'arm` in HIR or something...). r? @petrochenkov
2019-06-23Remove redundant syntax::ast::Guard.Mazdak Farrokhzad-6/+1
2019-06-23let_chains: More accurately describe `ast::ExprKind::Let`.Mazdak Farrokhzad-1/+1
Co-Authored-By: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2019-06-23let_chains: scrutinee -> conditionMazdak Farrokhzad-1/+1
2019-06-23let_chains: Improve documentation for ast::ExprKind::Let(..).Mazdak Farrokhzad-1/+4
2019-06-23let_chains: Remove ast::ExprKind::{IfLet, WhileLet} and introduce ::Let.Mazdak Farrokhzad-15/+5
2019-06-18Remove the HirId/NodeId from where clausesMatthew Jasper-2/+0
Also give them a span in the HIR
2019-06-14Change `...` to `..=` where applicableAaron Kutch-1/+1
2019-06-09Allow attributes in formal function parametersCaio-1/+3
2019-06-07syntax: Treat error literals in more principled wayVadim Petrochenkov-3/+3
2019-06-05Implemented for function bounds, type bounds, and named existential types.Alexander Regueiro-7/+21
2019-06-05Aggregation of drive-by cosmetic changes.Alexander Regueiro-2/+2
2019-06-03syntax: revert `ast::AsyncArgument` and associated changes.Eduard-Mihai Burtescu-49/+6
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-27Add `to_symbol` methods.Nicholas Nethercote-1/+23
2019-05-24Remove `ObsoleteInPlace`varkor-3/+0
2019-05-23syntax: Turn `token::Lit` into a structVadim Petrochenkov-2/+0
2019-05-23Auto merge of #60174 - matthewjasper:add-match-arm-scopes, r=pnkfelixbors-0/+1
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-22Simplify use of keyword symbolsVadim Petrochenkov-6/+6
2019-05-22Auto merge of #59445 - alexreg:ban-multi-trait-objects-via-aliases, r=oli-obkbors-2/+2
Ban multi-trait objects via trait aliases Obviously, multi-trait objects are not normally supported, so they should not be supported via trait aliases. This has been factored out from the previous PR https://github.com/rust-lang/rust/pull/55994 (see point 1). r? @Centril CC @nikomatsakis ------------------ ### RELNOTES: We now allow `dyn Send + fmt::Debug` with equivalent semantics to `dyn fmt::Debug + Send`. That is, the order of the mentioned traits does not matter wrt. principal/not-principal traits. This is a small change that might deserve a mention in the blog post because it is a language change but most likely not. See https://github.com/rust-lang/rust/blob/ce2ee305f9165c037ecddddb5792588a15ff6c37/src/test/ui/traits/wf-trait-object-reverse-order.rs. // @Centril
2019-05-21Give match arms an HirId and a SpanMatthew Jasper-0/+1
2019-05-21Auto merge of #60903 - nnethercote:mv-gensyms-from-Symbol-to-Ident, ↵bors-5/+1
r=petrochenkov Move gensym operations from `Symbol` to `Ident` Gensyms are always at the `Ident` level, and long-term we probably want to record gensym-ness in hygiene data. r? @petrochenkov
2019-05-20Ban multi-trait objects via trait aliases.Alexander Regueiro-2/+2
2019-05-20Move `is_gensymed` from `Symbol` to `Ident`.Nicholas Nethercote-5/+1
Note that the `is_gensymed` call on `primitive_types` is unnecessary because that table only contains the name of primitive types (e.g. `i32`) and never contains gensyms.
2019-05-19Improve type size assertionsVadim Petrochenkov-2/+2
Now they - Tell what the new size is, when it changes - Do not require passing an identifier
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-6/+0
And also the equality between `Path` and strings, because `Path` is made up of `Symbol`s.
2019-05-11Address comments + Fix testsVadim Petrochenkov-2/+7
2019-05-11Introduce `hir::Lit` not keeping the original tokenVadim Petrochenkov-1/+1
2019-05-11Keep the original token in `ast::Lit`Vadim Petrochenkov-0/+3
2019-05-11Turn `ast::Lit` into a structVadim Petrochenkov-1/+5
2019-05-07Implement built-in await syntaxTaylor Cramer-0/+13
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-4/+8
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-27Document ast::ExprKind::Type.Mazdak Farrokhzad-0/+1
2019-04-23Rollup merge of #59823 - davidtwco:issue-54716, r=cramertjMazdak Farrokhzad-6/+45
[wg-async-await] Drop `async fn` arguments in async block Fixes #54716. This PR modifies the HIR lowering (and some other places to make this work) so that unused arguments to a async function are always dropped inside the async move block and not at the end of the function body. ``` async fn foo(<pattern>: <type>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>) { async move { let <pattern>: <ty> = __arg0; } // <-- dropped as you "exit" the async block } ``` However, the exact ordering of drops is not the same as a regular function, [as visible in this playground example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=be39af1a58e5d430be1eb3c722cb1ec3) - I believe this to be an unrelated issue. There is a [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/187312-t-compiler.2Fwg-async-await/topic/.2354716.20drop.20order) for this. r? @cramertj cc @nikomatsakis
2019-04-21Introduce `ArgSource` for diagnostics.David Wood-0/+11
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-6/+23
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-21AST/HIR: Use `Mutability` instead of bool in foreign staticsVadim Petrochenkov-3/+2
2019-04-21Introduce `LocalSource` into the AST.David Wood-0/+11
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-15Ensure the symbols are pure stringsJohn Kåre Alsaker-1/+7
2019-04-15Use a proc macro to declare preallocated symbolsJohn Kåre Alsaker-0/+6