about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-08-10Rollup merge of #53183 - estebank:println-comma, r=oli-obkkennytm-15/+37
Suggest comma when missing in macro call When missing a comma in a macro call, suggest it, regardless of position. When a macro call doesn't match any of the patterns, check if the call's token stream could be missing a comma between two idents, and if so, create a new token stream containing the comma and try to match against the macro patterns. If successful, emit the suggestion. This works on arbitrary macros, with no need of special support from the macro writers. ``` error: no rules expected the token `d` --> $DIR/missing-comma.rs:26:18 | LL | foo!(a, b, c d, e); | -^ | | | help: missing comma here ``` Follow up to #52397.
2018-08-10Rollup merge of #53179 - gnzlbg:patch-3, r=alexcrichtonkennytm-0/+1
Whitelist wasm32 simd128 target feature r? @alexcrichton
2018-08-09Rollup merge of #52773 - ljedrz:unncecessary_patterns, r=nikomatsakiskennytm-1/+1
Avoid unnecessary pattern matching against Option and Result
2018-08-08Auto merge of #53053 - petrochenkov:custattr, r=alexcrichtonbors-103/+45
resolve: Support custom attributes when macro modularization is enabled Basically, if resolution of a single-segment attribute is a determined error, then we interpret it as a custom attribute. Since custom attributes are integrated into general macro resolution, `feature(custom_attribute)` now requires and implicitly enables macro modularization (`feature(use_extern_macros)`). Actually, a few other "advanced" macro features now implicitly enable macro modularization too (and one bug was found and fixed in process of enabling it). The first two commits are preliminary cleanups/refactorings.
2018-08-07Suggest comma when missing in macro callEsteban Küber-15/+37
When missing a comma in a macro call, suggest it, regardless of position. When a macro call doesn't match any of the patterns, check if the call's token stream could be missing a comma between two idents, and if so, create a new token stream containing the comma and try to match against the macro patterns. If successful, emit the suggestion.
2018-08-08add wasm_target_feature feature gategnzlbg-0/+1
2018-08-07Auto merge of #52397 - estebank:println-comma, r=oli-obkbors-1/+51
Suggest comma when writing `println!("{}" a);` Fix #49370.
2018-08-07Auto merge of #51990 - oli-obk:unstable_union, r=nikomatsakisbors-0/+12
Place unions, pointer casts and pointer derefs behind extra feature gates To ensure we don't stabilize these things together with const fn stabilization (or any other stabilization) This PR moves union field accesses inside `const fn` behind a feature gate. It was possible without a feature gate before, but since `const fn` was behind a feature gate we can do this change. While "dereferencing raw pointers" and "casting raw pointers to usize" were hard errors before this PR, one could work around them by abusing unions: ```rust // deref union Foo<T> { x: &'static T, y: *const T, } const FOO: u32 = unsafe { *Foo { y: 42 as *const T }.x }; // as usize cast union Bar<T> { x: usize, y: *const T, } const BAR: usize = unsafe { Bar { y: &1u8 }.x }; ``` r? @eddyb cc @nikomatsakis
2018-08-07Also put comparing raw pointers behind a feature gateOliver Schneider-0/+3
2018-08-07Place unions, pointer casts and pointer derefs behind extra feature gatesOliver Schneider-0/+9
2018-08-07Rollup merge of #53135 - joshtriplett:remove-catch-from-2018-preview, ↵kennytm-1/+1
r=Mark-Simulacrum Rust 2018: Disable catch_expr, not targeted for 2018 edition Fixes #52604
2018-08-07Rollup merge of #53093 - 0e4ef622:issue-52169-fix, r=petrochenkovkennytm-0/+4
Enable macros to pass $:literal to another macro Fixes #52169.
2018-08-07Avoid unnecessary pattern matching against Option and Resultljedrz-1/+1
2018-08-06fix typoEsteban Küber-1/+1
2018-08-06Suggest comma when writing `println!("{}" a);`Esteban Küber-1/+51
2018-08-06Auto merge of #53016 - scottmcm:impl-header-lifetime-elision, r=nikomatsakisbors-1/+5
Extract impl_header_lifetime_elision out of in_band_lifetimes This way we can experiment with `impl Debug for &MyType` separately from `impl Debug for &'a MyType`. I can't say I know what the code in here is doing, so please let me know if there's a better way :slightly_smiling_face: I marked this as enabled in 2018 so that edition code continues to work without another flag. Actual feature PR https://github.com/rust-lang/rust/pull/49251; Tracking Issue https://github.com/rust-lang/rust/issues/15872; In-band lifetimes tracking issue https://github.com/rust-lang/rust/issues/44524. cc @aturon, per discussion on discord earlier cc @cramertj & @nikomatsakis, who actually wrote these features
2018-08-06Rust 2018: Disable catch_expr, not targeted for 2018 editionJosh Triplett-1/+1
Fixes #52604
2018-08-06Address review commentsVadim Petrochenkov-30/+12
Adjust a few fulldeps and pretty-printing tests Fix rebase
2018-08-06Enable macro modularization implicitly if one of "advanced" macro features ↵Vadim Petrochenkov-4/+8
is enabled Do not mark all builtin attributes as used when macro modularization is enabled
2018-08-06Support custom attributes when macro modularization is enabledVadim Petrochenkov-54/+27
2018-08-06Avoid modifying invocations in place for derive helper attributesVadim Petrochenkov-21/+4
2018-08-05Fix diagnostic_list errorvarkor-1/+1
2018-08-05Enable macros to pass $:literal to another macroMatthew Tran-0/+4
2018-08-05Change feature edition error into a warningvarkor-1/+1
2018-08-05Fix 2018 edition testsvarkor-1/+1
2018-08-05Add an error when declaring features that are stable in the current Rust editionvarkor-22/+52
2018-08-05Add special support for libcvarkor-1/+0
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-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