Matthias Krüger
e992895c1d
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
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
Michael Goulet
2cc7782cfd
Add suggestion for bad block fragment error
2023-06-23 19:18:20 +00:00
Michael Goulet
9ef580fa6f
Handle interpolated literal errors
2023-06-15 01:55:37 +00:00
许杰友 Jieyou Xu (Joe)
72421bfb0c
Fix debug ICE for extern type with where clauses
2023-06-12 15:15:45 +08:00
yukang
0220c0b765
Detect actual span for getting unexpected token from parsing macros
2023-06-11 14:36:20 +08:00
Matthias Krüger
46b64aaef0
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
6336da9a75
Use a better link
2023-06-10 14:46:11 -04:00
Hankai Zhang
e5fccf927d
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
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
许杰友 Jieyou Xu (Joe)
2a7c6a99ef
Fix suggestion for matching struct with ..
on both ends
2023-06-03 15:02:13 +08:00
许杰友 Jieyou Xu (Joe)
41f5a30690
Recover upon encountering mistyped Const
in const param def
2023-05-28 16:55:21 +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
Nilstrieb
87a0cd9a41
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
f65281534f
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
a5763ff8d3
Recover impl<T ?Sized>
correctly
2023-05-15 17:14:59 +00: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
bohan
7c1bc0353b
refactor(resolve): clean up the early error return caused by non-call
2023-05-10 22:35:01 +08:00
Dylan DPC
dbd090c655
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
6b76588222
suggest struct when we get colon in fileds in enum
2023-05-08 14:58:09 +08:00
est31
83b4df4e61
Add feature gate
2023-05-05 21:44:48 +02:00
est31
59ecbd2cea
Add parsing for builtin # in expression and item context
2023-05-05 21:44:13 +02:00
Zachary Mayhew
a183ac6f90
add hint for =< as <=
2023-05-05 11:17:14 -04: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
Dylan DPC
b727132e23
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
0fe1ff2137
sync with master
2023-05-01 16:15:17 +08:00
yukang
f54489978d
fix tests
2023-05-01 16:15:17 +08:00
yukang
f44ebf7e54
fix test cases
2023-05-01 16:15:17 +08: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
clubby789
1ce9d7254e
Migrate trivially translatable rustc_parse
diagnostics
2023-04-27 01:53:06 +01:00
bors
d37e2f74af
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
9fadcc143a
Special-case item attributes in the suggestion output
2023-04-12 22:50:10 +00:00
Esteban Küber
5b40aa5eb4
Tweak output for 'add line' suggestion
2023-04-12 22:50:10 +00:00
Matthias Krüger
57393be6fb
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 e3f9db5fc3
.
This reverts commit 98b82aedba
.
This reverts commit 380fa26413
.
2023-04-12 22:04:35 +02:00
Yuki Okushi
788de4701e
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
a047064d6b
Revert "Don't recover lifetimes/labels containing emojis as character literals"
...
Reverts PR #108031
Fixes (doesnt close until beta backported) #109746
This reverts commit e3f9db5fc3
.
This reverts commit 98b82aedba
.
This reverts commit 380fa26413
.
2023-04-10 06:52:41 +00:00
Michael Goulet
d5b1ef1c3f
Use smart-resolve when checking for trait in RHS of UFCS
2023-04-07 05:33:52 +00:00
Ezra Shaw
9dbf20ef27
fix: fix regression in #109203
2023-04-07 08:54:13 +12:00
Tam Pham
4e5c120f33
Update ui tests involving invalid visibility qualifiers
2023-04-03 22:28:55 -05: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
bors
669e751639
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
8b186dfdb7
Add recovery for use of removed box
syntax
2023-03-12 13:26:37 +00:00
clubby789
0932452fa4
Remove box_syntax
from AST and use in tools
2023-03-12 13:19:46 +00:00