about summary refs log tree commit diff
path: root/src/test/ui/parser
AgeCommit message (Collapse)AuthorLines
2021-11-25When recovering from a `:` in a pattern, use adequate AST patternEsteban Küber-28/+63
2021-11-25Move some tests to more reasonable directoriesCaio-648/+0
2021-11-25Auto merge of #88781 - estebank:emoji-idents, r=oli-obkbors-0/+99
Tokenize emoji as if they were valid identifiers In the lexer, consider emojis to be valid identifiers and reject them later to avoid knock down parse errors. Partially address #86102.
2021-11-24Tweak span and add more testsEsteban Kuber-4/+38
2021-11-24Account for incorrect `impl Foo<const N: ty> {}` syntaxEsteban Küber-0/+28
Fix #84946
2021-11-23Sort `FxHashSet`'s contents before emitting errors for consistent outputEsteban Kuber-20/+20
2021-11-23review comment: plural of emoji is emojiEsteban Kuber-12/+12
2021-11-23Account for confusable codepoints when recovering emoji identifiersEsteban Kuber-4/+16
2021-11-23fix fmtEsteban Kuber-1/+0
2021-11-23Replace ZWJ with nothing in terminal outputEsteban Kuber-2/+2
2021-11-23Tokenize emoji as if they were valid indentifiersEsteban Kuber-0/+88
In the lexer, consider emojis to be valid identifiers and reject them later to avoid knock down parse errors.
2021-11-21Auto merge of #89580 - estebank:trait-bounds-are-tricky, r=nagisabors-5/+0
Point at source of trait bound obligations in more places Be more thorough in using `ItemObligation` and `BindingObligation` when evaluating obligations so that we can point at trait bounds that introduced unfulfilled obligations. We no longer incorrectly point at unrelated trait bounds (`substs-ppaux.verbose.stderr`). In particular, we now point at trait bounds on method calls. We no longer point at "obvious" obligation sources (we no longer have a note pointing at `Trait` saying "required by a bound in `Trait`", like in `associated-types-no-suitable-supertrait*`). We no longer point at associated items (`ImplObligation`), as they didn't add any user actionable information, they just added noise. Address part of #89418.
2021-11-20Rollup merge of #90994 - Badel2:issue-90993, r=estebankMatthias Krüger-0/+37
Fix ICE `#90993`: add missing call to cancel Fix #90993
2021-11-20Do not mention associated items when they introduce an obligationEsteban Kuber-5/+0
2021-11-20Fix float ICEthreadexception-0/+26
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-11-20Move parser tests to parser/issues subdirectoryBadel2-0/+0
Because the parser directory has already reached the 1000 file limit.
2021-11-20Fix ICE `#90993`: add missing call to cancelBadel2-0/+37
2021-11-20Rollup merge of #91021 - compiler-errors:print_future_output, r=estebankMatthias Krüger-2/+2
Elaborate `Future::Output` when printing opaque `impl Future` type I would love to see the `Output =` type when printing type errors involving opaque `impl Future`. [Test code](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a800b481edd31575fbcaf5771a9c3678) Before (cut relevant part of output): ``` note: while checking the return type of the `async fn` --> /home/michael/test.rs:5:19 | 5 | async fn bar() -> usize { | ^^^^^ checked the `Output` of this `async fn`, found opaque type = note: expected type `usize` found opaque type `impl Future` ``` After: ``` note: while checking the return type of the `async fn` --> /home/michael/test.rs:5:19 | 5 | async fn bar() -> usize { | ^^^^^ checked the `Output` of this `async fn`, found opaque type = note: expected type `usize` found opaque type `impl Future<Output = usize>` ``` Note the "found opaque type `impl Future<Output = usize>`" in the new output. ---- Questions: 1. We skip printing the output type when it's a projection, since I have been seeing some types like `impl Future<Output = <[static generator@/home/michael/test.rs:2:11: 2:21] as Generator<ResumeTy>>::Return>` which are not particularly helpful and leak implementation detail. * Am I able to normalize this type within `rustc_middle::ty::print::pretty`? Alternatively, can we normalize it when creating the diagnostic? Otherwise, I'm fine with skipping it and falling back to the old output. * Should I suppress any other types? I didn't encounter anything other than this generator projection type. 2. Not sure what the formatting of this should be. Do I include spaces in `Output = `?
2021-11-18Print output ty for opaque future tyMichael Goulet-2/+2
2021-11-18Move some tests to more reasonable directoriesCaio-0/+87
2021-11-16Remove debug output from test stderr5225225-1/+0
2021-11-16Suggest removing the non-printing characters5225225-8/+8
2021-11-16Print full char literal on error if any are non-printing5225225-0/+27
2021-11-14Move some tests to more reasonable directoriesCaio-29/+146
2021-11-06Move some tests to more reasonable directoriesCaio-0/+368
2021-10-31Lint against RTL unicode codepoints in literals and commentsEsteban Küber-0/+231
Address CVE-2021-42574.
2021-10-27test: add test for inner attribute followed by outer attribute causing ICEEliseZeroTwo-0/+46
2021-10-17Rollup merge of #89963 - r00ster91:parenthesisparentheses, r=nagisaMatthias Krüger-3/+3
Some "parenthesis" and "parentheses" fixes "Parenthesis" is the singular (e.g. one `(` or one `)`) and "parentheses" is the plural (multiple `(` or `)`s) and this is not hard to mix up so here are some fixes for that. Inspired by #89958
2021-10-17Some "parenthesis" and "parentheses" fixesr00ster91-3/+3
2021-10-15Bless testsCameron Steffen-27/+27
2021-10-14Revert "Stabilize `arbitrary_enum_discriminant`"Mark Rousskov-0/+59
This reverts commit 7a62f29f3171767090949778ce0f161e930706b9.
2021-10-06Add regression test for ice 89574Gary Guo-4/+37
2021-10-04Rollup merge of #89487 - FabianWolff:issue-89396, r=petrochenkovJubilee-0/+52
Try to recover from a `=>` -> `=` or `->` typo in a match arm Fixes #89396.
2021-10-04Rollup merge of #89453 - waywardmonkeys:consistent-supertrait-usage, r=nagisaJubilee-5/+5
Consistently use 'supertrait'. A subset of places referred to 'super-trait', so this changes them to all use 'supertrait'. This matches 'supertype' and some other usages. An exception is 'auto-trait' which is consistently used in that manner.
2021-10-03Try to recover from a `=>` -> `=` or `->` typo in a match armFabian Wolff-0/+52
2021-10-02Consistently use 'supertrait'.Bruce Mitchener-5/+5
A subset of places referred to 'super-trait', so this changes them to all use 'supertrait'. This matches 'supertype' and some other usages. An exception is 'auto-trait' which is consistently used in that manner.
2021-10-01Improve error message for missing angle brackets in `[_]::method`Fabian Wolff-0/+15
2021-09-26Remove box syntax from most places in src/test outside of the issues direst31-2/+1
2021-09-24Auto merge of #88835 - FabianWolff:issue-88770, r=petrochenkovbors-0/+77
Fix error recovery in format macro parsing Fixes #88770. Basically, the assumption in the following comment is incorrect: https://github.com/rust-lang/rust/blob/b69fe57261086e70aea9d5b58819a1794bf7c121/compiler/rustc_builtin_macros/src/format.rs#L167-L172 This is only true in the first iteration of the loop, when [`p.clear_expected_tokens()`](https://github.com/rust-lang/rust/blob/b69fe57261086e70aea9d5b58819a1794bf7c121/compiler/rustc_builtin_macros/src/format.rs#L164) is called. In subsequent iterations, `p.expected_tokens` won't be empty, so `p.expect()` won't actually call `unexpected_try_recover()`: https://github.com/rust-lang/rust/blob/b69fe57261086e70aea9d5b58819a1794bf7c121/compiler/rustc_parse/src/parser/mod.rs#L487-L498 Instead, it will call `expect_one_of()`, which _can_ recover and return `Ok()`. This PR handles this case to fix the ICE in #88770.
2021-09-22Rollup merge of #89046 - oli-obk:fix_oflo, r=estebankthe8472-1/+1
"Fix" an overflow in byte position math r? `@estebank` help! I fixed the ICE only to brick the diagnostic. I mean, it was wrong previously (using an already expanded macro span), but it is really bad now XD
2021-09-21Rollup merge of #88795 - FabianWolff:issue-88684, r=wesleywiserthe8472-0/+90
Print a note if a character literal contains a variation selector Fixes #88684.
2021-09-20Avoid the overflow with rustc+debugassertions in issue-44406Oli Scherer-1/+1
2021-09-17Use `multipart_suggestion`Yuki Okushi-3/+7
2021-09-17Emit clearer diagnostics for parens around `for` loop headsYuki Okushi-5/+4
2021-09-16Rollup merge of #88729 - estebank:struct-literal-using-parens, r=oli-obkManish Goregaokar-16/+29
Recover from `Foo(a: 1, b: 2)` Detect likely `struct` literal using parentheses as delimiters and emit targeted suggestion instead of type ascription parse error. Fix #61326.
2021-09-15Rollup merge of #88775 - pnkfelix:revert-anon-union-parsing, r=davidtwcoManish Goregaokar-0/+15
Revert anon union parsing Revert PR #84571 and #85515, which implemented anonymous union parsing in a manner that broke the context-sensitivity for the `union` keyword and thus broke stable Rust code. Fix #88583.
2021-09-15Rollup merge of #88690 - m-ou-se:macro-braces-dot-question-expr-parse, r=nagisaManish Goregaokar-0/+11
Accept `m!{ .. }.method()` and `m!{ .. }?` statements. This PR fixes something that I keep running into when using `quote!{}.into()` in a proc macro to convert the `proc_macro2::TokenStream` to a `proc_macro::TokenStream`: Before: ``` error: expected expression, found `.` --> src/lib.rs:6:6 | 4 | quote! { 5 | ... 6 | }.into() | ^ expected expression ``` After: ``` ``` (No output, compiles fine.) --- Context: For expressions like `{ 1 }` and `if true { 1 } else { 2 }`, we accept them as full statements without a trailing `;`, which means the following is not accepted: ```rust { 1 } - 1 // error ``` since that is parsed as two statements: `{ 1 }` and `-1`. Syntactically correct, but the type of `{ 1 }` should be `()` as there is no `;`. However, for specifically `.` and `?` after the `}`, we do [continue parsing it as an expression](https://github.com/rust-lang/rust/blob/13db8440bbbe42870bc828d4ec3e965b38670277/compiler/rustc_parse/src/parser/expr.rs#L864-L876): ```rust { "abc" }.len(); // ok ``` For braced macro invocations, we do not do this: ```rust vec![1, 2, 3].len(); // ok vec!{1, 2, 3}.len(); // error ``` (It parses `vec!{1, 2, 3}` as a full statement, and then complains about `.len()` not being a valid expression.) This PR changes this to also look for a `.` and `?` after a braced macro invocation. We can be sure the macro is an expression and not a full statement in those cases, since no statement can start with a `.` or `?`.
2021-09-14Auto merge of #88914 - GuillaumeGomez:rollup-h5svc6w, r=GuillaumeGomezbors-0/+28
Rollup of 7 pull requests Successful merges: - #88033 (Add links for primitives in "jump to definition" feature) - #88722 (Make `UnsafeCell::get_mut` const) - #88851 (Fix duplicate bounds for const_trait_impl) - #88859 (interpreter PointerArithmetic: use new Size helper methods) - #88885 (Fix jump def background) - #88894 (Improve error message for missing trait in trait impl) - #88896 (Reduce possibility of flaky tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-09-13Auto merge of #87915 - estebank:fancy-spans, r=oli-obkbors-12/+12
Use smaller spans for some structured suggestions Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts
2021-09-13Add negative test in macro-braces-dot-question.rs.Mara Bos-0/+2