Matthias Krüger
9f2c21c11f
Rollup merge of #112518 - chenyukang:yukang-fix-112458, r=davidtwco
...
Detect actual span for getting unexpected token from parsing macros
Fixes #112458
2023-06-27 17:48:44 +02:00
yukang
0220c0b765
Detect actual span for getting unexpected token from parsing macros
2023-06-11 14:36:20 +08:00
yukang
e3071eaa60
reword the message to suggest surrounding with parentheses
2023-06-10 06:28:35 +08:00
yukang
3983881d4e
take care module name for suggesting surround the struct literal in parentheses
2023-06-10 06:28:35 +08:00
Matthias Krüger
97fae38bf9
Rollup merge of #111181 - bvanjoi:fix-issue-111148, r=davidtwco
...
fix(parse): return unpected when current token is EOF
close https://github.com/rust-lang/rust/issues/111148
#111148 panic occurred because [FatalError.raise()](https://github.com/bvanjoi/rust/blob/master/compiler/rustc_parse/src/parser/mod.rs#LL540C3-L540C3 ) was encountered which caused by `Eof` and `Pound`(the last token) had same span, when parsing `#` in `fn a<<i<Y<w<>#`.
<img width="825" alt="image" src="https://user-images.githubusercontent.com/30187863/236612589-9e2c6a0b-18cd-408c-b636-c12a51cbcf1c.png ">
There are a few ways to solve this problem:
- Change the action assign for [self.last_unexpected_token_span](https://github.com/rust-lang/rust/blob/master/compiler/rustc_parse/src/parser/diagnostics.rs#L592 ), for example, if current token is `Eof`, then return Error directly.
- Avoid triggering the `FatalError` when the current token is `Eof`.
I have chosen the second option because executing `expected_one_of_not_found` when the token is `Eof` but not in `ediable` seems reasonable.
2023-05-27 20:40:28 +02:00
yukang
83789b8b06
fmt
2023-05-13 19:40:17 +08:00
yukang
ce6cfc37d0
Fix ice caused by shorthand fields in NoFieldsForFnCall
2023-05-13 18:06:16 +08:00
bohan
272dc5a6d5
fix(parse): return unpected when current token is EOF
2023-05-13 00:33:27 +08:00
Michael Goulet
6e01e910cb
Implement negative bounds
2023-05-02 22:36:24 +00:00
bors
98c33e47a4
Auto merge of #109128 - chenyukang:yukang/remove-type-ascription, r=estebank
...
Remove type ascription from parser and diagnostics
Mostly based on https://github.com/rust-lang/rust/pull/106826
Part of #101728
r? `@estebank`
2023-05-02 09:41:35 +00:00
Nilstrieb
c63b6a437e
Rip it out
...
My type ascription
Oh rip it out
Ah
If you think we live too much then
You can sacrifice diagnostics
Don't mix your garbage
Into my syntax
So many weird hacks keep diagnostics alive
Yet I don't even step outside
So many bad diagnostics keep tyasc alive
Yet tyasc doesn't even bother to survive!
2023-05-01 16:15:13 +08:00
Maybe Waffle
182eee298c
fixup tests wrt new normalization
2023-04-28 11:56:02 +00:00
Ezra Shaw
9dbf20ef27
fix: fix regression in #109203
2023-04-07 08:54:13 +12:00
Pietro Albini
64af509377
remove invalid ignore-pretty
2023-04-03 09:24:11 +02:00
Ezra Shaw
05b5046633
feat: implement error recovery in expected_ident_found
2023-03-20 20:54:41 +13:00
Ezra Shaw
b4e17a5098
refactor: improve "ident starts with number" error
2023-03-19 20:24:06 +13:00
clubby789
dd7df04e16
Remove uses of box_syntax
in rustc and tools
2023-03-12 13:19:46 +00:00
Ezra Shaw
252e0b3385
feat/refactor: improve errors in case of ident with number at start
2023-03-09 21:29:32 +13:00
Lukas Markeffsky
a435b3c0cd
add test for https://github.com/rust-lang/rust/issues/108242
2023-03-05 14:23:43 +01:00
yukang
a641229916
Add testcase for issue 105209
2023-03-01 13:28:12 +00:00
yukang
94a200b6a9
Fix #104367 , add test case for mismatched open/close delims
2023-03-01 13:14:30 +00:00
yukang
65ad5f8de7
remove duplicated diagnostic for unclosed delimiter
2023-02-28 07:57:17 +00:00
yukang
f01d0c02e7
Exit when there are unmatched delims to avoid noisy diagnostics
2023-02-28 07:55:19 +00:00
Matthias Krüger
743ca67edf
Rollup merge of #107602 - estebank:anon-enum-access, r=compiler-errors
...
Parse and recover from type ascription in patterns
Reintroduce part of #106960 , which was reverted in #107478 .
r? `@compiler-errors`
2023-02-03 06:30:24 +01:00
Esteban Küber
0ba687a95e
Parse and recover from type ascription in patterns
2023-02-02 17:18:48 +00:00
Matthias Krüger
8f47954742
Rollup merge of #106919 - compiler-errors:underscore-typo-in-field-pat, r=jackh726
...
Recover `_` as `..` in field pattern
2023-02-02 17:14:05 +01:00
Michael Goulet
9dd5d3e8e4
Recover _ as .. in field pattern
2023-02-02 06:10:02 +00:00
Michael Goulet
e4b2936983
Revert "Teach parser to understand fake anonymous enum syntax" and related commits
...
Revert "review comment: Remove AST AnonTy"
This reverts commit 020cca8d36cb678e3ddc2ead41364be314d19e93.
Revert "Ensure macros are not affected"
This reverts commit 12d18e403139eeeeb339e8611b2bed4910864edb.
Revert "Emit fewer errors on patterns with possible type ascription"
This reverts commit c847a01a3b1f620c4fdb98c75805033e768975d1.
Revert "Teach parser to understand fake anonymous enum syntax"
This reverts commit 2d824206655bfb26cb5eed43490ee396542b153e.
2023-02-02 05:54:35 +00:00
Esteban Küber
62ba3e70a1
Modify primary span label for E0308
...
The previous output was unintuitive to users.
2023-01-30 20:12:19 +00:00
bors
bca8b4dc32
Auto merge of #107408 - matthiaskrgr:rollup-b5vz2ow, r=matthiaskrgr
...
Rollup of 9 pull requests
Successful merges:
- #104012 (Improve unexpected close and mismatch delimiter hint in TokenTreesReader)
- #104252 (Stabilize the const_socketaddr feature)
- #105524 (Replace libc::{type} with crate::ffi::{type})
- #107096 (Detect references to non-existant messages in Fluent resources)
- #107355 (Add regression test for #60755 )
- #107384 (Remove `BOOL_TY_FOR_UNIT_TESTING`)
- #107385 (Use `FallibleTypeFolder` for `ConstInferUnifier` not `TypeRelation`)
- #107391 (rustdoc: remove inline javascript from copy-path button)
- #107398 (Remove `ControlFlow::{BREAK, CONTINUE}`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-28 13:12:59 +00:00
Matthias Krüger
e3048c7838
Rollup merge of #104012 - chenyukang:yukang/fix-103882-deli-indentation, r=petrochenkov
...
Improve unexpected close and mismatch delimiter hint in TokenTreesReader
Fixes #103882
Fixes #68987
Fixes #69259
The inner indentation mismatching will be covered by outer block, the new added function `report_error_prone_delim_block` will find out the error prone candidates for reporting.
2023-01-28 11:11:05 +01:00
bors
d8da513668
Auto merge of #106916 - lukas-code:overlapping-substs, r=estebank
...
Remove overlapping parts of multipart suggestions
This PR adds a debug assertion that the parts of a single substitution cannot overlap, fixes a overlapping substitution from the testsuite, and fixes https://github.com/rust-lang/rust/issues/106870 .
Note that a single suggestion can still have multiple overlapping substitutions / possible edits, we just don't suggest overlapping replacements in a single edit anymore.
I've also included a fix for an unrelated bug where rustfix for `explicit_outlives_requirements` would produce multiple trailing commas for a where clause.
2023-01-28 10:00:56 +00:00
yukang
cd233231aa
Improve unexpected close and mismatch delimiter hint in TokenTreesReader
2023-01-27 17:45:41 +08:00
yukang
c4d00d710c
add testcase for #104012
2023-01-26 10:52:57 +08:00
Lukas Markeffsky
31443c63b5
preserve delim spans during macro_rules!
expansion if able
2023-01-20 20:16:37 +01:00
Esteban Küber
c847a01a3b
Emit fewer errors on patterns with possible type ascription
2023-01-17 01:58:37 +00:00
Esteban Küber
2d82420665
Teach parser to understand fake anonymous enum syntax
...
Parse `-> Ty | OtherTy`.
Parse type ascription in top level patterns.
2023-01-17 01:58:32 +00:00
Matthias Krüger
8e0eecdba6
Rollup merge of #106566 - clubby789:contiguous-weird-unicode, r=cjgillot
...
Emit a single error for contiguous sequences of unknown tokens
Closes #106101
On encountering a sequence of identical source characters which are unknown tokens, note the amount of subsequent characters and advance past them silently. The old behavior was to emit an error and 'help' note for every single one.
`@rustbot` label +A-diagnostics +A-parser
2023-01-14 13:04:24 +01:00
clubby789
a3d6bc3468
Emit a single error for contiguous sequences of Unicode homoglyphs
2023-01-12 00:15:32 +00:00
León Orell Valerian Liehr
70ddde76df
parser: recover from where clauses placed before tuple struct bodies
2023-01-11 17:54:48 +01:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests
2023-01-11 09:32:08 +00:00