Esteban Küber
7190bc3097
Account for incorrect impl Foo<const N: ty> {}
syntax
...
Fix #84946
2021-11-24 20:02:09 +00:00
bors
de4b242e1e
Auto merge of #91149 - notriddle:notriddle/rustdoc-doctest-semicolon, r=jyn514
...
fix(doctest): detect extern crate items in statement doctests
This partially reverts #91026 , because rustdoc needs to detect the extern statements, even when they appear inside implicit `main()`. It does not entirely revert it, so the old bug is still fixed, by duplicating some of the logic from `parse_mod` instead of trying to use it directly.
Fixes #91134
2021-11-23 23:48:55 +00:00
Esteban Kuber
d68add9ecc
review comment: plural of emoji is emoji
2021-11-23 20:36:19 +00:00
Esteban Kuber
21224e6ee0
Account for confusable codepoints when recovering emoji identifiers
2021-11-23 20:36:19 +00:00
Esteban Kuber
5a68abb094
Tokenize emoji as if they were valid indentifiers
...
In the lexer, consider emojis to be valid identifiers and reject
them later to avoid knock down parse errors.
2021-11-23 20:35:07 +00:00
Michael Howell
bff1645bdb
fix(doctest): detect extern crate items in statement doctests
...
This partially reverts #91026 , because rustdoc needs to detect the extern statements,
even when they appear inside implicit `main()`. It does not entirely revert it,
so the old bug is still fixed, by duplicating some of the logic from `parse_mod`
instead of trying to use it directly.
Fixes #91134
2021-11-22 19:47:58 -07:00
Gary Guo
6d61d87b22
Split inline const to two feature gates
2021-11-22 22:17:03 +00:00
Matthias Krüger
3d4f3ee71d
Rollup merge of #90994 - Badel2:issue-90993, r=estebank
...
Fix ICE `#90993`: add missing call to cancel
Fix #90993
2021-11-20 22:33:49 +01:00
threadexception
5f6059d9a2
Fix float ICE
...
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-11-20 16:41:36 +01:00
Badel2
77a105c91f
Fix ICE #90993
: add missing call to cancel
2021-11-20 14:32:25 +01:00
5225225
09e59c2875
Inline printable function
2021-11-16 08:06:31 +00:00
5225225
52199c93bb
Suggest removing the non-printing characters
2021-11-16 08:06:30 +00:00
5225225
de05d3ec31
Print full char literal on error if any are non-printing
2021-11-16 08:06:30 +00:00
Vadim Petrochenkov
6655727041
rustc_feature: Convert BuiltinAttribute
from tuple to a struct
2021-11-12 20:15:14 +08:00
Vadim Petrochenkov
2834f57c45
ast: Fix naming conventions in AST structures
...
TraitKind -> Trait
TyAliasKind -> TyAlias
ImplKind -> Impl
FnKind -> Fn
All `*Kind`s in AST are supposed to be enums.
Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order.
Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.
2021-11-07 21:38:17 +08:00
Hans Kratz
e339e4789f
Remove now unused feature from rustc_parse
2021-11-04 23:40:59 +01:00
Hans Kratz
7885233df0
Optimize literal, doc comment lint as well, extract function.
2021-11-04 23:31:42 +01:00
Hans Kratz
a5b25a2cfa
Create subslice as that leads to a smaller code size.
2021-11-04 17:03:13 +01:00
Hans Kratz
2d9f0e2c50
Optimize bidi character detection.
2021-11-04 12:01:26 +01:00
Pietro Albini
cdd3b8624f
fix formatting
2021-11-01 10:39:43 +01:00
Esteban Küber
c0b134582a
Lint against RTL unicode codepoints in literals and comments
...
Address CVE-2021-42574.
2021-10-31 13:14:04 +01:00
Yuki Okushi
8738d5d611
Rollup merge of #89257 - aDotInTheVoid:macro-error-2, r=estebank
...
Give better error for `macro_rules name`
follow up to #89221
r? ``@estebank``
``@rustbot`` modify labels: +A-diagnostics +A-parser
2021-10-22 19:42:43 +09:00
Hirochika Matsumoto
a72dd4a5b9
Explain why Self
is invalid in generic parameters
2021-10-19 23:00:18 +09:00
Matthias Krüger
2fd765c1d9
Rollup merge of #89990 - petrochenkov:idempty, r=wesleywiser
...
rustc_span: `Ident::invalid` -> `Ident::empty`
The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s as well.
2021-10-18 08:13:30 +02:00
Matthias Krüger
5898c5d88e
Rollup merge of #89974 - est31:let_else_if_error, r=nagisa
...
Nicer error message if the user attempts to do let...else if
Gives a nice "conditional `else if` is not supported for `let...else`" error when encountering a `let...else if` pattern, as suggested in the [let...else tracking issue](https://github.com/rust-lang/rust/issues/87335#issuecomment-944846205 ).
2021-10-18 08:13:27 +02:00
est31
856541963c
Nicer error message if the user attempts to do let...else if
2021-10-17 22:56:29 +02:00
Vadim Petrochenkov
a6808335d4
rustc_span: Ident::invalid
-> Ident::empty
...
The equivalent for `Symbol`s was renamed some time ago (`kw::Invalid` -> `kw::Empty`), and it makes sense to do the same thing for `Ident`s.
2021-10-17 23:20:30 +03:00
r00ster91
3c1d55422a
Some "parenthesis" and "parentheses" fixes
2021-10-17 12:04:01 +02:00
Matthias Krüger
ff6601e0fc
some clippy::perf fixes
2021-10-07 22:31:33 +02:00
Fabian Wolff
079c075f24
Use TokenKind::similar_tokens()
2021-10-04 22:13:00 +02:00
Fabian Wolff
cf19131cb3
Try to recover from a =>
-> =
or ->
typo in a match arm
2021-10-03 14:14:35 +02:00
Nixon Enraght-Moony
729ff2d006
Give better error for macro_rules name
2021-10-01 22:47:39 +01:00
Manish Goregaokar
1708219940
Rollup merge of #89029 - notriddle:notriddle/issue-89013, r=estebank
...
feat(rustc_parse): recover from pre-RFC-2000 const generics syntax
Fixes #89013
2021-10-01 09:18:17 -07:00
Michael Howell
befdfb5c71
Improve error messages for bad type constraints
...
Co-authored-by: Esteban Kuber <esteban@kuber.com.ar>
2021-09-28 13:02:45 -07:00
Eric Huss
75f058dbfd
Check for macros in built-in attributes that don't support them.
2021-09-25 09:03:15 -07:00
Eric Huss
5f8c571e50
Move malformed attribute code to a function and fix inner attribute suggestion.
...
Moving to a dedicated function in preparation for other validation.
The suggestion given didn't consider if it was an inner attribute.
2021-09-25 08:11:10 -07:00
Jubilee
6f31fa58fd
Rollup merge of #89221 - aDotInTheVoid:macro-error-1, r=estebank
...
Give better error for `macro_rules! name!`
r? ``@estebank``
``@rustbot`` modify labels: +A-diagnostics +A-parser
2021-09-24 11:40:17 -07:00
Nixon Enraght-Moony
ed3b751799
Give better error for macro_rules! name!
2021-09-24 16:21:34 +01:00
bors
a0648eab36
Auto merge of #88835 - FabianWolff:issue-88770, r=petrochenkov
...
Fix error recovery in format macro parsing
Fixes #88770 . Basically, the assumption in the following comment is incorrect:
b69fe57261/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()`](b69fe57261/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()`:
b69fe57261/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-24 11:54:29 +00:00
Jubilee
5da2f460b3
Rollup merge of #89023 - Wardenfar:issue-85066, r=nagisa
...
Resolve issue : Somewhat confusing error with extended_key_value_attributes
Fixes #85066
2021-09-23 17:31:42 -07:00
the8472
5948a7b407
Rollup merge of #89046 - oli-obk:fix_oflo, r=estebank
...
"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-22 19:03:22 +02:00
the8472
c2cdba42b9
Rollup merge of #88795 - FabianWolff:issue-88684, r=wesleywiser
...
Print a note if a character literal contains a variation selector
Fixes #88684 .
2021-09-21 22:53:58 +02:00
Oli Scherer
4281380717
Add some more tracing
2021-09-20 15:24:47 +00:00
Hirochika Matsumoto
21eff8f050
Suggest replacing braces for brackets on array-esque invalid block expr
...
Newcomers may write `{1, 2, 3}` for making arrays, and the current error
message is not informative enough to quickly convince them what is
needed to fix the error.
This PR implements a diagnostic for this case, and its output looks like
this:
```text
error: this code is interpreted as a block expression, not an array
--> src/lib.rs:1:22
|
1 | const FOO: [u8; 3] = {
| ______________________^
2 | | 1, 2, 3
3 | | };
| |_^
|
= note: to define an array, one would use square brackets instead of curly braces
help: try using [] instead of {}
|
1 | const FOO: [u8; 3] = [
2 | 1, 2, 3
3 | ];
|
```
Fix #87672
2021-09-19 20:01:23 +09:00
Theo
250a3e482f
Resolve issue 85066
...
Fix : use struct_dummy
Fix different os messages
2021-09-19 10:53:49 +02:00
Guillaume Gomez
1b7896716e
Rollup merge of #87566 - JohnTitor:find-eqeq-on-assoc-type-bounds, r=estebank
...
Recover invalid assoc type bounds using `==`
Fix #87493
r? `@estebank`
2021-09-17 17:41:14 +02:00
Yuki Okushi
ee99bb3939
Apply review comments
2021-09-17 14:10:41 +09:00
Yuki Okushi
9342be5538
Recover invalid assoc type bounds using ==
2021-09-17 14:02:00 +09:00
Yuki Okushi
e9bf73cb2b
Use multipart_suggestion
2021-09-17 13:39:26 +09:00
Yuki Okushi
58765d61ee
Emit clearer diagnostics for parens around for
loop heads
2021-09-17 13:14:23 +09:00