toidiu
731f4efae5
stabalize infer outlives requirements (RFC 2093).
...
Co-authored-by: nikomatsakis
2018-09-11 11:40:04 -04:00
Vadim Petrochenkov
62c7d78a9a
resolve: Remove unshadowable_attrs
2018-09-10 04:04:51 +03:00
John Renner
0593dc7e3c
Move #[test_case] to a syntax extension
2018-09-04 22:33:23 -07:00
John Renner
08ea5b7c78
Fix #[test] shadowing in macro_prelude
2018-09-04 22:33:10 -07:00
John Renner
9b27de41d4
Introduce Custom Test Frameworks
2018-09-04 22:33:00 -07: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
Niko Matsakis
73fb1622b3
check that adding infer-outlives requirement to all crates works
2018-08-24 17:10:50 -04:00
Igor Gutorov
4d81fe9243
Use optimized SmallVec implementation
2018-08-23 10:45:53 +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
Donato Sciarra
82607d2cf3
mv (mod) codemap source_map
2018-08-19 23:01:00 +02:00
Matthias Krüger
71120ef1e5
Fix typos found by codespell.
2018-08-19 17:41:28 +02:00
Eduard-Mihai Burtescu
83268ff494
syntax_ext: remove leftover span_err_if_not_stage0 macro.
2018-08-16 02:10:54 +03:00
ljedrz
e5e6375352
Move SmallVec and ThinVec out of libsyntax
2018-08-13 22:11:57 +02:00
Guillaume Gomez
3e9a1a1b82
Rollup merge of #53230 - memoryruins:nll_bootstrap_4, r=nikomatsakis
...
[nll] enable feature(nll) on various crates for bootstrap: part 4
#53172
r? @nikomatsakis
2018-08-12 23:26:56 +02:00
memoryruins
ce5b9c662f
[nll] libsyntax_ext: remove unnecessary mut annotation on variable
...
Pointed out by nll. It is correct that the mut annotation is not needed.
2018-08-09 15:32:23 -04:00
memoryruins
2cb91dad9f
[nll] libsyntax_ext: enable feature(nll) for bootstrap
2018-08-09 15:28:39 -04:00
kennytm
762855d23a
Rollup merge of #53215 - ljedrz:refactor_format, r=estebank
...
Slightly refactor syntax_ext/format
expand_preparsed_format_args:
- move a potential error `return` earlier in the processing
- pre-allocate some of the required space for `cx.pieces` and `cx.str_pieces`
- create `cx`-independent objects before `cx`
- build `pieces` and `errs` using `collect` instead of a `push` loop
describe_num_args:
- return `Cow<str>` instead of `String`
2018-08-10 01:03:45 +08:00
kennytm
c6f55bca7f
Rollup merge of #52773 - ljedrz:unncecessary_patterns, r=nikomatsakis
...
Avoid unnecessary pattern matching against Option and Result
2018-08-09 16:58:39 +08: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
ljedrz
44d32d4413
Avoid unnecessary pattern matching against Option and Result
2018-08-07 10:24:27 +02:00
Esteban Küber
cce4ea5149
Point at correct span when missing comma in println
2018-08-06 20:54:51 -07:00
Pietro Albini
a8ed6033a6
Rollup merge of #52888 - estebank:shell-sugg, r=oli-obk
...
Use suggestions for shell format arguments
Follow up to #52649 .
2018-08-01 10:13:02 +02:00
Esteban Küber
75ff0ddb43
Use suggestions for shell format arguments
2018-07-31 14:16:36 -07:00
bors
866a713258
Auto merge of #52738 - ljedrz:push_to_extend, r=eddyb
...
Replace push loops with extend() where possible
Or set the vector capacity where I couldn't do it.
According to my [simple benchmark](https://gist.github.com/ljedrz/568e97621b749849684c1da71c27dceb ) `extend`ing a vector can be over **10 times** faster than `push`ing to it in a loop:
10 elements (6.1 times faster):
```
test bench_extension ... bench: 75 ns/iter (+/- 23)
test bench_push_loop ... bench: 458 ns/iter (+/- 142)
```
100 elements (11.12 times faster):
```
test bench_extension ... bench: 87 ns/iter (+/- 26)
test bench_push_loop ... bench: 968 ns/iter (+/- 3,528)
```
1000 elements (11.04 times faster):
```
test bench_extension ... bench: 311 ns/iter (+/- 9)
test bench_push_loop ... bench: 3,436 ns/iter (+/- 233)
```
Seems like a good idea to use `extend` as much as possible.
2018-07-29 21:37:47 +00:00
ljedrz
59c8a279da
Replace push loops with collect() and extend() where possible
2018-07-29 18:53:22 +02:00
bors
023fd7e74a
Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkov
...
Prefer to_string() to format!()
Simple benchmarks suggest in some cases it can be faster by even 37%:
```
test converting_f64_long ... bench: 339 ns/iter (+/- 199)
test converting_f64_short ... bench: 136 ns/iter (+/- 34)
test converting_i32_long ... bench: 87 ns/iter (+/- 16)
test converting_i32_short ... bench: 87 ns/iter (+/- 49)
test converting_str ... bench: 54 ns/iter (+/- 15)
test formatting_f64_long ... bench: 349 ns/iter (+/- 176)
test formatting_f64_short ... bench: 145 ns/iter (+/- 14)
test formatting_i32_long ... bench: 98 ns/iter (+/- 14)
test formatting_i32_short ... bench: 93 ns/iter (+/- 15)
test formatting_str ... bench: 86 ns/iter (+/- 23)
```
2018-07-29 09:33:37 +00:00
bors
4f1e235744
Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrum
...
Rollup of bare_trait_objects PRs
All deny attributes were moved into bootstrap so they can be disabled with a line of config.
Warnings for external tools are allowed and it's up to the tool's maintainer to keep it warnings free.
r? @Mark-Simulacrum
cc @ljedrz @kennytm
2018-07-27 20:27:40 +00:00
ljedrz
57a5a9b054
Prefer to_string() to format!()
2018-07-27 11:11:18 +02:00
Mark Rousskov
2aec4e882c
Rollup merge of #52649 - estebank:fmt-span, r=oli-obk
...
Point spans to inner elements of format strings
- Point at missing positional specifiers in string literal
```
error: invalid reference to positional arguments 3, 4 and 5 (there are 3 arguments)
--> $DIR/ifmt-bad-arg.rs:34:38
|
LL | format!("{name} {value} {} {} {} {} {} {}", 0, name=1, value=2);
| ^^ ^^ ^^
|
= note: positional arguments are zero-based
```
- Point at named formatting specifier in string literal
```
error: there is no argument named `foo`
--> $DIR/ifmt-bad-arg.rs:37:17
|
LL | format!("{} {foo} {} {bar} {}", 1, 2, 3);
| ^^^^^
```
- Update label for formatting string in "multiple unused formatting arguments" to be more correct
```
error: multiple unused formatting arguments
--> $DIR/ifmt-bad-arg.rs:42:17
|
LL | format!("", 1, 2); //~ ERROR: multiple unused formatting arguments
| -- ^ ^
| |
| multiple missing formatting specifiers
```
- When using `printf` string formatting, provide a structured suggestion instead of a note
```
error: multiple unused formatting arguments
--> $DIR/format-foreign.rs:12:30
|
LL | println!("%.*3$s %s!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments
| -------------- ^^^^^^^^ ^^^^^^^ ^
| |
| multiple missing formatting specifiers
|
= note: printf formatting not supported; see the documentation for `std::fmt`
help: format specifiers in Rust are written using `{}`
|
LL | println!("{:.2$} {}!/n", "Hello,", "World", 4); //~ ERROR multiple unused formatting arguments
| ^^^^^^ ^^
```
2018-07-26 09:18:30 -06:00
Esteban Küber
9a893cc2b8
Add span label for format str missing specifier
2018-07-24 20:46:22 -07:00
Esteban Küber
7bd94e0738
Rename method and remove commented out code
2018-07-24 20:37:38 -07:00
Esteban Küber
3298b9f8c7
Fix unittest
2018-07-24 18:44:34 -07:00
Tatsuyuki Ishi
e098985939
Deny bare_trait_objects globally
2018-07-25 10:25:29 +09:00
Esteban Küber
4d8aa5989c
Use suggestions for printf format
2018-07-24 16:01:38 -07:00
Mark Rousskov
c7a178ea5f
Rollup merge of #52658 - Wallacoloo:topics/use-option-methods, r=cramertj
...
Prefer `Option::map`/etc over `match` wherever it improves clarity
This isn't intended to change behavior anywhere. A lot of times statements like `match x { None => None, Some(y) => [...] }` can be rewritten using `Option::map` or `Option::and_then` in a way that preserves or improves clarity, so that's what I've done here.
I think it's particularly valuable to keep things in `libcore` and `libstd` pretty/idiomatic since it's not uncommon to follow the `[src]` links when browsing the rust-lang.org docs for std/core. If there's any concern about pushing style-based changes though, I'll happily back out the non-std/core commits here.
2018-07-24 16:43:49 -06:00
Esteban Küber
f9e37625e6
Reword missing formatting arguments label
2018-07-24 09:51:04 -07:00
Colin Wallace
cbe5f1c420
libsyntax_ext: Prefer Option::map over match where applicable
2018-07-23 22:06:45 -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
ljedrz
fe588d894f
Replace a few expect+format combos with unwrap_or_else+panic
2018-07-23 14:47:13 +02: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