summary refs log tree commit diff
path: root/src/test/ui/parser
AgeCommit message (Collapse)AuthorLines
2021-02-13parser: Fix panic in 'const impl' recoveryÖmer Sinan Ağacan-0/+22
The panic happens when in recovery parsing a full `impl` (`parse_item_impl`) fails and we drop the `DiagnosticBuilder` for the recovery suggestion and return the `parse_item_impl` error. We now raise the original error "expected identifier found `impl`" when parsing the `impl` fails. Note that the regression test is slightly simplified version of the original repro in #81806, to make the error output smaller and more resilient to unrelated changes in parser error messages. Fixes #81806
2021-02-05Rollup merge of #81307 - estebank:invalid-byte-str-span, r=petrochenkovMara Bos-101/+137
Handle `Span`s for byte and raw strings and add more detail CC #81208.
2021-02-03Handle `Span`s for byte and raw strings and add more detailEsteban Küber-101/+137
2021-02-02Add a new ABI to support cmse_nonsecure_callHugues de Valon-1/+1
This commit adds a new ABI to be selected via `extern "C-cmse-nonsecure-call"` on function pointers in order for the compiler to apply the corresponding cmse_nonsecure_call callsite attribute. For Armv8-M targets supporting TrustZone-M, this will perform a non-secure function call by saving, clearing and calling a non-secure function pointer using the BLXNS instruction. See the page on the unstable book for details. Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
2021-01-31Move some tests to more reasonable directoriesCaio-0/+419
2021-01-22add and update testsb-naber-0/+84
2021-01-16Move some tests to more reasonable directories - 2Caio-0/+584
Address comments Update limits
2021-01-13Update code to account for extern ABI requirementMark Rousskov-12/+1
2021-01-13Update tests for extern block lintingMark Rousskov-90/+91
2021-01-12Auto merge of #76580 - rokob:iss76011, r=estebankbors-12/+2
Suggest async {} for async || {} Fixes #76011 This adds support for adding help diagnostics to the feature gating checks and then uses it for the async_closure gate to add the extra bit of help information as described in the issue.
2021-01-08Add a note for `*` and `{}` usage on `use`Yuki Okushi-0/+8
2020-12-31Move parser-related testsYuki Okushi-0/+162
2020-12-30Fix ICE when pointing at multi bytes characterYuki Okushi-0/+64
2020-12-26update testsBastian Kauschke-5/+5
2020-12-25Auto merge of #80296 - ↵bors-12/+5
wesleywiser:revert_missing_fragment_specifier_hard_error, r=Mark-Simulacrum Revert missing fragment specifier hard error Closes #76605 Reopens #40107 r? `@Mark-Simulacrum`
2020-12-25Rollup merge of #80160 - diondokter:move_async_fix, r=davidtwcoDylan DPC-0/+29
Implemented a compiler diagnostic for move async mistake Fixes #79694 First time contributing, so I hope I'm doing everything right. (If not, please correct me!) This code performs a check when a move capture clause is parsed. The check is to detect if the user has reversed the async move keywords and to provide a diagnostic with a suggestion to fix it. Checked code: ```rust fn main() { move async { }; } ``` Previous output: ```txt PS C:\Repos\move_async_test> cargo build Compiling move_async_test v0.1.0 (C:\Repos\move_async_test) error: expected one of `|` or `||`, found keyword `async` --> src\main.rs:2:10 | 2 | move async { }; | ^^^^^ expected one of `|` or `||` error: aborting due to previous error error: could not compile `move_async_test` ``` New output: ```txt PS C:\Repos\move_async_test> cargo +dev build Compiling move_async_test v0.1.0 (C:\Repos\move_async_test) error: the order of `move` and `async` is incorrect --> src\main.rs:2:13 | 2 | let _ = move async { }; | ^^^^^^^^^^ | help: try switching the order | 2 | let _ = async move { }; | ^^^^^^^^^^ error: aborting due to previous error error: could not compile `move_async_test` ``` Is there a file/module where these kind of things are tested? Would love some feedback 😄
2020-12-22Revert "Promote missing_fragment_specifier to hard error"Wesley Wiser-12/+5
This reverts commit 02eae432e7476a0686633a8c2b7cb1d5aab1bd2c.
2020-12-21Implemented a compiler diagnostic for move async mistakeDion Dokter-0/+29
Ran the tidy check Following the diagnostic guide better Diagnostic generation is now relegated to its own function in the diagnostics module. Added tests Fixed the ui test
2020-12-19Auto merge of #77035 - mibac138:fn-fat-arrow-return, r=davidtwcobors-8/+44
Gracefully handle mistyping -> as => in function return type Fixes #77019
2020-12-10Rollup merge of #79851 - camelid:better-error-for-default-fn, r=davidtwcoTyler Mandry-12/+12
Clarify the 'default is only allowed on...' error Code like impl Foo { default fn foo() {} } will trigger the error error: `default` is only allowed on items in `impl` definitions --> src/lib.rs:5:5 | 5 | default fn foo() {} | -------^^^^^^^^^ | | | `default` because of this but that's very confusing! I *did* put it on an item in an impl! So this commit changes the message to error: `default` is only allowed on items in trait impls --> src/lib.rs:5:5 | 5 | default fn foo() {} | -------^^^^^^^^^ | | | `default` because of this
2020-12-09Accept arbitrary expressions in key-value attributes at parse timeVadim Petrochenkov-3/+3
2020-12-08Clarify the 'default is only allowed on...' errorCamelid-12/+12
Code like impl Foo { default fn foo() {} } will trigger the error error: `default` is only allowed on items in `impl` definitions --> src/lib.rs:5:5 | 5 | default fn foo() {} | -------^^^^^^^^^ | | | `default` because of this but that's very confusing! I *did* put it on an item in an impl! So this commit changes the message to error: `default` is only allowed on items in trait impls --> src/lib.rs:5:5 | 5 | default fn foo() {} | -------^^^^^^^^^ | | | `default` because of this
2020-12-04Fix UI tests for 'const expression' changeRyan Levick-3/+3
2020-12-03Gracefully handle confusing -> with : in function return typemibac138-8/+44
2020-11-30Auto merge of #79329 - camelid:int-lit-suffix-error, r=davidtwcobors-9/+9
Update error to reflect that integer literals can have float suffixes For example, `1` is parsed as an integer literal, but it can be turned into a float with the suffix `f32`. Now the error calls them "numeric literals" and notes that you can add a float suffix since they can be either integers or floats.
2020-11-27Update error to reflect that integer literals can have float suffixesCamelid-9/+9
For example, `1` is parsed as an integer literal, but it can be turned into a float with the suffix `f32`. Now the error calls them "numeric literals" and notes that you can add a float suffix since they can be either integers or floats.
2020-11-27Auto merge of #79266 - b-naber:gat_trait_path_parser, r=petrochenkovbors-10/+10
Generic Associated Types in Trait Paths - Ast part The Ast part of https://github.com/rust-lang/rust/pull/78978 r? `@petrochenkov`
2020-11-25add testsb-naber-10/+10
2020-11-25Auto merge of #79336 - camelid:rename-feature-oibit-to-auto, r=oli-obkbors-1/+1
Rename `optin_builtin_traits` to `auto_traits` They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>. r? `@oli-obk` (feel free to re-assign if you're not the right reviewer for this)
2020-11-23Rename `optin_builtin_traits` to `auto_traits`Camelid-1/+1
They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>.
2020-11-22resolve: Do not put macros into `module.unexpanded_invocations` unless necessaryVadim Petrochenkov-6/+6
2020-11-17Fix ui tests for `fn`s with qualifiers in `extern` blocksThePuzzlemaker-21/+42
2020-11-16improve error message for const ty param mismatchBastian Kauschke-4/+0
2020-11-03rustc_ast: `visit_mac` -> `visit_mac_call`Vadim Petrochenkov-1/+1
2020-10-30Rollup merge of #78523 - estebank:fix-return-type-parse-regression, r=dtolnayYuki Okushi-4/+10
Revert invalid `fn` return type parsing change Revert one of the changes in #78379. Fix #78507.
2020-10-29Add regression testEsteban Küber-0/+6
2020-10-29Revert invalid `fn` return type parsing changeEsteban Küber-4/+4
Fix #78507.
2020-10-29Rollup merge of #78460 - varkor:turbofish-string-generic, r=lcnrYuki Okushi-6/+6
Adjust turbofish help message for const generics Types are no longer special. (This message arguably only makes sense with `min_const_generics` or more, but we'll be there soon.) r? @lcnr
2020-10-28Adjust turbofish help message for const genericsvarkor-6/+6
2020-10-28Rollup merge of #78379 - estebank:fn-signature-parse, r=varkorDylan DPC-19/+30
Tweak invalid `fn` header and body parsing * Rely on regular "expected"/"found" parser error for `fn`, fix #77115 * Recover empty `fn` bodies when encountering `}` * Recover trailing `>` in return types * Recover from non-type in array type `[<BAD TOKEN>; LEN]`
2020-10-25Tweak invalid `fn` header and body parsingEsteban Küber-10/+9
* Recover empty `fn` bodies when encountering `}` * Recover trailing `>` in return types * Recover from non-type in array type `[<BAD TOKEN>; LEN]`
2020-10-26Use ? in core/std macrosTaiki Endo-1/+1
2020-10-25Rely on regular "expected"/"found" parser error for `fn`Esteban Küber-13/+25
2020-10-22Bless testsSantiago Pastorino-2/+2
2020-10-17Auto merge of #77124 - spastorino:const-exprs-rfc-2920, r=oli-obkbors-2/+2
Implement const expressions and patterns (RFC 2920) cc `@ecstatic-morse` `@lcnr` `@oli-obk` `@petrochenkov`
2020-10-16Add inline const testsSantiago Pastorino-30/+0
2020-10-16Parse inline const patternsSantiago Pastorino-2/+22
2020-10-16Parse inline const expressionsSantiago Pastorino-0/+10
2020-10-17Suggest minimal subset features in `incomplete_features` lintYuki Okushi-0/+3
2020-10-15fix off-by-one in parameter spansAndy Russell-34/+34