about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
AgeCommit message (Collapse)AuthorLines
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
2019-01-31Add suggestion for duplicated import.David Wood-0/+7
This commit adds a suggestion when a import is duplicated (ie. the same name is used twice trying to import the same thing) to remove the second import.
2019-01-24Rollup merge of #57817 - davidtwco:issue-54521, r=estebankMazdak Farrokhzad-0/+14
Add error for trailing angle brackets. Fixes #54521. This PR adds a error (and accompanying machine applicable suggestion) for trailing angle brackets on function calls with a turbofish. r? @estebank
2019-01-22Corrected spelling inconsistencyMarcel Hellwig-4/+4
resolves #57773
2019-01-21Add error for trailing angle brackets.David Wood-0/+14
This commit adds a error (and accompanying machine applicable suggestion) for trailing angle brackets on function calls with a turbofish.
2019-01-21Rollup merge of #57768 - estebank:type-args-sugg, r=zackmdavisMazdak Farrokhzad-0/+10
Continue parsing after parent type args and suggest using angle brackets ``` error[E0214]: parenthesized parameters may only be used with a trait --> $DIR/E0214.rs:2:15 | LL | let v: Vec(&str) = vec!["foo"]; | ^^^^^^ | | | only traits may use parentheses | help: use angle brackets instead: `<&str>` ``` r? @zackmdavis
2019-01-20Auto merge of #57651 - JohnTitor:give-char-type, r=estebankbors-0/+3
Implement new literal type `Err` Fixes #57384 I removed `return Ok`, otherwise, two errors occur. Any solutions? r? @estebank
2019-01-20Mark incorrect recovered `char` literals as `TyErr` to avoid type errorsYuki Okushi-0/+3
2019-01-19Accept parenthesized type args for error recoveryEsteban Küber-0/+10
2019-01-19Rollup merge of #57486 - nnethercote:simplify-TokenStream-more, r=petrochenkovMazdak Farrokhzad-4/+4
Simplify `TokenStream` some more These commits simplify `TokenStream`, remove `ThinTokenStream`, and avoid some clones. The end result is simpler code and a slight perf win on some benchmarks. r? @petrochenkov
2019-01-15Add PartialEqYuki Okushi-2/+2
2019-01-14Remove `ThinTokenStream`.Nicholas Nethercote-4/+4
`TokenStream` is now almost identical to `ThinTokenStream`. This commit removes the latter, replacing it with the former.
2018-12-27Get rid of `Block::recovered`Vadim Petrochenkov-1/+0
2018-12-27AST/HIR: Introduce `ExprKind::Err` for better error recovery in the front-endVadim Petrochenkov-0/+4
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-10Remove `tokenstream::Delimited`.Nicholas Nethercote-1/+1
Because it's an extra type layer that doesn't really help; in a couple of places it actively gets in the way, and overall removing it makes the code nicer. It does, however, move `tokenstream::TokenTree` further away from the `TokenTree` in `quote.rs`. More importantly, this change reduces the size of `TokenStream` from 48 bytes to 40 bytes on x86-64, which is enough to slightly reduce instruction counts on numerous benchmarks, the best by 1.5%. Note that `open_tt` and `close_tt` have gone from being methods on `Delimited` to associated methods of `TokenTree`.
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-188/+187
2018-12-04Address review commentsVadim Petrochenkov-12/+1
2018-12-04syntax: Rename some keywordsVadim Petrochenkov-5/+5
`CrateRoot` -> `PathRoot`, `::` doesn't necessarily mean crate root now `SelfValue` -> `SelfLower`, `SelfType` -> `SelfUpper`, both `self` and `Self` can be used in type and value namespaces now
2018-11-15Rollup merge of #55750 - oli-obk:node_id_x, r=michaelwoeristerPietro Albini-37/+18
Make `NodeId` and `HirLocalId` `newtype_index`
2018-11-13Move two `static_assert!`s to better spots.Nicholas Nethercote-0/+1
And make them x86_64-only so they can use `==` instead of `<=`.
2018-11-13Add a static assertion about the size of `ast::Expr`.Nicholas Nethercote-0/+5
2018-11-12Reintroduce the original debug formatting for NodeIdsOliver Scherer-0/+1
2018-11-12Make `NodeId` a `newtype_index` to enable niche optimizationsOliver Scherer-37/+17
2018-11-08Use `Lit` rather than `P<Lit>` in `ast::ExprKind`.Nicholas Nethercote-1/+1
Because it results in fewer allocations and small speedups on some benchmarks.
2018-11-03Added support for trait aliases as object types.Alexander Regueiro-3/+3
2018-10-26Auto merge of #54929 - csmoe:cfg_lint, r=petrochenkovbors-0/+8
Suggest to remove prefix `b` in cfg attribute lint string Closes #54926 r? @estebank
2018-10-26more reviewer changesNick Cameron-5/+1
2018-10-26Store a resolved def on hir::PathSegmentNick Cameron-1/+1
2018-10-26Give each PathSegment a NodeIdNick Cameron-2/+8
2018-10-20suggest to remove prefix `b` in lint stringcsmoe-0/+8
2018-09-27Auto merge of #52319 - tinco:issue_12590, r=pnkfelixbors-0/+2
Track whether module declarations are inline (fixes #12590) To track whether module declarations are inline I added a field `inline: bool` to `ast::Mod`. The main use case is for pretty to know whether it should render the items associated with the module, but perhaps there are use cases for this information to not be forgotten in the AST.
2018-09-22fix typo in commentAlex Stokes-123/+193
2018-09-10Track whether module declarations are inline (fixes #12590)Tinco Andringa-0/+2
2018-09-04Introduce Custom Test FrameworksJohn Renner-1/+1