Matthias Krüger
1f076fe1d8
Rollup merge of #113999 - Centri3:macro-arm-expand, r=wesleywiser
...
Specify macro is invalid in certain contexts
Adds a note when a macro is used where it really shouldn't be.
Closes #113766
2023-08-04 07:25:45 +02:00
Matthias Krüger
51d1dacdc2
Rollup merge of #114300 - MU001999:fix/turbofish-pat, r=estebank
...
Suggests turbofish in patterns
Fixes #114112
r? ```@estebank```
2023-08-03 17:29:07 +02:00
Mu001999
049c728c60
Suggests turbofish in patterns
2023-08-01 23:30:40 +08:00
bohan
8e32dade71
parser: more friendly hints for handling async move
in the 2015 edition
2023-07-31 11:04:28 +08:00
bors
a04e649c09
Auto merge of #114028 - Centri3:ternary-operator, r=compiler-errors
...
Gracefully handle ternary operator
Fixes #112578
~~May not be the best way to do this as it doesn't check for a single `:`, so it could perhaps appear even when the actual issue is just a missing semicolon. May not be the biggest deal, though?~~
Nevermind, got it working properly now ^^
2023-07-29 16:45:29 +00:00
León Orell Valerian Liehr
afd009a8d8
Parse generic const items
2023-07-28 22:21:33 +02:00
Catherine Flores
16481807f5
Gracefully handle missing ternary operator
2023-07-25 18:27:24 +00:00
Catherine
287db04636
Specify macro is invalid in certain contexts
2023-07-24 00:25:17 -05:00
Michael Goulet
2cc7782cfd
Add suggestion for bad block fragment error
2023-06-23 19:18:20 +00:00
y21
7fe83345ef
improve error for impl<..> impl Trait for Type
2023-05-13 10:51:21 +02:00
Dylan DPC
8c51701b8a
Rollup merge of #111120 - chenyukang:yukang-suggest-let, r=Nilstrieb
...
Suggest let for possible binding with ty
Origin from https://github.com/rust-lang/rust/pull/109128#discussion_r1179866137
r? `@Nilstrieb`
2023-05-09 12:33:46 +05:30
yukang
4d219d0666
move sugg to derive session diagnostic
2023-05-09 11:51:04 +08:00
est31
59ecbd2cea
Add parsing for builtin # in expression and item context
2023-05-05 21:44:13 +02:00
Michael Goulet
6e01e910cb
Implement negative bounds
2023-05-02 22:36:24 +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
clubby789
1ce9d7254e
Migrate trivially translatable rustc_parse
diagnostics
2023-04-27 01:53:06 +01:00
clubby789
0138513635
Fix static string lints
2023-04-25 18:59:55 +01:00
Michael Goulet
24cbf81b85
Remove ..
from return type notation
2023-04-10 22:19:46 +00:00
Michael Goulet
8b592db27a
Add (..)
syntax for RTN
2023-03-28 01:14:28 +00:00
Ezra Shaw
b4e17a5098
refactor: improve "ident starts with number" error
2023-03-19 20:24:06 +13:00
Ezra Shaw
c9ddb73184
refactor: refactor identifier parsing somewhat
2023-03-19 20:20:20 +13:00
clubby789
0932452fa4
Remove box_syntax
from AST and use in 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
y21
0758c05c97
recover from for-else and while-else
2023-03-01 13:26:59 +01:00
David Wood
d1fcf61117
errors: generate typed identifiers in each crate
...
Instead of loading the Fluent resources for every crate in
`rustc_error_messages`, each crate generates typed identifiers for its
own diagnostics and creates a static which are pulled together in the
`rustc_driver` crate and provided to the diagnostic emitter.
Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22 09:15:53 +00:00
Matthias Krüger
3b9543c89d
Rollup merge of #107446 - clubby789:rustc-parse-diag-migrate, r=compiler-errors
...
Migrate some of `rustc_parse` to derive diagnostics
`@rustbot` label +A-translation
r? rust-lang/diagnostics
cc #100717
2023-02-09 11:21:57 +01:00
clubby789
521c5f36d6
Migrate rustc_parse
to derive diagnostics
2023-02-06 14:40:35 +00:00
Dylan DPC
8ddbfadda0
Rollup merge of #107580 - lenko-d:default_value_for_a_lifetime_generic_parameter_produces_confusing_diagnostic, r=compiler-errors
...
Recover from lifetimes with default lifetimes in generic args
Fixes [#107492 ](https://github.com/rust-lang/rust/issues/107492 )
2023-02-06 19:54:14 +05:30
Obei Sideg
7a75278836
Recover from missing expression in for loop
2023-02-05 17:33:10 +03:00
Lenko Donchev
d9f60052d2
Recover from default value for a lifetime in generic parameters.
2023-02-04 17:04:09 -06:00
Matthias Krüger
e9c4e291c4
Rollup merge of #107493 - clubby789:range-fat-arrow-followup, r=estebank
...
Improve diagnostic for missing space in range pattern
Improves the diagnostic in #107425 by turning it into a note explaining the parsing issue.
r? `@compiler-errors`
2023-02-02 17:14:05 +01:00
clubby789
4ab75de934
Improve diagnostic for missing space in range pattern
2023-02-02 13:18:12 +00:00
Michael Goulet
9dd5d3e8e4
Recover _ as .. in field pattern
2023-02-02 06:10:02 +00:00
Xiretza
0d0d369915
Make "use latest edition" subdiagnostic translatable
2023-02-01 21:56:28 +01:00
Xiretza
a476683c84
rustc_parse: revert conversion of "non-item in item list" diagnostic
...
#[derive(Subdiagnostic)] does not allow multiple subdiagnostics on one
variant, as in NonItemInItemListSub::Other.
2023-02-01 21:56:28 +01:00
Xiretza
7631b12e3e
migrate parser::ty to diagnostic structs
2023-02-01 21:56:27 +01:00
Xiretza
87ef37dbd7
rustc_parse: migrate more to diagnostic structs
2023-02-01 21:50:34 +01:00
Edward Shen
e905b93706
Make the "extra if in let...else block" hint a suggestion
2023-01-30 14:09:40 -08:00
clubby789
c5688794e2
Migrate some range parsing diagnostics
2023-01-28 21:57:35 +00:00
Edward Shen
a8b77cfe54
Add suggestion to remove if in let...else block
...
Adds an additional hint to failures where we encounter an else keyword
while we're parsing an if-let block.
This is likely that the user has accidentally mixed if-let and let...else
together.
2023-01-23 20:33:04 -08:00
bors
d4203eda5f
Auto merge of #106537 - fmease:recover-where-clause-before-tuple-struct-body, r=estebank
...
Recover from where clauses placed before tuple struct bodies
Open to any suggestions regarding the phrasing of the diagnostic.
Fixes #100790 .
`@rustbot` label A-diagnostics
r? diagnostics
2023-01-12 02:16:16 +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
Esteban Küber
5311938531
Detect struct literal needing parentheses
...
Fix #82051 .
2023-01-11 16:53:21 +00:00
Michael Goulet
aff403cf68
Recover fn
keyword as Fn
trait in bounds
2022-12-27 06:14:46 +00:00
yukang
b70a869d8f
fix #105366 , suggest impl in the scenario of typo with fn
2022-12-10 11:01:52 +08:00
mejrs
fe212eca76
Match crate and slug names
2022-11-21 15:24:50 +01:00
Matthias Krüger
3efbf30220
Rollup merge of #103405 - chenyukang:yukang/fix-103381-and-if, r=compiler-errors
...
Detect incorrect chaining of if and if let conditions and recover
Fixes #103381
2022-11-18 14:13:36 +01:00
Nicholas Nethercote
358a603f11
Use token::Lit
in ast::ExprKind::Lit
.
...
Instead of `ast::Lit`.
Literal lowering now happens at two different times. Expression literals
are lowered when HIR is crated. Attribute literals are lowered during
parsing.
This commit changes the language very slightly. Some programs that used
to not compile now will compile. This is because some invalid literals
that are removed by `cfg` or attribute macros will no longer trigger
errors. See this comment for more details:
https://github.com/rust-lang/rust/pull/102944#issuecomment-1277476773
2022-11-16 09:41:28 +11:00
yukang
9db8e183dc
fix #104088 , Slightly improve error message for invalid identifier
2022-11-15 08:58:19 +08:00
yukang
74c9a6c6df
fix #103381 , Detect incorrect chaining of if and if let conditions
2022-11-15 08:53:17 +08:00