about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-08-05Convert unknown_features lint into an errorvarkor-13/+0
2018-08-05Add duplicity lint for lang featuresvarkor-9/+7
2018-08-05Add lint for unknown feature attributesvarkor-0/+12
2018-08-05Remove unnecessary or invalid feature attributesvarkor-1/+0
2018-08-04Remove in-band lifetimes from the 2018 editionScott McMurray-1/+1
As mentioned in the 2018-08-04 edition status update, these are postponed as lacking consensus to stabilize.
2018-08-03Don't collect() when size_hint is uselessljedrz-1/+5
2018-08-03Extract impl_header_lifetime_elision out of in_band_lifetimesScott McMurray-0/+4
2018-08-02Auto merge of #52841 - petrochenkov:premacro, r=alexcrichtonbors-41/+41
resolve: Implement prelude search for macro paths, implement tool attributes When identifier is macro path is resolved in scopes (i.e. the first path segment - `foo` in `foo::mac!()` or `foo!()`), scopes are searched in the same order as for non-macro paths - items in modules, extern prelude, tool prelude (see later), standard library prelude, language prelude, but with some extra shadowing restrictions (names from globs and macro expansions cannot shadow names from outer scopes). See the comment in `fn resolve_lexical_macro_path_segment` for more details. "Tool prelude" currently contains two "tool modules" `rustfmt` and `clippy`, and is searched immediately after extern prelude. This makes the [possible long-term solution](https://github.com/rust-lang/rfcs/blob/master/text/2103-tool-attributes.md#long-term-solution) for tool attributes exactly equivalent to the existing extern prelude scheme, except that `--extern=my_crate` making crate names available in scope is replaced with something like `--tool=my_tool` making tool names available in scope. The `tool_attributes` feature is still unstable and `#![feature(tool_attributes)]` now implicitly enables `#![feature(use_extern_macros)]`. `use_extern_macros` is a prerequisite for `tool_attributes`, so their stabilization will happen in the same order. If `use_extern_macros` is not enabled, then tool attributes are treated as custom attributes (this is temporary, anyway). Fixes https://github.com/rust-lang/rust/issues/52576 Fixes https://github.com/rust-lang/rust/issues/52512 Fixes https://github.com/rust-lang/rust/issues/51277 cc https://github.com/rust-lang/rust/issues/52269
2018-08-02Auto merge of #52890 - djrenren:test-visibility, r=petrochenkovbors-5/+62
Reexport tests without polluting namespaces This should fix issue #52557. Basically now we gensym a new name for the test function and reexport that. That way the test function's reexport name can't conflict because it was impossible for the test author to write it down. We then use a `use` statement to expose the original name using the original visibility.
2018-08-01Rollup merge of #52954 - cramertj:async-parse, r=petrochenkovPietro Albini-0/+1
async can begin expressions Fix https://github.com/rust-lang/rust/issues/52951 r? @petrochenkov
2018-08-01Use the correct allowJohn Renner-3/+3
2018-08-01Allow test imports to go unusedJohn Renner-1/+15
2018-08-01async can begin expressionsTaylor Cramer-0/+1
2018-08-01Split out growth functionality into BitVector typeMark Rousskov-2/+2
2018-08-01Switch syntax attribute tracking to BitVectorMark Rousskov-33/+23
2018-08-01resolve: Implement prelude search for macro pathsVadim Petrochenkov-41/+41
resolve/expansion: Implement tool attributes
2018-08-01Rollup merge of #52842 - toidiu:ak-commentUpdate, r=estebankPietro Albini-1/+1
update comment r? @joshtriplett Addressing comment: https://github.com/rust-lang/rust/pull/52761#pullrequestreview-141323066
2018-07-31Address code reviewJohn Renner-5/+10
2018-07-31Allow unnameable testsJohn Renner-8/+28
2018-07-30Reexport tests without polluting namespacesJohn Renner-1/+19
2018-07-30Auto merge of #52722 - alexcrichton:more-identifier-lints, r=oli-obkbors-1/+1
Tweak the raw_identifiers lints in 2018 * Enable the `raw_identifiers` feature automatically in the 2018 preview * Only emit lint warnings if the `raw_identifiers` feature is activated cc rust-lang/cargo#5783
2018-07-29update commenttoidiu-1/+1
2018-07-29Auto merge of #52738 - ljedrz:push_to_extend, r=eddybbors-11/+3
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-29Replace push loops with collect() and extend() where possibleljedrz-11/+3
2018-07-29Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkovbors-4/+4
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-29Auto merge of #52764 - sinkuu:cleanup, r=nikomatsakisbors-6/+4
Misc cleanups
2018-07-28Auto merge of #52355 - pietroalbini:zfeature, r=eddybbors-2/+32
Add the -Zcrate-attr=foo unstable rustc option This PR adds a new unstable option to `rustc`: `-Zcrate-attr=foo`. The option can be used to inject crate-level attributes from the CLI, and it's meant to be used by tools like Crater that needs to add their own attributes to a crate without changing the source code. The exact reason I need this is to implement "edition runs" in Crater: we need to add the preview feature flag to every crate, and editing the crates' source code on the fly might produce unexpected results, while a compiler flag is more reliable. cc https://github.com/rust-lang-nursery/crater/issues/282 @Mark-Simulacrum
2018-07-28Auto merge of #52761 - toidiu:ak-static-infer-fg, r=nikomatsakisbors-0/+9
static infer feature gate https://github.com/rust-lang/rust/issues/44493 r? @nikomatsakis
2018-07-28Rollup merge of #52781 - ljedrz:avoid_vec_arguments, r=nikomatsakiskennytm-1/+1
Use a slice where a vector is not necessary
2018-07-28Rollup merge of #52740 - estebank:crate-name, r=petrochenkovkennytm-1/+35
Suggest underscore when using dashes in crate namet push fork Fix #48437.
2018-07-27review commentsEsteban Küber-11/+7
2018-07-27Auto merge of #52336 - ishitatsuyuki:dyn-rollup, r=Mark-Simulacrumbors-2/+0
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-27Add the -Zcrate-attr=foo nightly rustc flag to inject crate attributesPietro Albini-2/+32
2018-07-27Use slices where a vector is not necessaryljedrz-1/+1
2018-07-27Use str::repeatShotaro Yamada-6/+4
2018-07-27Prefer to_string() to format!()ljedrz-4/+4
2018-07-26feature gate for inferring 'static lifetimestoidiu-0/+9
2018-07-26Tweak the raw_identifiers lints in 2018Alex Crichton-1/+1
* Enable the `raw_identifiers` feature automatically in the 2018 preview * Only emit lint warnings if the `raw_identifiers` feature is activated cc rust-lang/cargo#5783
2018-07-26Suggest underscore when using dashes in crate namet push forkEsteban Küber-3/+41
2018-07-25Deny bare_trait_objects globallyTatsuyuki Ishi-2/+0
2018-07-24Rollup merge of #52645 - oli-obk:existential_in_fn_body, r=dtolnayMark Rousskov-0/+6
Allow declaring existential types inside blocks fixes #52631 r? @dtolnay
2018-07-24Auto merge of #51587 - mark-i-m:at_most_once_rep_2018, r=alexcrichtonbors-81/+317
2018 edition `?` Kleene operator This is my first attempt at implementing the migration lint + 2018 behavior as discussed in #48075 r? @nikomatsakis
2018-07-24Allow declaring existential types inside blocksOliver Schneider-0/+6
2018-07-23Allow by default, fix testsmark-0/+1
2018-07-23dump lints _after_ parsing macrosmark-3/+3
2018-07-23make it a migration lintmark-3/+42
2018-07-23Fix test and errorsmark-266/+183
2018-07-23Implement 2015 vs 2018 `?` kleene op + testmark-257/+486
2018-07-23Extend ParseSess to support buffering lintsmark-2/+52
2018-07-24Auto merge of #52618 - alexcrichton:capture-more, r=petrochenkovbors-43/+77
rustc: Implement tokenization of nested items Ever plagued by #43081 the compiler can return surprising spans in situations related to procedural macros. This is exhibited by #47983 where whenever a procedural macro is invoked in a nested item context it would fail to have correct span information. While #43230 provided a "hack" to cache the token stream used for each item in the compiler it's not a full-blown solution. This commit continues to extend this "hack" a bit more to work for nested items. Previously in the parser the `parse_item` method would collect the tokens for an item into a cache on the item itself. It turned out, however, that nested items were parsed through the `parse_item_` method, so they didn't receive similar treatment. To remedy this situation the hook for collecting tokens was moved into `parse_item_` instead of `parse_item`. Afterwards the token collection scheme was updated to support nested collection of tokens. This is implemented by tracking `TokenStream` tokens instead of `TokenTree` to allow for collecting items into streams at intermediate layers and having them interleaved in the upper layers. All in all, this... Closes #47983