about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-08-22Rollup merge of #53504 - ekse:suggestions-applicability-2, r=estebankGuillaume Gomez-2/+6
Set applicability for more suggestions. Converts a couple more calls to `span_suggestion_with_applicability` (#50723). To be on the safe side, I marked suggestions that depend on the intent of the user or that are potentially lossy conversions as MaybeIncorrect. r? @estebank
2018-08-21Remove super old comment on function that parses itemsDavid Tolnay-2/+0
This comment was added more than 5 years ago in ab03c1e4221. As far as anyone reading this comment today needs to know, the function has never parsed items from inside an extern crate.
2018-08-22Auto merge of #50912 - varkor:exhaustive-integer-matching, r=arielb1bors-0/+3
Exhaustive integer matching This adds a new feature flag `exhaustive_integer_patterns` that enables exhaustive matching of integer types by their values. For example, the following is now accepted: ```rust #![feature(exhaustive_integer_patterns)] #![feature(exclusive_range_pattern)] fn matcher(x: u8) { match x { // ok 0 .. 32 => { /* foo */ } 32 => { /* bar */ } 33 ..= 255 => { /* baz */ } } } ``` This matching is permitted on all integer (signed/unsigned and char) types. Sensible error messages are also provided. For example: ```rust fn matcher(x: u8) { match x { //~ ERROR 0 .. 32 => { /* foo */ } } } ``` results in: ``` error[E0004]: non-exhaustive patterns: `32u8...255u8` not covered --> matches.rs:3:9 | 6 | match x { | ^ pattern `32u8...255u8` not covered ``` This implements https://github.com/rust-lang/rfcs/issues/1550 for https://github.com/rust-lang/rust/issues/50907. While there hasn't been a full RFC for this feature, it was suggested that this might be a feature that obviously complements the existing exhaustiveness checks (e.g. for `bool`) and so a feature gate would be sufficient for now.
2018-08-21Auto merge of #53471 - petrochenkov:biattr2, r=oli-obkbors-20/+14
resolve: Some macro resolution refactoring Work towards completing https://github.com/rust-lang/rust/pull/50911#issuecomment-411605393 The last commit also fixes https://github.com/rust-lang/rust/issues/53269 by not using `def_id()` on `Def::Err` and also fixes https://github.com/rust-lang/rust/issues/53512.
2018-08-21Auto merge of #53530 - kennytm:rollup, r=kennytmbors-34/+16
Rollup of 17 pull requests Successful merges: - #53030 (Updated RELEASES.md for 1.29.0) - #53104 (expand the documentation on the `Unpin` trait) - #53213 (Stabilize IP associated constants) - #53296 (When closure with no arguments was expected, suggest wrapping) - #53329 (Replace usages of ptr::offset with ptr::{add,sub}.) - #53363 (add individual docs to `core::num::NonZero*`) - #53370 (Stabilize macro_vis_matcher) - #53393 (Mark libserialize functions as inline) - #53405 (restore the page title after escaping out of a search) - #53452 (Change target triple used to check for lldb in build-manifest) - #53462 (Document Box::into_raw returns non-null ptr) - #53465 (Remove LinkMeta struct) - #53492 (update lld submodule to include RISCV patch) - #53496 (Fix typos found by codespell.) - #53521 (syntax: Optimize some literal parsing) - #53540 (Moved issue-53157.rs into src/test/ui/consts/const-eval/) - #53551 (Avoid some Place clones.) Failed merges: r? @ghost
2018-08-21Rollup merge of #53521 - alexcrichton:optimize-lit-token, r=michaelwoeristerkennytm-6/+4
syntax: Optimize some literal parsing Currently in the `wasm-bindgen` project we have a very very large crate that's procedurally generated, `web-sys`. To generate this crate we parse all of a browser's WebIDL and we then generate bindings for all of the APIs contained within. The resulting Rust file is 18MB large (wow!) and currently takes a very long time to compile in debug mode. On the nightly compiler a *debug* build takes 90s for the crate to finish. I was curious what was taking so long and upon investigating a *massive* portion of the time was spent in the `lit_token` method of the compiler, primarily formatting strings via `format!`. Upon some more investigation it looks like the `byte_str_lit` was allocating an error message once per byte, causing a very large number of allocations to happen for large literals, of which wasm-bindgen generates quite a few (some are MB large). This commit fixes the issue by lazily allocating the error message, only doing so if the error message is actually needed (which should be never). As a result, the debug mode compilation time for our `web-sys` crate decreased from 90s to 20s, a very nice improvement! (although we've still got some work to do).
2018-08-21Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkorkennytm-9/+9
Fix typos found by codespell.
2018-08-21Rollup merge of #53370 - jkozlowski:stabilize-macro_vis_matcher, r=cramertjkennytm-19/+3
Stabilize macro_vis_matcher This PR should stabilize [macro_vis_matcher](https://github.com/rust-lang/rust/issues/41022) feature. - [ ] "reference" book changes: https://github.com/rust-lang-nursery/reference/pull/400 - [ ] "Rust by example" book changes: https://github.com/rust-lang/rust-by-example/pull/1096 - [ ] "clippy" changes: https://github.com/rust-lang-nursery/rust-clippy/pull/3055 r? @cramertj
2018-08-20Point at the trait argument when using unboxed closureEsteban Küber-7/+8
2018-08-20Removed `raw_identifiers` feature gate.Alexander Regueiro-15/+5
2018-08-20resolve: Consolidate error reporting for resolved macros in `fn ↵Vadim Petrochenkov-20/+14
resolve_macro_to_def`
2018-08-20syntax: Optimize some literal parsingAlex Crichton-6/+4
Currently in the `wasm-bindgen` project we have a very very large crate that's procedurally generated, `web-sys`. To generate this crate we parse all of a browser's WebIDL and we then generate bindings for all of the APIs contained within. The resulting Rust file is 18MB large (wow!) and currently takes a very long time to compile in debug mode. On the nightly compiler a *debug* build takes 90s for the crate to finish. I was curious what was taking so long and upon investigating a *massive* portion of the time was spent in the `lit_token` method of the compiler, primarily formatting strings via `format!`. Upon some more investigation it looks like the `byte_str_lit` was allocating an error message once per byte, causing a very large number of allocations to happen for large literals, of which wasm-bindgen generates quite a few (some are MB large). This commit fixes the issue by lazily allocating the error message, only doing so if the error message is actually needed (which should be never). As a result, the debug mode compilation time for our `web-sys` crate decreased from 90s to 20s, a very nice improvement! (although we've still got some work to do).
2018-08-20Set applicability for more suggestions.Sébastien Duquette-2/+6
2018-08-19Switch out another use of `do catch`Scott McMurray-2/+10
2018-08-19Rename `catch_expr` feature to `try_blocks`Scott McMurray-2/+2
2018-08-19Suggest `try` if someone uses `do catch`Scott McMurray-0/+12
2018-08-19Parse try blocks with the try keyword instead of do catch placeholderScott McMurray-14/+14
2018-08-19Rename `Catch` variants to `TryBlock`Scott McMurray-11/+11
(Not `Try` since `QuestionMark` is using that.)
2018-08-19fix tidy errorsDonato Sciarra-10/+13
2018-08-19mv codemap source_mapDonato Sciarra-11/+11
2018-08-19mv codemap() source_map()Donato Sciarra-41/+41
2018-08-19mv (mod) codemap source_mapDonato Sciarra-47/+47
2018-08-19mv filemap source_fileDonato Sciarra-91/+91
2018-08-19mv FileMap SourceFileDonato Sciarra-40/+40
2018-08-19mv CodeMap SourceMapDonato Sciarra-72/+72
2018-08-19Stabilize macro_vis_matcherJakub Kozlowski-19/+3
2018-08-19Fix typos found by codespell.Matthias Krüger-9/+9
2018-08-19Auto merge of #51131 - qnighy:unsized-locals, r=eddybbors-0/+3
Implement Unsized Rvalues This PR is the first step to implement RFC1909: unsized rvalues (#48055). ## Implemented - `Sized` is removed for arguments and local bindings. (under `#![feature(unsized_locals)]`) - Unsized locations are allowed in MIR - Unsized places and operands are correctly translated at codegen ## Not implemented in this PR - Additional `Sized` checks: - tuple struct constructor (accidentally compiles now) - closure arguments at closure generation (accidentally compiles now) - upvars (ICEs now) - Generating vtable for `fn method(self)` (ICEs now) - VLAs: `[e; n]` where `n` isn't const - Reduce unnecessary allocations ## Current status - [x] Fix `__rust_probestack` (rust-lang-nursery/compiler-builtins#244) - [x] Get the fix merged - [x] `#![feature(unsized_locals)]` - [x] Give it a tracking issue number - [x] Lift sized checks in typeck and MIR-borrowck - [ ] <del>Forbid `A(unsized-expr)`</del> will be another PR - [x] Minimum working codegen - [x] Add more examples and fill in unimplemented codegen paths - [ ] <del>Loosen object-safety rules (will be another PR)</del> - [ ] <del>Implement `Box<FnOnce>` (will be another PR)</del> - [ ] <del>Reduce temporaries (will be another PR)</del>
2018-08-19Add #![feature(unsized_locals)].Masaki Hara-0/+3
2018-08-18Auto merge of #52592 - eddyb:or-default, r=Mark-Simulacrumbors-4/+3
Use the new Entry::or_default method where possible.
2018-08-18Auto merge of #53324 - alexreg:self_in_typedefs, r=eddybbors-15/+21
`Self` in type definitions (self_in_typedefs) This implements the [`self_in_typedefs` feature](https://github.com/rust-lang/rfcs/blob/master/text/2300-self-in-typedefs.md) ([tracking issue 49303](https://github.com/rust-lang/rust/issues/49303)). r? @eddyb CC @Centril
2018-08-18Added feature gate.Alexander Regueiro-15/+21
2018-08-18Use the new Entry::or_default method where possible.Eduard-Mihai Burtescu-4/+3
2018-08-17Auto merge of #50911 - petrochenkov:macuse, r=alexcrichtonbors-24/+6
Stabilize `use_extern_macros` Closes https://github.com/rust-lang/rust/issues/35896
2018-08-17Rollup merge of #53413 - eddyb:featured-in-the-latest-edition, r=varkorCorey Farwell-23/+56
Warn that `#![feature(rust_2018_preview)]` is implied when the edition is set to Rust 2018. cc @varkor @petrochenkov @joshtriplett
2018-08-17Stabilize `use_extern_macros`Vadim Petrochenkov-24/+6
2018-08-16Add some commentsvarkor-1/+1
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