Esteban Küber
7edc434b72
Account for \xFF and \u{FF} sequences in string format errors
2018-12-31 09:44:58 -08:00
Vadim Petrochenkov
df4690ddf4
Improve error recovery for some built-in macros
2018-12-30 01:43:35 +03:00
bors
35a64f8bbf
Auto merge of #57140 - estebank:str-err, r=varkor
...
Tweaks to format string diagnostics
Add label spans and fix incorrect spans.
Fix #55155 , fix #55350 .
2018-12-29 07:28:15 +00:00
Vadim Petrochenkov
15cefe4b2a
Make sure feature gate errors are recoverable
2018-12-27 15:51:37 +03:00
Vadim Petrochenkov
b99fb2f544
Fix trace_macros and log_syntax
2018-12-27 15:51:36 +03:00
Vadim Petrochenkov
fff01ccfa8
Do not abort compilation if expansion produces errors
...
Fix a number of uncovered deficiencies in diagnostics
2018-12-27 15:51:36 +03:00
Esteban Küber
5e952e3479
Add span label to unused string formatting argument
...
Fix #55350 .
2018-12-26 20:36:02 -08:00
Esteban Küber
5e75001c59
Point at correct span for arguments in format strings
...
When a format string has escaped whitespace characters format
arguments were shifted by one per each escaped character. Account
for these escaped characters when synthesizing the spans.
Fix #55155 .
2018-12-26 20:36:02 -08:00
Esteban Küber
862ebc4c38
Various changes to string format diagnostics
...
- Point at opening mismatched formatting brace
- Account for differences between raw and regular strings
- Account for differences between the code snippet and `InternedString`
- Add more tests
2018-12-26 14:29:43 -08:00
Mark Rousskov
2a663555dd
Remove licenses
2018-12-25 21:08:33 -07:00
ljedrz
959313aad0
format: minor stylistic improvements
2018-12-14 14:40:05 +01:00
ljedrz
002310a496
format: refactor verify_arg_type
2018-12-14 12:39:01 +01:00
ljedrz
8866f68a4d
format: refactor report_invalid_references
2018-12-14 11:29:27 +01:00
ljedrz
37a3b7c80e
format: remove unreachable condition
2018-12-14 10:43:10 +01:00
Alexander Regueiro
ee89c088b0
Various minor/cosmetic improvements to code
2018-12-07 23:53:34 +00:00
Vitaly _Vi Shukela
d0790c490a
Whitespace fix again.
2018-09-17 20:26:05 +03:00
Vitaly _Vi Shukela
2b77760944
Fill in suggestions Applicability according to @estebank
...
Also fix some formatting along the way.
2018-09-17 03:20:08 +03:00
Vitaly _Vi Shukela
4b05128114
Attach Applicability to multipart_suggestion and span_suggestions
2018-09-16 21:43:06 +03:00
Eduard-Mihai Burtescu
93f3f5b155
Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.
2018-08-28 17:04:04 +03:00
Guillaume Gomez
4fa4bb5633
Rollup merge of #53504 - ekse:suggestions-applicability-2, r=estebank
...
Set applicability for more suggestions.
Converts a couple more calls to `span_suggestion_with_applicability` (#50723 ). To be on the safe side, I marked suggestions that depend on the intent of the user or that are potentially lossy conversions as MaybeIncorrect.
r? @estebank
2018-08-22 17:45:34 +02:00
kennytm
b5519db323
Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkor
...
Fix typos found by codespell.
2018-08-21 17:51:49 +08:00
Sébastien Duquette
5a23a0d283
Set applicability for more suggestions.
2018-08-20 03:56:06 -04:00
Donato Sciarra
d3fe97f3d3
mv codemap() source_map()
2018-08-19 23:01:01 +02:00
Matthias Krüger
71120ef1e5
Fix typos found by codespell.
2018-08-19 17:41:28 +02:00
ljedrz
aab063a40e
Use Cow<str> in describe_num_args
2018-08-09 09:59:13 +02:00
ljedrz
c7646d54dd
Refactor expand_preparsed_format_args
2018-08-09 08:55:49 +02:00
Esteban Küber
cce4ea5149
Point at correct span when missing comma in println
2018-08-06 20:54:51 -07:00
ljedrz
59c8a279da
Replace push loops with collect() and extend() where possible
2018-07-29 18:53:22 +02:00
Esteban Küber
9a893cc2b8
Add span label for format str missing specifier
2018-07-24 20:46:22 -07:00
Esteban Küber
4d8aa5989c
Use suggestions for printf format
2018-07-24 16:01:38 -07:00
Esteban Küber
f9e37625e6
Reword missing formatting arguments label
2018-07-24 09:51:04 -07:00
Esteban Küber
c55a698943
Only point at inside of string literals if they're actually string literals
2018-07-23 15:41:32 -07:00
Esteban Küber
6bcf8777fe
Point only at invalid positional arguments
2018-07-23 15:09:00 -07:00
Esteban Küber
42306591b9
Point at incorrect named arg in format string
2018-07-23 08:22:20 -07:00
Esteban Küber
38abca8c2d
Point at internal span in format string
2018-07-22 23:09:00 -07:00
Esteban Küber
915ff0b969
fix logic bug
2018-07-21 17:17:49 -07:00
Esteban Küber
93b2bb01a9
Remove dependency on libsyntax
2018-07-21 16:18:06 -07:00
Esteban Küber
00d500052c
Gate format_args_nll behind feature flag
2018-07-21 15:50:46 -07:00
Esteban Küber
83a8af50bb
Suggest space separated format str literal
2018-07-21 12:16:06 -07:00
Esteban Küber
f4306ffbfc
Use correct spans for format string errors
...
When encountering format string errors in a raw string, or regular
string literal with embedded newlines, account for the positional
change to use correct spans.
:drive by fix: 🚗
2018-07-19 23:18:07 -07:00
Esteban Küber
154dee2dcc
rework println
2018-07-19 23:18:07 -07:00
Esteban Küber
f53c145ef1
Improve suggestion for missing fmt str in println
...
Avoid using `concat!(fmt, "\n")` to improve the diagnostics being
emitted when the first `println!()` argument isn't a formatting string
literal.
2018-07-19 23:18:07 -07:00
ljedrz
08c113abef
Deny bare trait objects in src/libsyntax_ext
2018-07-12 11:58:16 +02:00
Vadim Petrochenkov
1e4269cb83
Add Ident::as_str helper
2018-05-26 15:20:23 +03:00
Mark Simulacrum
b3734bd78f
Rollup merge of #50610 - estebank:fmt-str, r=Kimundi
...
Improve format string errors
Point at format string position inside the formatting string:
```
error: invalid format string: unmatched `}` found
--> $DIR/format-string-error.rs:21:22
|
LL | let _ = format!("}");
| ^ unmatched `}` in format string
```
Explain that argument names can't start with an underscore:
```
error: invalid format string: invalid argument name `_foo`
--> $DIR/format-string-error.rs:15:23
|
LL | let _ = format!("{_foo}", _foo = 6usize);
| ^^^^ invalid argument name in format string
|
= note: argument names cannot start with an underscore
```
Fix #23476 .
The more accurate spans will only be seen when using `format!` directly, when using `println!` the diagnostics machinery makes the span be the entire statement.
2018-05-17 13:51:21 -06:00
Irina Popa
b63d7e2b1c
Rename trans to codegen everywhere.
2018-05-17 15:08:30 +03:00
Esteban Küber
3f6b3bbace
Improve format string errors
...
- Point at format string position inside the formatting string
- Explain that argument names can't start with an underscore
2018-05-10 09:09:58 -07:00
James Sanderson
27b0f1e193
Gensym arguments for format macro
2018-04-24 21:31:22 +01:00
Vadim Petrochenkov
43ad972318
Use Span::apply_mark where possible
2018-04-06 11:48:19 +03:00
Lymia Aluysia
fad1648e0f
Initial implementation of RFC 2151, Raw Identifiers
2018-03-18 10:07:19 -05:00