about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-08-16Add feature gate and refactorvarkor-0/+3
2018-08-16Auto merge of #53433 - kennytm:rollup, r=kennytmbors-12/+43
Rollup of 10 pull requests Successful merges: - #52946 (Documented impl From on line 367 of libserialize/json.rs) - #53234 (Remove Travis shutdown debug scripts, and remove CI-specific DNS settings) - #53313 (Two small improvements) - #53360 (Addressed #51602) - #53364 (Warn if the user tries to use GATs) - #53373 (Tweak unclosed delimiter parser error) - #53377 (std: Use target_pointer_width for BACKTRACE_ELF_SIZE) - #53395 (Use #[non_exhaustive] on internal enums) - #53399 (Tidy: ignore non-Markdown files when linting for the Unstable Book) - #53412 (syntax_ext: remove leftover span_err_if_not_stage0 macro.)
2018-08-17Rollup merge of #53373 - estebank:unclosed, r=petrochenkovkennytm-11/+21
Tweak unclosed delimiter parser error
2018-08-17Rollup merge of #53364 - varkor:gat-warn-broken, r=pnkfelixkennytm-0/+15
Warn if the user tries to use GATs GATs are currently broken, but still accessible behind a feature gate. This leads to people attempting to use them and then immediately encountering ICEs (or other broken behaviour). Here, we emit a warning if the user tries to use any feature associated with GATs, hopefully making it obvious that ICEs and the like are expected. For the meantime, this seems better than continually getting reported errors (for example: [here](https://github.com/rust-lang/rust/issues?q=is%3Aissue+gat+is%3Aclosed) and [here](https://github.com/rust-lang/rust/issues?utf8=%E2%9C%93&q=is%3Aissue+generic_associated_types+is%3Aclosed)).
2018-08-17Rollup merge of #53360 - PramodBisht:issue/51602, r=estebankkennytm-1/+7
Addressed #51602 Fixed #51602 r? @estebank here I have addressed the case where `in` was not expected right after `if` block. Speaking of `type ascription` I am not sure if this the best approach which I have implemented. Plus I think one more test case can be added to test `type-ascription` case, though I don't have any at this point of time. I will ping you again if all existing testcases pass.
2018-08-16Auto merge of #53304 - dtolnay:extend, r=dtolnaybors-16/+265
TokenStream::extend Two new insta-stable impls in libproc_macro: ```rust impl Extend<TokenTree> for TokenStream impl Extend<TokenStream> for TokenStream ``` `proc_macro::TokenStream` already implements `FromIterator<TokenTree>` and `FromIterator<TokenStream>` so I elected to support the same input types for `Extend`. **This commit reduces compile time of Serde derives by 60% (takes less than half as long to compile)** as measured by building our test suite: ```console $ git clone https://github.com/serde-rs/serde $ cd serde/test_suite $ cargo check --tests --features proc-macro2/nightly $ rm -f ../target/debug/deps/libtest_*.rmeta $ time cargo check --tests --features proc-macro2/nightly Before: 20.8 seconds After: 8.6 seconds ``` r? @alexcrichton
2018-08-16syntax: also warn about edition "umbrella" features being implied by --edition.Eduard-Mihai Burtescu-13/+22
2018-08-16Auto merge of #53293 - petrochenkov:gramattr2, r=alexcrichtonbors-27/+53
syntax: Enforce attribute grammar in the parser Also fix feature-gating for `unrestricted_attribute_tokens` that was introduced in https://github.com/rust-lang/rust/pull/53270, but was actually broken. cc https://github.com/rust-lang/rust/pull/50911
2018-08-16Auto merge of #53289 - ljedrz:improve_lexer, r=michaelwoeristerbors-74/+134
A few cleanups and minor improvements for the lexer - improve readability by adjusting the formatting of some function signatures and adding some newlines - reorder some functions for easier reading - remove redundant `'static` in `const`s - remove some explicit `return`s - read directly to a `String` in `gather_comments_and_literals` - change `unwrap_or!` (macro) to `unwrap_or` (function) - move an `assert!`ion from `try_next_token` (called in a loop) to `try_real_token` after all calls to `try_next_token` - `#[inline]` some one-liner functions - assign directly from an `if-else` expression - refactor a `match` to `map_or` - add a `token::is_irrelevant` function to detect tokens that are not "`real`"
2018-08-16syntax: process all edition features before other features.Eduard-Mihai Burtescu-10/+34
2018-08-15Do not emit "incorrect close delimiter" twice in the same placeEsteban Küber-11/+19
2018-08-15Tweak unclosed delimiter parser errorEsteban Küber-2/+4
2018-08-15Warn when `generic_associated_types` feature gate is enabledvarkor-0/+15
2018-08-15syntax: Enforce attribute grammar in the parserVadim Petrochenkov-27/+53
2018-08-14Feature gate where clauses on associated type implsvarkor-4/+9
2018-08-14Adddressed #51602Pramod Bisht-1/+7
2018-08-14Auto merge of #53085 - ljedrz:cleanup_syntax_structures, r=ljedrzbors-268/+131
Move SmallVector and ThinVec out of libsyntax - move `libsyntax::util::SmallVector` tests to `librustc_data_structures::small_vec` - remove `libsyntax::util::SmallVector` - move `libsyntax::util::thin_vec` to `librustc_data_structures::thin_vec` Other than moving these data structures where they belong it allows modules using `SmallVector<T>` (`SmallVec<[T; 1]>`) to specify their own length (e.g. 8 or 32) independently from `libsyntax`.
2018-08-14rustc_resolve: fix special-case for one-segment import paths.Eduard-Mihai Burtescu-1/+1
2018-08-14syntax: gensym the injected std/core extern crates in the Rust 2018 edition.Eduard-Mihai Burtescu-7/+30
2018-08-13Address review of RcVecDavid Tolnay-10/+5
2018-08-14syntax: add `uniform_paths` feature-gate.Eduard-Mihai Burtescu-0/+3
2018-08-13Move SmallVec and ThinVec out of libsyntaxljedrz-268/+131
2018-08-13Auto merge of #53270 - petrochenkov:macuse-regr, r=alexcrichtonbors-21/+25
Fix a few regressions from enabling macro modularization The first commit restores the old behavior for some minor unstable stuff (`rustc_*` and `derive_*` attributes) and adds a new feature gate for arbitrary tokens in non-macro attributes. The second commit fixes https://github.com/rust-lang/rust/issues/53205 The third commit fixes https://github.com/rust-lang/rust/issues/53144. Same technique is used as for other things blocking expansion progress - if something causes indeterminacy too often, then prohibit it. In this case referring to crate-local macro-expanded `#[macro_export]` macros via module-relative paths is prohibited, see comments in code for more details. cc https://github.com/rust-lang/rust/pull/50911
2018-08-13A few cleanups and minor improvements for the lexerljedrz-74/+134
2018-08-12TokenStream::extendDavid Tolnay-16/+270
2018-08-13Auto merge of #53051 - varkor:trait-method-pattern-arguments-error, ↵bors-15/+54
r=petrochenkov Emit error for pattern arguments in trait methods The error and check for this already existed, but the parser didn't try to parse trait method arguments as patterns, so the error was never emitted. This surfaces the error, so we get better errors than simple parse errors. This improves the error message described in https://github.com/rust-lang/rust/issues/53046. r? @petrochenkov
2018-08-12Rollup merge of #53230 - memoryruins:nll_bootstrap_4, r=nikomatsakisGuillaume Gomez-0/+1
[nll] enable feature(nll) on various crates for bootstrap: part 4 #53172 r? @nikomatsakis
2018-08-12Rollup merge of #53019 - ljedrz:bad_collects, r=estebankGuillaume Gomez-1/+5
Don't collect() when size_hint is useless This adjusts PRs #52738 and #52697 by falling back to calculating capacity and extending or pushing in a loop where `collect()` can't be trusted to calculate the right capacity. It is a performance win.
2018-08-11Clean up and add extra testsvarkor-12/+3
2018-08-11Add E0642 to parser errorvarkor-3/+6
2018-08-11Emit an error during parsingvarkor-42/+62
2018-08-11Improve diagnosticsvarkor-1/+1
2018-08-11Fix handling of trait methods with bodies and improve efficiencyvarkor-19/+30
2018-08-11Emit error for pattern arguments in trait methodsvarkor-20/+34
The error and check for this already existed, but the parser didn't try to parse trait method arguments as patterns, so the error was never emitted. This surfaces the error, so we get better errors than simple parse errors.
2018-08-11Feature gate arbitrary tokens in non-macro attributes with a separate gateVadim Petrochenkov-21/+25
Feature gate `rustc_` and `derive_` with their own gates again instead of `custom_attribute`
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-09[nll] libsyntax: enable feature(nll) for bootstrapmemoryruins-0/+1
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