about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
AgeCommit message (Collapse)AuthorLines
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
2019-04-05Increase `Span` from 4 bytes to 8 bytes.Nicholas Nethercote-1/+1
This increases the size of some important types, such as `ast::Expr` and `mir::Statement`. However, it drastically reduces how much the interner is used, and the fields are more natural sizes that don't require bit operations to extract. As a result, instruction counts drop across a range of workloads, by as much as 12% for incremental "check" builds of `script-servo`. Peak memory usage goes up a little for some cases, but down by more for some other cases -- as much as 18% for non-incremental builds of `packed-simd`. The commit also: - removes the `repr(packed)`, because it has negligible effect, but can cause undefined behaviour; - replaces explicit impls of common traits (`Copy`, `PartialEq`, etc.) with derived ones.
2019-03-24Remove methods is_struct/is_tuple/is_unit from VariantDataVadim Petrochenkov-27/+0
2019-03-24Separate variant id and variant constructor id.David Wood-14/+19
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-19review commentsEsteban Küber-1/+1
2019-03-17Do not complain about non-existing fields after parse recoveryEsteban Küber-3/+3
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/+2
Remove methods `Attribute::span` and `MetaItem::span` duplicating public fields
2019-03-16Rename `MetaItem::ident` to `MetaItem::path`Vadim Petrochenkov-1/+1
2019-02-28Auto merge of #57760 - dlrobertson:varargs1, r=alexregbors-1/+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-0/+2
Add support for defining C compatible variadic functions in unsafe rust with extern "C".
2019-02-24Deny `async fn` in 2015 editionNathan Corbyn-2/+2
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-18Fix style nitsDan Robertson-0/+7
Fix style nits discovered in reading code.
2019-02-10rustc: doc commentsAlexander Regueiro-15/+14
2019-02-07Fix update to 2018 editionvarkor-1/+1
2019-02-07Add resolution errors for const genericsvarkor-0/+20
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07Add Const kind to ASTvarkor-3/+13
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-02-07libsyntax => 2018Taiki Endo-30/+32