Takayuki Maeda
77d6176e69
remove unnecessary to_string and String::new
2022-06-13 15:48:40 +09:00
Jacob Pratt
49c82f31a8
Remove crate visibility usage in compiler
2022-05-20 20:04:54 -04:00
David Wood
73fa217bc1
errors: span_suggestion takes impl ToString
...
Change `span_suggestion` (and variants) to take `impl ToString` rather
than `String` for the suggested code, as this simplifies the
requirements on the diagnostic derive.
Signed-off-by: David Wood <david.wood@huawei.com >
2022-04-29 02:05:20 +01:00
Vadim Petrochenkov
2733ec1be3
rustc_ast: Harmonize delimiter naming with proc_macro::Delimiter
2022-04-28 10:04:29 +03:00
Ellen
f697955c1e
tut tut tut
2022-04-27 08:51:33 +01:00
Dylan DPC
946d76ec0e
Rollup merge of #95859 - rainy-me:unterminated-nested-block-comment, r=petrochenkov
...
Improve diagnostics for unterminated nested block comment
close #95283
(This is my first time try to messing around with rust compiler and might get a lot of things wrong... 🙇 )
2022-04-16 07:12:44 +02:00
rainy-me
1b7008dc77
refactor: change to use peekable
2022-04-14 21:18:27 +09:00
Matthias Krüger
7c2d57e0fa
couple of clippy::complexity fixes
2022-04-13 22:51:34 +02:00
rainy-me
4a0f8d5175
improve diagnostics for unterminated nested block comment
2022-04-14 03:22:02 +09:00
Dylan DPC
86388f6171
Rollup merge of #95251 - GrishaVar:hashes-u16-to-u8, r=dtolnay
...
Reduce max hash in raw strings from u16 to u8
[Relevant discussion](https://rust-lang.zulipchat.com/#narrow/stream/237824-t-lang.2Fdoc/topic/Max.20raw.20string.20delimiters )
2022-03-31 00:26:31 +02:00
Grisha Vartanyan
759d1e6af8
Update error message & remove outdated test comment
2022-03-30 18:20:30 +02:00
Michael Goulet
928388bad2
Make fatal DiagnosticBuilder yield never
2022-03-27 22:25:32 -07:00
mark
bb8d4307eb
rustc_error: make ErrorReported impossible to construct
...
There are a few places were we have to construct it, though, and a few
places that are more invasive to change. To do this, we create a
constructor with a long obvious name.
2022-03-16 10:35:24 -05:00
mark
e489a94dee
rename ErrorReported -> ErrorGuaranteed
2022-03-02 09:45:25 -06:00
Caio
e3e902bb06
4 - Make more use of let_chains
...
Continuation of #94376 .
cc #53667
2022-02-28 07:49:56 -03:00
Eduard-Mihai Burtescu
b7e95dee65
rustc_errors: let DiagnosticBuilder::emit return a "guarantee of emission".
2022-02-23 06:38:52 +00:00
Eduard-Mihai Burtescu
02ff9e0aef
Replace &mut DiagnosticBuilder, in signatures, with &mut Diagnostic.
2022-02-23 05:38:19 +00:00
est31
2ef8af6619
Adopt let else in more places
2022-02-19 17:27:43 +01:00
Matthias Krüger
637d8b89e8
Rollup merge of #94011 - est31:let_else, r=lcnr
...
Even more let_else adoptions
Continuation of #89933 , #91018 , #91481 , #93046 , #93590 .
2022-02-17 23:00:59 +01:00
est31
60f969a4f2
Adopt let_else in even more places
2022-02-16 22:43:39 +01:00
Erin Petra Sofiya Moon
e59cda9ee1
suggest using raw string literals when invalid escapes appear
...
i'd guess about 70% of "bad escape" cases occur when someone meant to
use a raw string literal because they're passing it directly to
Regex::new(). this emits an advisory (Applicability::MaybeIncorrect)
help: suggestion to the user that they use an r"" string,
on top of the normal notes about looking at the
string literal documentation/spec.
2022-02-14 15:11:38 -05: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
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
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
Fabian Wolff
0d8245b5b1
Improve diagnostics if a character literal contains combining marks
2021-09-10 19:23:37 +02:00
Anton Golov
a03fbfe2ff
Warn when an escaped newline skips multiple lines
2021-08-11 11:35:08 +02:00
Cameron Steffen
4380056397
Rollup merge of #87659 - FabianWolff:issue-87397, r=davidtwco
...
Fix invalid suggestions for non-ASCII characters in byte constants
Fixes #87397 .
2021-08-02 09:36:51 -05:00
bors
4e282795d7
Auto merge of #87662 - FabianWolff:rb-string, r=estebank
...
Suggest `br` if the unknown string prefix `rb` is found
Currently, for the following code:
```rust
fn main() {
rb"abc";
}
```
we issue the following suggestion:
```
help: consider inserting whitespace here
|
2 | rb "abc";
| --
```
With my changes (only in edition 2021, where unknown prefixes became an error), I get:
```
help: use `br` for a raw byte string
|
2 | br"abc";
| ^^
```
2021-07-31 20:20:18 +00:00
Fabian Wolff
f2c9654dcd
Suggest br if the unknown string prefix rb is found
2021-07-31 15:37:36 +02:00
Fabian Wolff
c1abb6f4d6
Fix invalid suggestions for non-ASCII characters in byte constants
2021-07-31 15:21:11 +02:00
Anton Golov
5d59b4412e
Add warning when whitespace is not skipped after an escaped newline.
2021-07-30 16:26:39 +02:00
Ryan Levick
d4e384bc1d
rename rust_2021_token_prefixes to rust_2021_prefixes_incompatible_syntax
2021-07-06 20:13:36 +02:00
Ryan Levick
81c11a212e
rust_2021_token_prefixes
2021-07-06 20:13:16 +02:00
Ryan Levick
6c87772e3c
Rename reserved_prefix lint to reserved_prefixes
2021-07-06 20:12:55 +02:00
Mara Bos
7490305e13
No reserved_prefix suggestion in proc macro call_site.
2021-06-26 23:11:14 +08:00
Mara Bos
0eeeebc990
Rename 'bad prefix' to 'unknown prefix'.
2021-06-26 23:11:14 +08:00
Mara Bos
d40be0fc64
Check the span's edition for the reserved prefixes.
2021-06-26 23:11:13 +08:00
Mara Bos
6adce70a58
Improve comments for reserved prefixes.
...
Co-authored-by: Niko Matsakis <niko@alum.mit.edu >
2021-06-26 23:11:13 +08:00
Mara Bos
d837c00d10
Add migration lint for reserved prefixes.
2021-06-26 23:11:04 +08:00
Mara Bos
ce43fc9404
Fix note in reserved prefix error.
2021-06-26 23:09:43 +08:00
Mara Bos
c856e6fa53
Add machine applicable suggestion to unknown prefix error.
2021-06-26 23:09:43 +08:00
lrh2000
8dee9bc8fc
Reserve prefixed identifiers and string literals (RFC 3101)
...
This commit denies any identifiers immediately followed by
one of three tokens `"`, `'` or `#`, which is stricter than
the requirements of RFC 3101 but may be necessary according
to the discussion at [Zulip].
[Zulip]: https://rust-lang.zulipchat.com/#narrow/stream/268952-edition-2021/topic/reserved.20prefixes/near/238470099
2021-06-26 23:09:43 +08:00