about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
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).
2018-09-17Fill in suggestions Applicability according to @estebankVitaly _Vi Shukela-11/+13
Also fix some formatting along the way.
2018-09-16Treat `dyn` as a keyword in the 2018 editionvarkor-2/+4
2018-09-16Remove usages of span_suggestion without ApplicabilityVitaly _Vi Shukela-3/+14
Use Applicability::Unspecified for all of them instead.
2018-09-16Temporarily prohibit proc macro attributes placed after derivesVadim Petrochenkov-40/+70
... and also proc macro attributes used together with test/bench.
2018-09-16Rollup merge of #54181 - vi:hint_and_or, r=estebankGuillaume Gomez-0/+33
Suggest && and || instead of 'and' and 'or' Resolves #54109. Note: competing pull reqeust: #54179 r? @csmoe
2018-09-15issue 54109: use short suggestionsVitaly _Vi Shukela-4/+4
2018-09-14Auto merge of #53751 - F001:tuple-struct-self-ctor, r=petrochenkov,varkorbors-0/+3
Implement RFC 2302: tuple_struct_self_ctor Tracking issue: https://github.com/rust-lang/rust/issues/51994
2018-09-13Auto merge of #54168 - kennytm:rollup, r=kennytmbors-2/+40
Rollup of 11 pull requests Successful merges: - #53371 (Do not emit E0277 on incorrect tuple destructured binding) - #53829 (Add rustc SHA to released DWARF debuginfo) - #53950 (Allow for opting out of ThinLTO and clean up LTO related cli flag handling.) - #53976 (Replace unwrap calls in example by expect) - #54070 (Add Error::description soft-deprecation to RELEASES) - #54076 (miri loop detector hashing) - #54119 (Add some unit tests for find_best_match_for_name) - #54147 (Add a test that tries to modify static memory at compile-time) - #54150 (Updated 1.29 release notes with --document-private-items flag) - #54163 (Update stage 0 to latest beta) - #54170 (COMPILER_TESTS.md has been moved)
2018-09-13Use span_suggestion_with_applicability for "and/or" hinterVitaly _Vi Shukela-4/+24
Advised by @estebank.
2018-09-14Rollup merge of #54119 - phansch:unit_test_find_best_match_for_name, ↵kennytm-2/+40
r=nikomatsakis Add some unit tests for find_best_match_for_name There were only some UI tests that covered this function. Since there's more diagnostic work going on, I think it makes sense to have this unit tested.
2018-09-13Suggest && and || instead of 'and' and 'or'Vitaly _Vi Shukela-0/+13
Closes #54109.
2018-09-13introduce SelfCtorF001-11/+2
2018-09-13implement feature tuple_struct_self_ctorF001-0/+12
2018-09-13resolve: Put different parent scopes into a single structureVadim Petrochenkov-3/+3
2018-09-12Auto merge of #53793 - toidiu:ak-stabalize, r=nikomatsakisbors-10/+2
stabilize outlives requirements https://github.com/rust-lang/rust/issues/44493 r? @nikomatsakis
2018-09-12Rollup merge of #54072 - blitzerr:master, r=Mark-Simulacrumkennytm-30/+3
Stabilization change for mod.rs This change is in response to https://github.com/rust-lang/rust/issues/53125. The patch makes the feature accepted and removes the tests that tested the non-accepted status of the feature.
2018-09-11Auto merge of #53913 - petrochenkov:biattr4, r=alexcrichtonbors-5/+4
resolve: Future proof resolutions for potentially built-in attributes This is not full "pass all attributes through name resolution", but a more conservative solution. If built-in attribute is ambiguous with any other macro in scope, then an error is reported. What complications arise with the full solution - https://github.com/rust-lang/rust/pull/53913#issuecomment-418204136. cc https://github.com/rust-lang/rust/pull/50911#issuecomment-411605393 cc https://github.com/rust-lang/rust/issues/52269 Closes https://github.com/rust-lang/rust/issues/53531
2018-09-11stabalize infer outlives requirements (RFC 2093).toidiu-10/+2
Co-authored-by: nikomatsakis
2018-09-11Auto merge of #51363 - japaric:stable-used, r=cramertjbors-7/+4
stabilize #[used] closes #40289 RFC for stabilization: rust-lang/rfcs#2386 r? @Centril Where should this be documented? Currently the documentation is in the unstable book
2018-09-11Add some unit tests for find_best_match_for_namePhilipp Hansch-2/+40
There were only some UI tests that covered this function. Since there's more diagnostic work going on, I think it makes sense to have this unit tested.
2018-09-11Auto merge of #54092 - estebank:gotta-go-fast, r=nikomatsakisbors-26/+23
Don't compute padding of braces unless they are unmatched Follow up to #53949. Attempt to fix # #54083. r? @nikomatsakis
2018-09-11resolve: Support resolving identifier macros without their own IDVadim Petrochenkov-5/+4
Invocation/expansion ID (aka `Mark`) is not really necessary for resolving a macro path. What is really necessary is its parent module, parent expansion and parent legacy scope. This is required for validation resolutions of built-in attributes, which don't get their own `Mark`s
2018-09-10Auto merge of #54093 - petrochenkov:noinner, r=alexcrichtonbors-8/+26
Feature gate non-builtin attributes in inner attribute position Closes item 3 from https://github.com/rust-lang/rust/pull/50911#issuecomment-411605393
2018-09-10reintroduce inline to libsyntax testTinco Andringa-54/+1
2018-09-10bump versionJorge Aparicio-1/+1
2018-09-10Correctly close indentation blocks when pretty printing non-inline moduleTinco Andringa-1/+2
2018-09-10pretty=expanded should expand mod declarationsTinco Andringa-6/+13
2018-09-10Track whether module declarations are inline (fixes #12590)Tinco Andringa-10/+83
2018-09-10resolve: Remove `unshadowable_attrs`Vadim Petrochenkov-2/+0
2018-09-10Feature gate non-builtin attributes in inner attribute positionVadim Petrochenkov-8/+26
2018-09-09Don't compute padding of braces unless they are unmatchedEsteban Küber-26/+23
2018-09-09Auto merge of #53778 - petrochenkov:shadrelax2, r=nikomatsakisbors-0/+4
resolve: Relax shadowing restrictions on macro-expanded macros Previously any macro-expanded macros weren't allowed to shadow macros from outer scopes. Now only "more macro-expanded" macros cannot shadow "less macro-expanded" macros. See comments to `fn may_appear_after` and added tests for more details and examples. The functional changes are a21f6f588fc28c97533130ae44a6957b579ab58c and 46dd365ce9ca0a6b8653849b80267763c542842a, other commits are refactorings.
2018-09-09Auto merge of #54057 - matthiaskrgr:stabilize-edition-plus-clippy, ↵bors-1/+1
r=Mark-Simulacrum Stabilize edition 2018; also updates Clippy, RLS and Cargo Supersedes https://github.com/rust-lang/rust/pull/53999 , https://github.com/rust-lang/rust/pull/53935 Clippy build was failing there because crate_visibility_modifier feature was taken out of edition 2018 and clippy used it. The clippy update enables the corresponding feature explicitly. r? @Mark-Simulacrum
2018-09-09stabilize `#[used]`Jorge Aparicio-7/+4
closes #40289
2018-09-09Auto merge of #53902 - dtolnay:group, r=petrochenkovbors-103/+140
proc_macro::Group::span_open and span_close Before this addition, every delimited group like `(`...`)` `[`...`]` `{`...`}` has only a single Span that covers the full source location from opening delimiter to closing delimiter. This makes it impossible for a procedural macro to trigger an error pointing to just the opening or closing delimiter. The Rust compiler does not seem to have the same limitation: ```rust mod m { type T = } ``` ```console error: expected type, found `}` --> src/main.rs:3:1 | 3 | } | ^ ``` On that same input, a procedural macro would be forced to trigger the error on the last token inside the block, on the entire block, or on the next token after the block, none of which is really what you want for an error like above. This commit adds `group.span_open()` and `group.span_close()` which access the Span associated with just the opening delimiter and just the closing delimiter of the group. Relevant to Syn as we implement real error messages for when parsing fails in a procedural macro: https://github.com/dtolnay/syn/issues/476. ```diff impl Group { fn span(&self) -> Span; + fn span_open(&self) -> Span; + fn span_close(&self) -> Span; } ``` Fixes #48187 r? @alexcrichton
2018-09-08Rename sp_lo to sp_openDavid Tolnay-10/+10
2018-09-08Stabilization change for mod.rsRusty Blitzerr-30/+3
This change is in response to https://github.com/rust-lang/rust/issues/53125. The patch makes the feature accepted and removes the tests that tested the non-accepted status of the feature.
2018-09-08Track distinct spans for open and close delimiterDavid Tolnay-97/+134
2018-09-09Auto merge of #53949 - estebank:unclosed-delim, r=nikomatsakisbors-15/+69
Improve messages for un-closed delimiter errors
2018-09-09Remove crate_visibility_modifier from 2018 editionMark Rousskov-1/+1
2018-09-08Add test cases for possible restricted shadowing configurationsVadim Petrochenkov-0/+4
Whitelist `#[rustc_transparent_macro]` so it's not interpreted as a potential attribute macro
2018-09-08Auto merge of #51366 - japaric:stable-panic-impl, r=Mark-Simulacrumbors-5/+2
stabilize #[panic_handler] closes #44489 ### Update(2018-09-07) This was proposed for stabilization in https://github.com/rust-lang/rust/issues/44489#issuecomment-398965881 and its FCP with disposition to merge / accept is nearly over. The summary of what's being stabilized can be found in https://github.com/rust-lang/rust/issues/44489#issuecomment-416645946 Documentation PRs: - Reference. https://github.com/rust-lang-nursery/reference/pull/362 - Nomicon. https://github.com/rust-lang-nursery/nomicon/pull/75 --- `#[panic_implementation]` was implemented recently in #50338. `#[panic_implementation]` is basically the old `panic_fmt` language item but in a less error prone (\*) shape. There are still some issues and questions to sort out around this feature (cf. #44489) but this PR is meant to start a discussion about those issues / questions with the language team. (\*) `panic_fmt` was not type checked; changes in its function signature caused serious, silent binary size regressions like the one observed in #43054 Some unresolved questions from #44489: > Should the Display of PanicInfo format the panic information as "panicked at 'reason', > src/main.rs:27:4", as "'reason', src/main.rs:27:4", or simply as "reason". The current implementation formats `PanicInfo` as the first alternative, which is how panic messages are formatted by the `std` panic handler. The `Display` implementation is more than a convenience: `PanicInfo.message` is unstable so it's not possible to replicate the `Display` implementation on stable. > Is this design compatible, or can it be extended to work, with unwinding implementations for > no-std environments? I believe @whitequark made more progress with unwinding in no-std since their last comment in #44489. Perhaps they can give us an update? --- Another unresolved question is where this feature should be documented. The feature currently doesn't have any documentation. cc @rust-lang/lang cc @jackpot51 @alevy @phil-opp