about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-03-17Auto merge of #48904 - Zoxc:code-and-file-maps, r=michaelwoeristerbors-41/+43
Make CodeMap and FileMap thread-safe r? @michaelwoerister
2018-03-16Auto merge of #48524 - abonander:check-macro-stability, r=petrochenkovbors-17/+56
check stability of macro invocations I haven't implemented tests yet but this should be a pretty solid prototype. I think as-implemented it will also stability-check macro invocations in the same crate, dunno if we want that or not. I don't know if we want this to go through `rustc::middle::stability` or not, considering the information there wouldn't be available at the time of macro expansion (even for external crates, right?). r? @nrc closes #34079 cc @petrochenkov @durka @jseyfried #38356
2018-03-16Auto merge of #49051 - kennytm:rollup, r=kennytmbors-10/+42
Rollup of 17 pull requests - Successful merges: #48706, #48875, #48892, #48922, #48957, #48959, #48961, #48965, #49007, #49024, #49042, #49050, #48853, #48990, #49037, #49049, #48972 - Failed merges:
2018-03-16Rollup merge of #48990 - ExpHP:dont-drop-the-bomb, r=estebankkennytm-2/+4
Fix ICE on malformed plugin attributes See #48941 for some discussion. This bug had several duplicate reports which were never closed as dupes: Fixes #47612 Fixes #48387 Fixes #48941 Fixes #48982
2018-03-16Rollup merge of #49007 - estebank:follow-up-47574, r=oli-obkkennytm-7/+15
Some tweaks to "type parameters from outer function" diagnostic Follow up to #47574.
2018-03-16Rollup merge of #48922 - petrochenkov:asunder, r=nikomatsakiskennytm-1/+23
Implement import renaming with `_` (RFC 2166) cc https://github.com/rust-lang/rust/issues/48216
2018-03-15Disallow &a..=b and box a..=b in pattern.kennytm-2/+27
They are disallowed because they have different precedence than expressions. I assume parenthesis in pattern will be soon stabilized and thus write that as suggestion directly.
2018-03-15Stabilize `dotdoteq_in_patterns` language feature.kennytm-8/+3
Stabilize `match 2 { 1..=3 => {} }`.
2018-03-15Stabilize `inclusive_range_syntax` language feature.kennytm-12/+2
Stabilize the syntax `a..=b` and `..=b`.
2018-03-14Auto merge of #47630 - canndrew:exhaustive-patterns, r=nikomatsakisbors-6/+2
Stabilise feature(never_type). Introduce feature(exhaustive_patterns) This stabilizes `!`, removing the feature gate as well as the old defaulting-to-`()` behavior. The pattern exhaustiveness checks which were covered by `feature(never_type)` have been moved behind a new `feature(exhaustive_patterns)` gate.
2018-03-15Use a single Lock for CodeMap.stable_id_to_filemap and CodeMap.filesJohn Kåre Alsaker-25/+32
2018-03-15Require the code mapper to be thread-safeJohn Kåre Alsaker-2/+2
2018-03-15Make CodeMap thread-safeJohn Kåre Alsaker-22/+17
2018-03-15Require a thread-safe file loaderJohn Kåre Alsaker-2/+2
2018-03-14Some tweaks to "type parameters from outer function" diagnosticEsteban Küber-7/+15
Follow up to #47574.
2018-03-14Remove syntax and syntax_pos thread localsJohn Kåre Alsaker-521/+643
2018-03-14Implement import renaming with `_` (RFC 2166)Vadim Petrochenkov-1/+23
2018-03-14stabilise feature(never_type)Andrew Cann-6/+2
Replace feature(never_type) with feature(exhaustive_patterns). feature(exhaustive_patterns) only covers the pattern-exhaustives checks that used to be covered by feature(never_type)
2018-03-13Fix ICE on malformed plugin attributesMichael Lamparski-2/+4
2018-03-11in which some labels and notes are upgraded to structured suggestionsZack M. Davis-5/+8
(Meanwhile, a couple of parse-fail tests are moved to UI tests so that the reader can see the new output, and an existing UI test is given a more evocative name.)
2018-03-10Auto merge of #47574 - zilbuz:issue-14844, r=nikomatsakisbors-3/+63
Show the used type variable when issuing a "can't use type parameters from outer function" error message Fix #14844 r? @estebank
2018-03-09Auto merge of #48326 - RalfJung:generic-bounds, r=petrochenkovbors-12/+22
Warn about ignored generic bounds in `for` This adds a new lint to fix #42181. For consistency and to avoid code duplication, I also moved the existing "bounds in type aliases are ignored" here. Questions to the reviewer: * Is it okay to just remove a diagnostic error code like this? Should I instead keep the warning about type aliases where it is? The old code provided a detailed explanation of what's going on when asked, that information is now lost. On the other hand, `span_warn!` seems deprecated (after this patch, it has exactly one user left!). * Did I miss any syntactic construct that can appear as `for` in the surface syntax? I covered function types (`for<'a> fn(...)`), generic traits (`for <'a> Fn(...)`, can appear both as bounds as as trait objects) and bounds (`for<'a> F: ...`). * For the sake of backwards compatibility, this adds a warning, not an error. @nikomatsakis suggested an error in https://github.com/rust-lang/rust/issues/42181#issuecomment-306924389, but I feel that can only happen in a new epoch -- right? Cc @eddyb
2018-03-08Rollup merge of #48801 - Manishearth:epoch-features, r=nikomatsakisManish Goregaokar-189/+274
Add functionality for gating feature flags on epochs ; rejigger epoch lints fixes #48794 r? @nikomatsakis
2018-03-08Rollup merge of #48527 - zackmdavis:and_the_social_construction_of_tuples, ↵Manish Goregaokar-5/+39
r=estebank in which parentheses are suggested for should-have-been-tuple-patterns ![destructure_suggest_parens](https://user-images.githubusercontent.com/1076988/36638335-48b082d4-19a7-11e8-9726-0d043544df2f.png) Programmers used to working in some other languages (such as Python or Go) might expect to be able to destructure values with comma-separated identifiers but no parentheses on the left side of an assignment. Previously, the first name in such code would get parsed as a single-indentifier pattern—recognizing, for example, the `let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax error on seeing an unexpected comma rather than the expected semicolon (all the way nearer to the end of `parse_full_stmt`). Instead, let's look for that comma when parsing the pattern, and if we see it, make-believe that we're parsing the remaining elements in a tuple pattern, so that we can suggest wrapping it all in parentheses. We need to do this in a separate wrapper method called on a "top-level" pattern, rather than within `parse_pat` itself, because `parse_pat` gets called recursively to parse the sub-patterns within a tuple pattern. ~~We could also do this for `match` arms, `if let`, and `while let`, but we elect not to in this patch, as it seems less likely for users to make the mistake in those contexts.~~ Resolves #48492. r? @petrochenkov
2018-03-08Note the future epoch for epoch lintsManish Goregaokar-6/+8
2018-03-08Make it possible to ungate features by epochManish Goregaokar-6/+19
2018-03-08Allow mentioning an optional epoch on featuresManish Goregaokar-185/+186
2018-03-08Move epochs to libsyntaxManish Goregaokar-0/+69
2018-03-08Add codemap functions to retrieve the source before a given spanBasile Desloges-3/+63
2018-03-08in which parentheses are suggested for should-have-been-tuple-patternsZack M. Davis-5/+39
Programmers used to working in some other languages (such as Python or Go) might expect to be able to destructure values with comma-separated identifiers but no parentheses on the left side of an assignment. Previously, the first name in such code would get parsed as a single-indentifier pattern—recognizing, for example, the `let a` in `let a, b = (1, 2);`—whereupon we would have a fatal syntax error on seeing an unexpected comma rather than the expected semicolon (all the way nearer to the end of `parse_full_stmt`). Instead, let's look for that comma when parsing the pattern, and if we see it, momentarily make-believe that we're parsing the remaining elements in a tuple pattern, so that we can suggest wrapping it all in parentheses. We need to do this in a separate wrapper method called on the top-level pattern (or `|`-patterns) in a `let` statement, `for` loop, `if`- or `while let` expression, or match arm rather than within `parse_pat` itself, because `parse_pat` gets called recursively to parse the sub-patterns within a tuple pattern. Resolves #48492.
2018-03-08Rollup merge of #48808 - Zoxc:reg-diag, r=michaelwoeristerManish Goregaokar-20/+12
Move REGISTERED_DIAGNOSTICS to a ParseSess field r? @michaelwoerister
2018-03-08Stabilize const_indexing featureOliver Schneider-3/+2
2018-03-08Move REGISTERED_DIAGNOSTICS to a ParseSess fieldJohn Kåre Alsaker-20/+12
2018-03-07check stability of macro invocationsAustin Bonander-17/+56
2018-03-06Add `inline` to `TransFnAttrs`Wesley Wiser-114/+1
Part of #47320
2018-03-06note a FIXMERalf Jung-0/+1
2018-03-06make bounds on higher-kinded lifetimes a hard error in ast_validationRalf Jung-12/+2
Also move the check for not having type parameters into ast_validation. I was not sure what to do with compile-fail/issue-23046.rs: The issue looks like maybe the bounds actually played a role in triggering the ICE, but that seems unlikely given that the compiler seems to entirely ignore them. However, I couldn't find a testcase without the bounds, so I figured the best I could do is to just remove the bounds and make sure at least that keeps working.
2018-03-06Rollup merge of #48546 - GuillaumeGomez:raw-string-error-note, r=estebankkennytm-8/+25
Raw string error note Fixes #48395. I think this note should be helpful enough to solve the issue.
2018-03-06Rollup merge of #48403 - lukaslueg:casted, r=steveklabnikkennytm-1/+1
Fix spelling s/casted/cast/ r? @GuillaumeGomez
2018-03-05Turn features() into a query.Michael Woerister-17/+22
2018-03-04Add note for unterminated raw string errorGuillaume Gomez-8/+25
2018-03-03rust: Import LLD for linking wasm objectsAlex Crichton-8/+0
This commit imports the LLD project from LLVM to serve as the default linker for the `wasm32-unknown-unknown` target. The `binaryen` submoule is consequently removed along with "binaryen linker" support in rustc. Moving to LLD brings with it a number of benefits for wasm code: * LLD is itself an actual linker, so there's no need to compile all wasm code with LTO any more. As a result builds should be *much* speedier as LTO is no longer forcibly enabled for all builds of the wasm target. * LLD is quickly becoming an "official solution" for linking wasm code together. This, I believe at least, is intended to be the main supported linker for native code and wasm moving forward. Picking up support early on should help ensure that we can help LLD identify bugs and otherwise prove that it works great for all our use cases! * Improvements to the wasm toolchain are currently primarily focused around LLVM and LLD (from what I can tell at least), so it's in general much better to be on this bandwagon for bugfixes and new features. * Historical "hacks" like `wasm-gc` will soon no longer be necessary, LLD will [natively implement][gc] `--gc-sections` (better than `wasm-gc`!) which means a postprocessor is no longer needed to show off Rust's "small wasm binary size". LLD is added in a pretty standard way to rustc right now. A new rustbuild target was defined for building LLD, and this is executed when a compiler's sysroot is being assembled. LLD is compiled against the LLVM that we've got in tree, which means we're currently on the `release_60` branch, but this may get upgraded in the near future! LLD is placed into rustc's sysroot in a `bin` directory. This is similar to where `gcc.exe` can be found on Windows. This directory is automatically added to `PATH` whenever rustc executes the linker, allowing us to define a `WasmLd` linker which implements the interface that `wasm-ld`, LLD's frontend, expects. Like Emscripten the LLD target is currently only enabled for Tier 1 platforms, notably OSX/Windows/Linux, and will need to be installed manually for compiling to wasm on other platforms. LLD is by default turned off in rustbuild, and requires a `config.toml` option to be enabled to turn it on. Finally the unstable `#![wasm_import_memory]` attribute was also removed as LLD has a native option for controlling this. [gc]: https://reviews.llvm.org/D42511
2018-03-02Rollup merge of #48338 - estebank:match-missing-comma, r=petrochenkovManish Goregaokar-31/+121
Fixes #47311. r? @nrc
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-91/+91
2018-03-01Rollup merge of #48522 - ↵Manish Goregaokar-8/+11
etaoins:fix-find-width-of-character-at-span-bounds-check, r=estebank Fix find_width_of_character_at_span bounds check Commit 0bd96671f0 added bounds checking of our current target byte position to prevent infinite loops. Unfortunately it was comparing the file-relative `target` versus the global `file_start_pos` and `file_end_pos`. The result is failing to detect multibyte characters unless their file-relative offset fit within their global offset. This causes other parts of the compiler to generate spans pointing to the middle of a multibyte character which will ultimately panic in `bytepos_to_file_charpos`. Fix by comparing the `target` to the total file size when moving forward and doing checked subtraction when moving backwards. This should preserve the intent of the bounds check while removing the offset confusion. cc @davidtwco Fixes #48508
2018-03-01Rollup merge of #48500 - petrochenkov:parpat, r=nikomatsakisManish Goregaokar-28/+58
Support parentheses in patterns under feature gate This is a prerequisite for any other extensions to pattern syntax - `|` with multiple patterns, type ascription, `..PAT` in slice patterns. Closes https://github.com/rust-lang/rfcs/issues/554
2018-03-01Fix spelling s/casted/cast/Lukas Lueg-1/+1
2018-02-28Rollup merge of #48380 - nikomatsakis:issue-48251-master, r=acrichtoManish Goregaokar-1/+73
Fixes #47311. r? @nrc
2018-02-28Rollup merge of #48359 - jsgf:remap-path-prefix, r=sanxiynManish Goregaokar-1/+1
Fixes #47311. r? @nrc
2018-03-01Support parentheses in patterns under feature gateVadim Petrochenkov-28/+58
Improve recovery for trailing comma after `..`