about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2018-01-04rustc: use {U,I}size instead of {U,I}s shorthands.Eduard-Mihai Burtescu-5/+5
2018-01-01Fix docs for future pulldown migrationMalo Jaffré-1/+2
2017-12-28CleanupMatt Peterson-4/+4
2017-12-28Add feature gate macro_lifetime_matcherMatt Peterson-1/+13
2017-12-28Fix build and add a macro lifetime labels testMatt Peterson-2/+1
2017-12-28replace parse_lifetime with expect_lifetimeMichael Hewson-1/+1
made `parser::Parser::expect_lifetime` public, so it can be called from `macro_parser::parse_nt`
2017-12-28Resurrecting #33135Michael Hewson-7/+16
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-79/+103
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-28Auto merge of #47017 - topecongiro:issue-33469, r=estebankbors-1/+5
Do not panic on interpolated token inside quote macro Closes #33469.
2017-12-26Do not panic on interpolated token inside quote macroSeiichi Uchida-1/+5
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-24Make column macro output 1 based and document itest31-1/+1
2017-12-22Auto merge of #46732 - estebank:silence-recovered-blocks, r=petrochenkovbors-0/+1
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/+11
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-0/+1
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-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-21Add GenericParam, refactor Generics in ast, hir, rustdocJonas Platte-1/+1
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-19Implement non-mod.rs mod statementsTaylor Cramer-5/+9
2017-12-19add files loaded through doc(include) into dep-infoQuietMisdreavus-0/+4
2017-12-19turn errors with external docs into actual errorsQuietMisdreavus-7/+7
2017-12-17syntax: Rename `P::unwrap` into `P::into_inner`Vadim Petrochenkov-9/+9
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-23/+32
2017-12-09Use hygiene to access the injected crate (`core` or `std`) from builtin macros.Jeffrey Seyfried-12/+10
2017-11-30Implement RFC 2128 (use_nested_groups)Pietro Albini-19/+22
This commit adds support for nested groups inside `use` declarations, such as `use foo::{bar, sub::{baz::Foo, *}};`.
2017-11-26limit packed copy-out to non-generic Copy structsAriel Ben-Yehuda-1/+1
2017-11-21allow loading external files in documentationQuietMisdreavus-1/+89
Partial implementation of https://github.com/rust-lang/rfcs/pull/1990 (needs error reporting work) cc #44732
2017-11-14avoid the pprust infrastructure in macro expansionAriel Ben-Yehuda-3/+24
This changes macro expansion to format the path of a macro directly instead of usng the pprust infrastructure. The pprust infrastructure tries to perform line-breaking in a slow fashion, which is undesired when formatting the path of a macro. This should to speed up expansion by a fair amount (I saw 20% on a profiler on `rustc_mir`, and 50% of the time marked as "expansion" in the profiler/time-passes is actually spent loading dependencies).
2017-10-17Lifting Generics from MethodSig to TraitItem and ImplItem since we want to ↵Sunjay Varma-2/+3
support generics in each variant of TraitItem and ImplItem
2017-10-03Rename FileMap::path and change to an OptionPhilip Craig-3/+3
2017-09-30Don't use remapped path when loading modules and include filesPhilip Craig-5/+3
2017-09-28Auto merge of #44528 - tmnilsson:attr_proc_macro_cfg_process, r=jseyfriedbors-14/+25
Apply attr proc macros before cfg processing Fixes #39336. r? @jseyfried
2017-09-27Apply attr proc macros before cfg processingTomas Nilsson-14/+25
Now items are not fully configured until right before expanding derives.
2017-09-27Auto merge of #44709 - Badel2:inclusive-range-dotdoteq, r=petrochenkovbors-0/+2
Initial support for `..=` syntax #28237 This PR adds `..=` as a synonym for `...` in patterns and expressions. Since `...` in expressions was never stable, we now issue a warning. cc @durka r? @aturon
2017-09-25Fix bug in collecting trait and impl items with derives.Jeffrey Seyfried-7/+1
2017-09-22Add support for `..=` syntaxAlex Burka-0/+2
Add ..= to the parser Add ..= to libproc_macro Add ..= to ICH Highlight ..= in rustdoc Update impl Debug for RangeInclusive to ..= Replace `...` to `..=` in range docs Make the dotdoteq warning point to the ... Add warning for ... in expressions Updated more tests to the ..= syntax Updated even more tests to the ..= syntax Updated the inclusive_range entry in unstable book
2017-09-21suggest an outer attribute when `#![derive(...)]` (predictably) failsZack M. Davis-5/+17
2017-09-21only set non-ADT derive error once per attribute, not per traitZack M. Davis-0/+18
A slight eccentricity of this change is that now non-ADT-derive errors prevent derive-macro-not-found errors from surfacing (see changes to the gating-of-derive compile-fail tests). Resolves #43927.
2017-09-17Rollup merge of #44088 - bjorn3:better_trace_macros, r=jseyfriedTim Neumann-3/+20
Fix "new trace_macros doesn't work if there's an error during expansion" Fixes #43493
2017-09-02Better trace-macro and less span_err_fatalbjorn3-2/+5
2017-09-02Dont abort on first macro errorbjorn3-1/+3
2017-09-01Implement RFC 1925Matt Ickstadt-1/+2
2017-08-30Make fields of `Span` privateVadim Petrochenkov-26/+26
2017-08-27Fix errorbjorn3-1/+0
2017-08-25Fix #43493 (new trace_macros doesn't work if there's an error during expansion)bjorn3-0/+13
2017-08-21Auto merge of #43540 - petrochenkov:pathrelax, r=nikomatsakisbors-3/+1
syntax: Relax path grammar TLDR: Accept the disambiguator `::` in "type" paths (`Type::<Args>`), accept the disambiguator `::` before parenthesized generic arguments (`Fn::(Args)`). The "turbofish" disambiguator `::<>` in expression paths is a necessary evil required for path parsing to be both simple and to give reasonable results. Since paths in expressions usually refer to values (but not necessarily, e.g. `Struct::<u8> { field: 0 }` is disambiguated, but refers to a type), people often consider `::<>` to be inherent to *values*, and not *expressions* and want to write disambiguated paths for values even in contexts where disambiguation is not strictly necessary, for example when a path is passed to a macro `m!(Vec::<i32>::new)`. The problem is that currently, if the disambiguator is not *required*, then it's *prohibited*. This results in confusion - see https://github.com/rust-lang/rust/issues/41740, https://internals.rust-lang.org/t/macro-path-uses-novel-syntax/5561. This PR makes the disambiguator *optional* instead of prohibited in contexts where it's not strictly required, so people can pass paths to macros in whatever form they consider natural (e.g. disambiguated form for value paths). This PR also accepts the disambiguator in paths with parenthesized arguments (`Fn::(Args)`) for consistency and to simplify testing of stuff like https://github.com/rust-lang/rust/pull/41856#issuecomment-301219194. Closes https://github.com/rust-lang/rust/issues/41740 cc @rust-lang/lang r? @nikomatsakis
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-57/+58
Like #43008 (f668999), but _much more aggressive_.
2017-08-13Rollup merge of #43782 - nrc:include, r=GuillaumeGomezGuillaume Gomez-5/+6
Fix include! in doc tests By making the path relative to the current file. Fixes #43153 [breaking-change] - if you use `include!` inside a doc test, you'll need to change the path to be relative to the current file rather than relative to the working directory.
2017-08-12syntax: #[allow_internal_unsafe] bypasses the unsafe_code lint in macros.Eduard-Mihai Burtescu-15/+41
2017-08-11Rollup merge of #43712 - oli-obk:cfg, r=arielb1Guillaume Gomez-10/+10
Reexport all SyntaxExtension variants This was previously done very inconsistently and made matches look weird since some variants had the `SyntaxExtension::` prefix while others didn't.
2017-08-11Issue warnings for unnecessary path disambiguatorsVadim Petrochenkov-3/+1