about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2017-12-28Fix testsMatt Peterson-9/+27
2017-12-28Fix build and add a macro lifetime labels testMatt Peterson-2/+1
2017-12-28replace parse_lifetime with expect_lifetimeMichael Hewson-2/+2
made `parser::Parser::expect_lifetime` public, so it can be called from `macro_parser::parse_nt`
2017-12-28Resurrecting #33135Michael Hewson-7/+20
Started rebasing @sgrif's PR #33135 off of current master. (Well, actually merging it into a new branch based off current master.) The following files still need to be fixed or at least reviewed: - `src/libsyntax/ext/tt/macro_parser.rs`: calls `Parser::parse_lifetime`, which doesn't exist anymore - `src/libsyntax/parse/parser.rs`: @sgrif added an error message to `Parser::parse_lifetime`. Code has since been refactored, so I just took it out for now. - `src/libsyntax/ext/tt/transcribe.rs`: This code has been refactored bigtime. Not sure whether @sgrif's changes here are still necessary. Took it out for this commit.
2017-12-28Auto merge of #47013 - topecongiro:issue-46655, r=petrochenkovbors-82/+106
Do not expand a derive invocation when derive is not allowed Closes #46655. The first commit is what actually closes #46655. The second one is just a refactoring I have done while waiting on a test.
2017-12-28Prefer to use attr::contains_name() and attr::find_by_name()Seiichi Uchida-3/+3
2017-12-28Auto merge of #47017 - topecongiro:issue-33469, r=estebankbors-1/+5
Do not panic on interpolated token inside quote macro Closes #33469.
2017-12-27Auto merge of #46479 - bkchr:termination_trait, r=arielb1bors-0/+3
Implements RFC 1937: `?` in `main` This is the first part of the RFC 1937 that supports new `Termination` trait in the rust `main` function. Thanks @nikomatsakis, @arielb1 and all other people in the gitter channel for all your help! The support for doctest and `#[test]` is still missing, bu as @nikomatsakis said, smaller pull requests are better :)
2017-12-27Auto merge of #46977 - est31:column_fix, r=dtolnaybors-1/+1
Make the output of the column! macro 1 based Fixes #46868. I didn't add any regression tests as the change already had to change tests inside the codebase. r? @dtolnay
2017-12-27Auto merge of #46803 - estebank:non-ascii-def-span, r=petrochenkovbors-1/+3
Use def span for non-ascii ident feature gate error
2017-12-26Do not panic on interpolated token inside quote macroSeiichi Uchida-1/+5
2017-12-26Adds termination_trait feature gateBastian Köcher-0/+3
2017-12-26Do not expand a derive invocation when derive is not allowedSeiichi Uchida-79/+103
1. Change the return type of `expand_invoc()` and its subroutines to `Option<Expansion>` from `Expansion`. 2. Return `None` when expanding a derive invocation if the item cannot have derive on it (in `expand_derive_invoc()`).
2017-12-25"incompatible arm" diagnostic span tweakEsteban Küber-0/+6
Use span label instead of span note for single line spans in "incompatible arm" diagnostic.
2017-12-24Auto merge of #46888 - cramertj:nested-impl-trait-error, r=nikomatsakisbors-2/+70
Add a feature gate for nested uses of `impl Trait` This allows us to delay stabilization of nested `impl Trait` until we have a plan to solve the problem posed [here](https://github.com/rust-lang/rust/issues/34511#issuecomment-350715858). r? @nikomatsakis
2017-12-24Make column macro output 1 based and document itest31-1/+1
2017-12-22Auto merge of #46779 - Zoxc:par-merge-without-sync, r=arielb1bors-9/+8
Work towards thread safety in rustc This PR is split out from https://github.com/rust-lang/rust/pull/45912. It contains changes which do not require the `sync` module.
2017-12-22Auto merge of #46732 - estebank:silence-recovered-blocks, r=petrochenkovbors-3/+10
Do not emit type errors on recovered blocks When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user. Fix #44579.
2017-12-21Auto merge of #46922 - kennytm:rollup, r=kennytmbors-7/+13
Rollup of 14 pull requests - Successful merges: #46636, #46780, #46784, #46809, #46814, #46820, #46839, #46847, #46858, #46878, #46884, #46890, #46898, #46918 - Failed merges:
2017-12-21Do not emit type errors on recovered blocksEsteban Küber-3/+10
When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user.
2017-12-21Auto merge of #45930 - jplatte:generics_refactoring, r=eddybbors-161/+184
Generics refactoring (groundwork for const generics) These changes were suggested by @eddyb. After this change, the `Generics` contain one `Vec` of an enum for the generic parameters, rather than two separate `Vec`s for lifetime and type parameters. Type params and const params will need to be in a shared `Vec` to preserve their ordering, and moving lifetimes into the same `Vec` should simplify the code that processes `Generics`.
2017-12-22Rollup merge of #46858 - QuietMisdreavus:external-doc-error, r=estebankkennytm-7/+11
tweaks and fixes for doc(include) This PR makes a handful of changes around `#[doc(include="file.md")]` (https://github.com/rust-lang/rust/issues/44732): * Turns errors when loading files into full errors. This matches the original RFC text. * Makes the `missing_docs` lint check for `#[doc(include="file.md")]` as well as regular `#[doc="text"]` attributes. * Loads files included by `#[doc(include="file.md")]` into dep-info, mirroring the behavior of `include_str!()` and friends. * Adds or modifies tests to check for all of these.
2017-12-22Rollup merge of #46839 - michaelwoerister:faster-span-hashing-2, r=nikomatsakiskennytm-0/+2
incr.comp.: Precompute small hash for filenames to save some work. For each span we hash the filename of the file it points to. Since filenames can be quite long, especially with absolute paths, this PR pre-computes a hash of the filename and we then only hash the hash. r? @nikomatsakis
2017-12-21Make mk_attr_id thread safeJohn Kåre Alsaker-9/+8
2017-12-21Add a feature gate for nested uses of `impl Trait`Taylor Cramer-2/+70
2017-12-21Add GenericParam, refactor Generics in ast, hir, rustdocJonas Platte-161/+184
The Generics now contain one Vec of an enum for the generic parameters, rather than two separate Vec's for lifetime and type parameters. Additionally, places that previously used Vec<LifetimeDef> now use Vec<GenericParam> instead.
2017-12-21Rollup merge of #46827 - petrochenkov:assocrecov2, r=estebankGuillaume Gomez-67/+76
syntax: Follow-up to the incorrect qpath recovery PR cc https://github.com/rust-lang/rust/pull/46788 Add tests checking that "priority" of qpath recovery is higher than priority of unary and binary operators Fix regressed parsing of paths with fn-like generic arguments r? @estebank
2017-12-21Auto merge of #46531 - cramertj:no-mo-modrs, r=nikomatsakisbors-50/+140
Implement non-mod.rs mod statements Fixes https://github.com/rust-lang/rust/issues/45385, cc https://github.com/rust-lang/rust/issues/44660 This will fail tidy right now because it doesn't recognize my UI tests as feature-gate tests. However, I'm not sure if compile-fail will work out either because compile-fail usually requires there to be error patterns in the top-level file, which isn't possible with this feature. What's the recommended way to handle this?
2017-12-20Fix parsing of paths with fn-like generic argumentsVadim Petrochenkov-9/+11
2017-12-20Move impls for qpath recovery trait from `ast.rs`Vadim Petrochenkov-58/+65
2017-12-20Add nll feature and make nll imply nll_dump_causeSantiago Pastorino-0/+9
2017-12-20Rollup merge of #46851 - petrochenkov:tospace, r=estebankkennytm-17/+18
Fix whitespacing issues in pretty-printing of bounds cc https://github.com/rust-lang/rust/pull/46827#discussion_r157603277
2017-12-19Implement non-mod.rs mod statementsTaylor Cramer-50/+140
2017-12-19add files loaded through doc(include) into dep-infoQuietMisdreavus-0/+4
2017-12-20Fix whitespacing issues in pretty-printing of boundsVadim Petrochenkov-17/+18
2017-12-19turn errors with external docs into actual errorsQuietMisdreavus-7/+7
2017-12-19incr.comp.: Precompute small hash for filenames to save some work.Michael Woerister-0/+2
2017-12-19Remove a token after closing delimiter from the span of macro in type positiontopecongiro-1/+1
2017-12-17Use def span for non-ascii ident feature gate errorEsteban Küber-1/+3
2017-12-17syntax: recovery for incorrect associated item paths like `[T; N]::clone`Vadim Petrochenkov-20/+145
2017-12-17syntax: Rename `P::unwrap` into `P::into_inner`Vadim Petrochenkov-15/+15
2017-12-16in which `..` is suggested for erroneous `...` in struct field patternsZack M. Davis-1/+13
Resolves #46718.
2017-12-15incr.comp.: Revert hashing optimization that caused regression.Michael Woerister-4/+22
2017-12-14When attempting to write str with single quote suggest double quotesEsteban Küber-1/+27
2017-12-14Auto merge of #45047 - durka:trait-alias, r=petrochenkovbors-14/+66
trait alias infrastructure This will be an implementation of trait aliases (RFC 1733, #41517). Progress so far: - [x] Feature gate - [x] Add to parser - [x] `where` clauses - [x] prohibit LHS type parameter bounds via AST validation https://github.com/rust-lang/rust/pull/45047#discussion_r143575575 - [x] Add to AST and HIR - [x] make a separate PathSource for trait alias contexts https://github.com/rust-lang/rust/pull/45047#discussion_r143353932 - [x] Stub out enough of typeck and resolve to just barely not ICE Postponed: - [ ] Actually implement the alias part - [ ] #21903 - [ ] #24010 I need some pointers on where to start with that last one. The test currently does this: ``` error[E0283]: type annotations required: cannot resolve `_: CD` --> src/test/run-pass/trait-alias.rs:34:16 | 34 | let both = foo(); | ^^^ | = note: required by `foo` ```
2017-12-14feature gate trait aliasesAlex Burka-0/+8
2017-12-14add trait aliases to ASTAlex Burka-14/+58
2017-12-14incr.comp.: Do less hashing per Span.Michael Woerister-22/+4
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-97/+121
2017-12-13Auto merge of #46550 - jseyfried:cleanup_builtin_hygiene, r=nrcbors-26/+45
macros: hygienize use of `core`/`std` in builtin macros Today, if a builtin macro wants to access an item from `core` or `std` (depending `#![no_std]`), it generates `::core::path::to::item` or `::std::path::to::item` respectively (c.f. `fn std_path()` in `libsyntax/ext/base.rs`). This PR refactors the builtin macros to instead always emit `$crate::path::to::item` here. That is, the def site of builtin macros is taken to be in `extern crate core;` or `extern crate std;`. Since builtin macros are macros 1.0 (i.e. mostly unhygienic), changing the def site can only effect the resolution of `$crate`. r? @nrc