Matthias Krüger
0884ef1bf0
Rollup merge of #112978 - compiler-errors:bad-block-sugg, r=davidtwco
...
Add suggestion for bad block fragment error
Makes it a bit clearer how to fix this parser restriction
2023-06-27 17:48:45 +02:00
Matthias Krüger
ed3ac01142
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
Michael Goulet
4582ba67f7
Add suggestion for bad block fragment error
2023-06-23 19:18:20 +00:00
Michael Goulet
be4a646307
Handle interpolated literal errors
2023-06-15 01:55:37 +00:00
许杰友 Jieyou Xu (Joe)
9a22caa159
Fix debug ICE for extern type with where clauses
2023-06-12 15:15:45 +08:00
yukang
9c3f09fc1b
Detect actual span for getting unexpected token from parsing macros
2023-06-11 14:36:20 +08:00
Matthias Krüger
8a48be1399
Rollup merge of #112498 - SamZhang3:rust-reference-link-update, r=Nilstrieb
...
Update links to Rust Reference in diagnostic
Instead of linking to the [old Rust Reference site](https://static.rust-lang.org/doc/master/reference.html#literals ), which is severely outdated (Rust 1.17), link to the [current website](https://doc.rust-lang.org/stable/reference/expressions/literal-expr.html ) in diagnostic about incorrect literals.
2023-06-11 01:57:28 +02:00
Hankai Zhang
4bd5fdac95
Use a better link
2023-06-10 14:46:11 -04:00
Hankai Zhang
5e302f4ed1
Update links to Rust Reference page on literals in diagnostic
...
Instead of linking to the old Rust Reference site on static.rust-lang.org,
link to the current website doc.rust-lang.org/stable/reference instead in
diagnostic about incorrect literals.
2023-06-10 12:34:16 -04:00
yukang
89a45c2dc9
reword the message to suggest surrounding with parentheses
2023-06-10 06:28:35 +08:00
yukang
a0183db10f
take care module name for suggesting surround the struct literal in parentheses
2023-06-10 06:28:35 +08:00
许杰友 Jieyou Xu (Joe)
65bfb7cb95
Fix suggestion for matching struct with .. on both ends
2023-06-03 15:02:13 +08:00
许杰友 Jieyou Xu (Joe)
f2bf54f07f
Recover upon encountering mistyped Const in const param def
2023-05-28 16:55:21 +08:00
Matthias Krüger
c4007b5080
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
Nilstrieb
36f4e74f9b
Rollup merge of #111449 - compiler-errors:recover-impl-generics-correctly, r=Nilstrieb
...
Recover `impl<T ?Sized>` correctly
Fixes #111327
r? ````@Nilstrieb```` but you can re-roll
Alternatively, happy to close this if we're okay with just saying "sorry #111327 is just a poor side-effect of parser ambiguity" 🤷
2023-05-16 11:39:38 +02:00
Nilstrieb
36d6a63950
Rollup merge of #111428 - bvanjoi:fix-109250, r=Nilstrieb
...
refactor(resolve): clean up the early error return caused by non-call
closes https://github.com/rust-lang/rust/issues/109250
It seems no bad happened, r? ``@Nilstrieb``
2023-05-16 11:39:38 +02:00
Michael Goulet
c6e34dbf19
Recover impl<T ?Sized> correctly
2023-05-15 17:14:59 +00:00
yukang
f6570e280f
fmt
2023-05-13 19:40:17 +08:00
yukang
e8a31b1300
Fix ice caused by shorthand fields in NoFieldsForFnCall
2023-05-13 18:06:16 +08:00
bohan
ab667a9ab8
fix(parse): return unpected when current token is EOF
2023-05-13 00:33:27 +08:00
bohan
2f814644c9
refactor(resolve): clean up the early error return caused by non-call
2023-05-10 22:35:01 +08:00
Dylan DPC
29108690cf
Rollup merge of #110694 - est31:builtin, r=petrochenkov
...
Implement builtin # syntax and use it for offset_of!(...)
Add `builtin #` syntax to the parser, as well as a generic infrastructure to support both item and expression position builtin syntaxes. The PR also uses this infrastructure for the implementation of the `offset_of!` macro, added by #106934 .
cc `@petrochenkov` `@DrMeepster`
cc #110680 `builtin #` tracking issue
cc #106655 `offset_of!` tracking issue
2023-05-09 12:33:45 +05:30
yukang
130ae71982
suggest struct when we get colon in fileds in enum
2023-05-08 14:58:09 +08:00
est31
1c8153cac2
Add feature gate
2023-05-05 21:44:48 +02:00
est31
2c70083e1b
Add parsing for builtin # in expression and item context
2023-05-05 21:44:13 +02:00
Zachary Mayhew
965b665718
add hint for =< as <=
2023-05-05 11:17:14 -04:00
Michael Goulet
985d9896de
Implement negative bounds
2023-05-02 22:36:24 +00:00
bors
3bda24b737
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
Dylan DPC
ab40c146ef
Rollup merge of #108161 - WaffleLapkin:const_param_ty, r=BoxyUwU
...
Add `ConstParamTy` trait
This is a bit sketch, but idk.
r? `@BoxyUwU`
Yet to be done:
- [x] ~~Figure out if it's okay to implement `StructuralEq` for primitives / possibly remove their special casing~~ (it should be okay, but maybe not in this PR...)
- [ ] Maybe refactor the code a little bit
- [x] Use a macro to make impls a bit nicer
Future work:
- [ ] Actually™ use the trait when checking if a `const` generic type is allowed
- [ ] _Really_ refactor the surrounding code
- [ ] Refactor `marker.rs` into multiple modules for each "theme" of markers
2023-05-02 11:44:50 +05:30
yukang
ae7a5780dc
sync with master
2023-05-01 16:15:17 +08:00
yukang
5afa27c67b
fix tests
2023-05-01 16:15:17 +08:00
yukang
97945685d7
fix test cases
2023-05-01 16:15:17 +08:00
Nilstrieb
4a65efc7e8
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
5bf07b6084
fixup tests wrt new normalization
2023-04-28 11:56:02 +00:00
clubby789
82544f0f55
Migrate trivially translatable rustc_parse diagnostics
2023-04-27 01:53:06 +01:00
bors
ea20b7dcf1
Auto merge of #109786 - estebank:tweak-add-line-sugg, r=compiler-errors
...
Tweak output for 'add line' suggestion
Closes #108174
2023-04-13 07:02:53 +00:00
Esteban Küber
eb49cb4680
Special-case item attributes in the suggestion output
2023-04-12 22:50:10 +00:00
Esteban Küber
1343237b2d
Tweak output for 'add line' suggestion
2023-04-12 22:50:10 +00:00
Matthias Krüger
009839e04b
Rollup merge of #110135 - compiler-errors:revert-108031, r=davidtwco
...
Revert "Don't recover lifetimes/labels containing emojis as character literals"
Reverts PR #108031 per https://github.com/rust-lang/rust/pull/109754#issuecomment-1490452045
Fixes (doesnt close until beta backported) #109746
This reverts commit 20352b2d30 .
This reverts commit 39758ab015 .
This reverts commit 51aa2a3e2b .
2023-04-12 22:04:35 +02:00
Yuki Okushi
da08f53481
Rollup merge of #109923 - ElectrifyPro:visibility, r=wesleywiser
...
Update `error [E0449]: unnecessary visibility qualifier` to be more clear
This updates the error message `error[E0449]: unnecessary visibility qualifier` by clearly indicating that visibility qualifiers already inherit their visibility from a parent item. The error message previously implied that the qualifiers were permitted, which is not the case anymore.
Resolves #109822 .
2023-04-11 12:18:50 +09:00
Michael Goulet
575b1c6547
Revert "Don't recover lifetimes/labels containing emojis as character literals"
...
Reverts PR #108031
Fixes (doesnt close until beta backported) #109746
This reverts commit 20352b2d30 .
This reverts commit 39758ab015 .
This reverts commit 51aa2a3e2b .
2023-04-10 06:52:41 +00:00
Michael Goulet
408f162228
Use smart-resolve when checking for trait in RHS of UFCS
2023-04-07 05:33:52 +00:00
Ezra Shaw
317b1e4543
fix: fix regression in #109203
2023-04-07 08:54:13 +12:00
Tam Pham
66e029b0d1
Update ui tests involving invalid visibility qualifiers
2023-04-03 22:28:55 -05:00
Pietro Albini
8588a5db13
remove invalid ignore-pretty
2023-04-03 09:24:11 +02:00
Ezra Shaw
e63c992238
feat: implement error recovery in expected_ident_found
2023-03-20 20:54:41 +13:00
Ezra Shaw
8663814ecc
refactor: improve "ident starts with number" error
2023-03-19 20:24:06 +13:00
bors
3025f44e29
Auto merge of #104833 - Swatinem:async-identity-future, r=compiler-errors
...
Remove `identity_future` indirection
This was previously needed because the indirection used to hide some unexplained lifetime errors, which it turned out were related to the `min_choice` algorithm.
Removing the indirection also solves a couple of cycle errors, large moves and makes async blocks support the `#[track_caller]`annotation.
Fixes https://github.com/rust-lang/rust/issues/104826 .
2023-03-14 10:12:58 +00:00
clubby789
780a145328
Add recovery for use of removed box syntax
2023-03-12 13:26:37 +00:00
clubby789
ca91f7d86c
Remove box_syntax from AST and use in tools
2023-03-12 13:19:46 +00:00