about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-10-07Auto merge of #54835 - ↵bors-23/+4
oli-obk:mögen_konstante_funktionen_doch_bitte_endlich_stabil_sein, r=Centril Stabilize `min_const_fn` tracking issue: #53555 r? @Centril
2018-10-05Rollup merge of #54833 - abonander:issue-54441, r=petrochenkovPietro Albini-15/+12
make `Parser::parse_foreign_item()` return a foreign item or error Fixes `Parser::parse_foreign_item()` to follow the convention of `parse_trait_item()` and `parse_impl_item()` in that it *must* parse an item or return an error, and then the caller is responsible for detecting the closing delimiter. This prevents it from looping endlessly on an unexpected token in `ext/expand.rs` where it was also leaking memory by continually pushing to `Parser::expected_tokens` via `Parser::check_keyword()`. closes #54441 r? @petrochenkov cc @dtolnay
2018-10-05Rollup merge of #54804 - euclio:inverted-parameters, r=estebankPietro Albini-1/+20
add suggestion for inverted function parameters Fixes #54065.
2018-10-05add suggestion for inverted function parametersAndy Russell-1/+20
Fixes #54065.
2018-10-05Auto merge of #54336 - petrochenkov:preuni, r=alexcrichtonbors-47/+30
resolve: Some refactorings in preparation for uniform paths 2.0 The main result is that in-scope resolution performed during macro expansion / import resolution is now consolidated in a single function (`fn early_resolve_ident_in_lexical_scope`), which can now be used for resolving first import segments as well when uniform paths are enabled. r? @ghost
2018-10-05Stabilize min_const_fn feature gateOliver Scherer-13/+2
2018-10-05Auto merge of #52121 - jebrosen:macros2_feature, r=petrochenkovbors-17/+19
Merge `proc_macro_` expansion feature gates as `proc_macro_hygiene` Merges `proc_macro_mod`, `proc_macro_expr`, `proc_macro_non_items`, and `proc_macro_gen` into a single feature: `proc_macro_hygiene`. These features are not all blocked on implementing macro hygiene *per se*, but rather on interactions with hygiene that have not been entirely resolved.
2018-10-05make `Parser::parse_foreign_item()` return a foreign item or errorAustin Bonander-15/+12
closes #54441
2018-10-05Stabilize `min_const_fn`Oliver Schneider-10/+2
2018-10-05expansion: Remove restriction on use of macro attributes with test/benchVadim Petrochenkov-47/+30
The restrictions were introduced in https://github.com/rust-lang/rust/pull/54277 and no longer necessary now because legacy plugins are now expanded in usual left-to-right order
2018-10-04Rollup merge of #54777 - zackmdavis:async_pretty_ice, r=cramertjPietro Albini-0/+3
abolish ICE when pretty-printing async block @jnetterf reported an ICE when the unused-parentheses lint triggered around an async block (#54752). In order to compose an autofixable suggestion, the lint invokes the pretty-printer on the unnecessarily-parenthesized expression. (One wonders why the lint doesn't just use `SourceMap::span_to_snippet` instead, to preserve the formatting of the original source?—but to answer that, you'd have to ask the author of 5c9f806d.) But then the pretty-printer panics when trying to call `<pprust::State as PrintState>::end` when `State.boxes` is empty. Empirically, the problem would seem to be solved if we start some "boxes" beforehand in the `ast::ExprKind::Async` arm of the big match in `print_expr_outer_attr_style`, exactly like we do in the immediately-preceding match arm for `ast::ExprKind::Block`—it would seem pretty ("pretty") reasonable for the pretty-printing of async blocks to work a lot like the pretty-printing of ordinary non-async blocks, right?? Of course, it would be shamefully cargo-culty to commit code on the basis of this kind of mere reasoning-by-analogy (in contrast to understanding the design of the pretty-printer in such detail that the correctness of the patch is comprehended with all the lucid certainty of mathematical proof, rather than being merely surmised by intuition). But maybe we care more about fixing the bug with high probability today, than with certainty in some indefinite hypothetical future? Maybe the effort is worth [a fifth of a shirt](https://hacktoberfest.digitalocean.com/stats/zackmdavis)?? Humbly resolves #54752. r? @cramertj
2018-10-03Update error id to an unused oneOliver Schneider-2/+2
2018-10-03Only promote calls to `#[rustc_promotable]` const fnsOliver Schneider-1/+23
2018-10-02abolish ICE when pretty-printing async blockZack M. Davis-0/+3
Joshua Netterfield reported an ICE when the unused-parentheses lint triggered around an async block (#54752). In order to compose an autofixable suggestion, the lint invokes the pretty-printer on the unnecessarily-parenthesized expression. (One wonders why the lint doesn't just use `SourceMap::span_to_snippet` instead, to preserve the formatting of the original source?—but for that, you'd have to ask the author of 5c9f806d.) But then the pretty-printer panics when trying to call `<pprust::State as PrintState>::end` when `State.boxes` is empty. Empirically, the problem would seem to be solved if we start some "boxes" beforehand in the `ast::ExprKind::Async` arm of the big match in `print_expr_outer_attr_style`, exactly like we do in the immediately-preceding match arm for `ast::ExprKind::Block`—it would seem pretty ("pretty") reasonable for the pretty-printing of async blocks to work a lot like the pretty-printing of ordinary non-async blocks, right?? Of course, it would be shamefully cargo-culty to commit code on the basis of this kind of mere reasoning-by-analogy (in contrast to understanding the design of the pretty-printer in such detail that the correctness of the patch is comprehended with all the lucid certainty of mathematical proof, rather than being merely surmised by intuition). But maybe we care more about fixing the bug with high probability today, than with certainty in some indefinite hypothetical future? Maybe the effort is worth a fifth of a shirt?? Humbly resolves #54752.
2018-10-02Merge the `proc_macro_` expansion feature gates into a single ↵jeb-17/+19
`proc_macro_hygiene` gate.
2018-10-01Extra proc macro gates are now at #54727Alex Crichton-5/+5
2018-09-27Bump to 1.31.0 and bootstrap from 1.30 betaJosh Stone-1/+1
2018-09-27Auto merge of #52319 - tinco:issue_12590, r=pnkfelixbors-12/+40
Track whether module declarations are inline (fixes #12590) To track whether module declarations are inline I added a field `inline: bool` to `ast::Mod`. The main use case is for pretty to know whether it should render the items associated with the module, but perhaps there are use cases for this information to not be forgotten in the AST.
2018-09-27Auto merge of #54581 - petrochenkov:cfgattr, r=alexcrichtonbors-0/+1
Accept trailing comma in `cfg_attr` Fixes https://github.com/rust-lang/rust/issues/54463 (stable-to-beta regression)
2018-09-26Auto merge of #53824 - ljedrz:begone_onevector, r=michaelwoeristerbors-95/+108
Remove OneVector, increase related SmallVec capacities Removes the `OneVector` type alias (equivalent to `SmallVec<[T; 1]>`); it is used in scenarios where the capacity of 1 is often exceeded, which might be nullifying the performance wins (due to spilling to the heap) expected when using `SmallVec` instead of `Vec`. The numbers I used in this PR are very rough estimates - it would probably be a good idea to adjust some/all of them, which is what this proposal is all about. It might be a good idea to additionally create some local type aliases for the `SmallVec`s in the `Folder` trait, as they are repeated in quite a few spots; I'd be happy to apply this sort of adjustments.
2018-09-26Remove OneVectorljedrz-95/+108
2018-09-26Auto merge of #54497 - ralexstokes:stabilize_pattern_parentheses, r=nikomatsakisbors-130/+195
Stabilize pattern_parentheses feature Addresses #51087 . Stabilizes the previously unstable feature `pattern_parentheses` which enables the use of `()` in match patterns.
2018-09-26Accept trailing comma in `cfg_attr`Vadim Petrochenkov-0/+1
2018-09-25Auto merge of #53542 - alexreg:impl-trait-in-bindings, r=cramertjbors-2/+5
`impl trait` in bindings (feature: impl-trait-existential-types) This PR enables `impl Trait` syntax (opaque types) to be used in bindings, e.g. * `let foo: impl Clone = 1;` * `static foo: impl Clone = 2;` * `const foo: impl Clone = 3;` This is part of [RFC 2071](https://github.com/rust-lang/rfcs/blob/master/text/2071-impl-trait-existential-types.md) ([tracking issue](https://github.com/rust-lang/rust/issues/34511)), but exists behind the separate feature gate `impl_trait_in_bindings`. CC @cramertj @oli-obk @eddyb @Centril @varkor
2018-09-25Auto merge of #53693 - scottmcm:marker-trait-attribute, r=nikomatsakisbors-0/+9
Support an explicit annotation for marker traits From the tracking issue for rust-lang/rfcs#1268: > It seems obvious that we should make a `#[marker]` annotation. ~ https://github.com/rust-lang/rust/issues/29864#issuecomment-368959441 This PR allows you to put `#[marker]` on a trait, at which point: - [x] The trait must not have any items ~~All of the trait's items must have defaults~~ - [x] Any impl of the trait must be empty (not override any items) - [x] But impls of the trait are allowed to overlap r? @nikomatsakis
2018-09-25Handle impl trait in MIR type checked for assignments.Matthew Jasper-2/+5
2018-09-23Fixed off-by-one span.David Wood-1/+1
Fixes the off-by-one span issue where closure argument spans were pointing to the token after the argument.
2018-09-23Auto merge of #54325 - michaelwoerister:incr-thinlto-tests, r=alexcrichtonbors-0/+6
incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to test incremental ThinLTO. This adds some tests specifically targeted at incremental ThinLTO, plus the infrastructure for tracking the kind of cache hit/miss we had for a given CGU. @alexcrichton, let me know if you can think of any more tests to add. ThinLTO works rather reliably for small functions, so we should be able to test it in a robust way. I think after this lands it might time for a "Help us test incremental ThinLTO" post on irlo. r? @alexcrichton
2018-09-22stabilize pattern_parentheses featureAlex Stokes-7/+2
2018-09-22fix typo in commentAlex Stokes-123/+193
2018-09-22Auto merge of #54457 - pietroalbini:rollup, r=pietroalbinibors-47/+55
Rollup of 16 pull requests Successful merges: - #53652 (define copy_within on slices) - #54261 (Make `dyn` a keyword in the 2018 edition) - #54280 (remove (more) CAS API from Atomic* types where not natively supported) - #54323 (rustbuild: drop color handling) - #54350 (Support specifying edition in doc test) - #54370 (Improve handling of type bounds in `bit_set.rs`.) - #54371 (add -Zui-testing to rustdoc) - #54374 (Make 'proc_macro::MultiSpan' public.) - #54402 (Use no_default_libraries for all NetBSD flavors) - #54409 (Detect `for _ in in bar {}` typo) - #54412 (add applicability to span_suggestion call) - #54413 (Add UI test for deref recursion limit printing twice) - #54415 (parser: Tweak function parameter parsing to avoid rollback on succesfull path) - #54420 (Compress `Liveness` data some more.) - #54422 (Simplify slice's first(_mut) and last(_mut) with get) - #54446 (Unify christianpoveda's emails) Failed merges: - #54058 (Introduce the partition_dedup/by/by_key methods for slices) r? @ghost
2018-09-22Rollup merge of #54415 - petrochenkov:norollback, r=estebankPietro Albini-36/+26
parser: Tweak function parameter parsing to avoid rollback on succesfull path Since rollback is not perfect and may e.g. leave non-fatal errors after it, we need to make sure compilation fails if it happens. So in particular case of `fn parse_arg_general` we need to parse the "good" `TYPE` first and only then rollback and recover erroneous `PAT: TYPE` if necessary. Found when working on https://github.com/rust-lang/rfcs/pull/2544#issuecomment-423293222. r? @ghost
2018-09-22Rollup merge of #54409 - estebank:remove-in, r=pnkfelixPietro Albini-9/+25
Detect `for _ in in bar {}` typo Fix #36611, #52964, without modifying the parsing of emplacement `in` to avoid further problems like #50832.
2018-09-22Rollup merge of #54261 - varkor:dyn-keyword-2018, r=petrochenkovPietro Albini-2/+4
Make `dyn` a keyword in the 2018 edition Proposed in https://github.com/rust-lang/rust/issues/44662#issuecomment-421596088.
2018-09-22Stabilize crate_in_paths, extern_absolute_paths and extern_prelude on all ↵Eduard-Mihai Burtescu-14/+7
editions.
2018-09-20Detect `for _ in in bar {}` typoEsteban Küber-9/+25
2018-09-21parser: Tweak function parameter parsing to avoid rollback on succesfull pathVadim Petrochenkov-36/+26
2018-09-20Auto merge of #54241 - vi:suggest_with_applicability, r=estebankbors-3/+16
Remove usages of span_suggestion without Applicability Use `Applicability::Unspecified` for all of them instead. Shall deprecations for the non-`_with_applicability` functions be added? Shall clippy be addressed somehow? r? @estebank
2018-09-19Parse, feature-gate, and validate the #[marker] attributeScott McMurray-0/+9
2018-09-18incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to ↵Michael Woerister-0/+6
test incremental ThinLTO.
2018-09-18Auto merge of #54034 - pnkfelix:issue-15287-bind-by-move-pattern-guards, ↵bors-0/+6
r=nikomatsakis Add feature to enable bind by move pattern guards Implement #15287 as described on https://github.com/rust-lang/rust/issues/15287#issuecomment-404827419
2018-09-18Rollup merge of #54299 - snaedis:issue-54246, r=varkorGuillaume Gomez-7/+10
Issue 54246 I added the option of providing a help message for deprecated features, that takes precedence over the default `help: remove this attribute` message, along with messages for the features that mention replacements in the reason for deprecation. Fixes #54246.
2018-09-18Auto merge of #54286 - nnethercote:BitSet, r=pnkfelixbors-5/+5
Merge `bitvec.rs` and `indexed_set.rs` Because it's not good to have two separate implementations. Also, I will combine the best parts of each to improve NLL memory usage on some benchmarks significantly.
2018-09-18Merge indexed_set.rs into bitvec.rs, and rename it bit_set.rs.Nicholas Nethercote-5/+5
Currently we have two files implementing bitsets (and 2D bit matrices). This commit combines them into one, taking the best features from each. This involves renaming a lot of things. The high level changes are as follows. - bitvec.rs --> bit_set.rs - indexed_set.rs --> (removed) - BitArray + IdxSet --> BitSet (merged, see below) - BitVector --> GrowableBitSet - {,Sparse,Hybrid}IdxSet --> {,Sparse,Hybrid}BitSet - BitMatrix --> BitMatrix - SparseBitMatrix --> SparseBitMatrix The changes within the bitset types themselves are as follows. ``` OLD OLD NEW BitArray<C> IdxSet<T> BitSet<T> -------- ------ ------ grow - grow new - (remove) new_empty new_empty new_empty new_filled new_filled new_filled - to_hybrid to_hybrid clear clear clear set_up_to set_up_to set_up_to clear_above - clear_above count - count contains(T) contains(&T) contains(T) contains_all - superset is_empty - is_empty insert(T) add(&T) insert(T) insert_all - insert_all() remove(T) remove(&T) remove(T) words words words words_mut words_mut words_mut - overwrite overwrite merge union union - subtract subtract - intersect intersect iter iter iter ``` In general, when choosing names I went with: - names that are more obvious (e.g. `BitSet` over `IdxSet`). - names that are more like the Rust libraries (e.g. `T` over `C`, `insert` over `add`); - names that are more set-like (e.g. `union` over `merge`, `superset` over `contains_all`, `domain_size` over `num_bits`). Also, using `T` for index arguments seems more sensible than `&T` -- even though the latter is standard in Rust collection types -- because indices are always copyable. It also results in fewer `&` and `*` sigils in practice.
2018-09-17Auto merge of #54277 - petrochenkov:afterder, r=alexcrichtonbors-40/+70
Temporarily prohibit proc macro attributes placed after derives ... and also proc macro attributes used together with `#[test]`/`#[bench]`. Addresses item 6 from https://github.com/rust-lang/rust/pull/50911#issuecomment-411605393. The end goal is straightforward predictable left-to-right expansion order for attributes. Right now derives are expanded last regardless of their relative ordering with macro attributes and right now it's simpler to temporarily prohibit macro attributes placed after derives than changing the expansion order. I'm not sure whether the new beta is already released or not, but if it's released, then this patch needs to be backported, so the solution needs to be minimal. How to fix broken code (derives): - Move macro attributes above derives. This won't change expansion order, they are expanded before derives anyway. Using attribute macros on same items with `#[test]` and `#[bench]` is prohibited for similar expansion order reasons, but this one is going to be reverted much sooner than restrictions on derives. How to fix broken code (test/bench): - Enable `#![feature(plugin)]` (don't ask why). r? @ghost
2018-09-17Whitespace fix again.Vitaly _Vi Shukela-13/+13
2018-09-17libsyntax: add optional help message for deprecated featuresAlva Snædís-6/+9
2018-09-17libsyntax: fix casing in error messageAlva Snædís-1/+1
2018-09-17Add `feature(bind_by_move_pattern_guards)`.Felix S. Klock II-0/+6
Note it requires MIR-borrowck to be enabled to actually do anything. Note also that it implicitly turns off our AST-based check for mutation in guards.
2018-09-17Fixed some remaining whitespace issues.Vitaly _Vi Shukela-1/+1
(Not sure if it is correct although).