summary refs log tree commit diff
path: root/src/libsyntax/ext/expand.rs
AgeCommit message (Collapse)AuthorLines
2018-04-30Remove new enum variant from #50092 backportPietro Albini-2/+0
ExpansionKind::ForeignItems was added in #49350, which is not included in the 1.26 beta.
2018-04-30Warn on pointless `#[derive]` in more placesAustin Bonander-11/+59
This fixes the regression in #49934 and ensures that unused `#[derive]`s on statements, expressions and generic type parameters survive to trip the `unused_attributes` lint. For `#[derive]` on macro invocations it has a hardcoded warning since linting occurs after expansion. This also adds regression testing for some nodes that were already warning properly. closes #49934
2018-04-02Expand attribute macros on statements and expressions.Austin Bonander-19/+70
Retains the `stmt_expr_attributes` feature requirement for attributes on expressions. closes #41475 cc #38356
2018-03-17Rename `Span::empty` to `Span::shrink_to_lo`, add `Span::shrink_to_hi`Vadim Petrochenkov-1/+1
2018-03-16Auto merge of #48524 - abonander:check-macro-stability, r=petrochenkovbors-16/+40
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-13Fix ICE on malformed plugin attributesMichael Lamparski-2/+4
2018-03-07check stability of macro invocationsAustin Bonander-16/+40
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-5/+5
2018-02-18Replace dummy spans with empty spansSeiichi Uchida-1/+1
2018-02-18Change ast::Visibility to Spanned typeSeiichi Uchida-3/+6
2018-01-26Do not capture stderr in the compiler. Instead just panic silently for fatal ↵John Kåre Alsaker-1/+1
errors
2017-12-26Do not expand a derive invocation when derive is not allowedSeiichi Uchida-79/+91
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-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-19Implement non-mod.rs mod statementsTaylor Cramer-3/+7
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-7/+7
2017-12-14Use PathBuf instead of String where applicableOliver Schneider-3/+11
2017-12-09Use hygiene to access the injected crate (`core` or `std`) from builtin macros.Jeffrey Seyfried-2/+0
2017-11-21allow loading external files in documentationQuietMisdreavus-1/+87
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-03Rename FileMap::path and change to an OptionPhilip Craig-2/+2
2017-09-30Don't use remapped path when loading modules and include filesPhilip Craig-4/+2
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-25Fix bug in collecting trait and impl items with derives.Jeffrey Seyfried-7/+1
2017-09-21suggest an outer attribute when `#![derive(...)]` (predictably) failsZack M. Davis-5/+13
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-1/+14
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-1/+2
2017-08-30Make fields of `Span` privateVadim Petrochenkov-7/+6
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-15use field init shorthand EVERYWHEREZack M. Davis-7/+8
Like #43008 (f668999), but _much more aggressive_.
2017-08-12syntax: #[allow_internal_unsafe] bypasses the unsafe_code lint in macros.Eduard-Mihai Burtescu-7/+20
2017-08-07Reexport all SyntaxExtension variantsOliver Schneider-9/+9
2017-07-28syntax: Add `tokens: Option<TokenStream>` to ItemAlex Crichton-0/+1
This commit adds a new field to the `Item` AST node in libsyntax to optionally contain the original token stream that the item itself was parsed from. This is currently `None` everywhere but is intended for use later with procedural macros.
2017-07-25Stabilize the `compile_error_macro` featureAlex Crichton-1/+0
Stabilizes: * `compile_error!` as a macro defined by rustc Closes #40872
2017-07-20Use the macro structure spans instead of the invocationEsteban Küber-0/+1
2017-06-26Add `LazyTokenStream`.Jeffrey Seyfried-30/+10
2017-06-26Simplify `hygiene::Mark` application, andJeffrey Seyfried-20/+16
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-06-19Add compile_error!Wesley Wiser-0/+1
Related to #40872
2017-05-31Extend the unused macro lint to macros 2.0est31-2/+3
2017-05-25Hygienize `librustc_resolve`.Jeffrey Seyfried-15/+27
2017-05-17Auto merge of #42049 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-15/+11
Rollup of 5 pull requests - Successful merges: #41937, #41957, #42017, #42039, #42046 - Failed merges:
2017-05-13Support #[allow] etc logic on a per macro levelest31-1/+1
This commit extends the current unused macro linter to support directives like #[allow(unused_macros)] or #[deny(unused_macros)] directly next to the macro definition, or in one of the modules the macro is inside. Before, we only supported such directives at a per crate level, due to the crate's NodeId being passed to session.add_lint. We also had to implement handling of the macro's NodeId in the lint visitor.
2017-05-12Fix some clippy warnings in libsyntaxAndre Bogus-15/+11
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-05-08Rollup merge of #41520 - estebank:trace-macro, r=nikomatsakisCorey Farwell-1/+1
Use diagnostics for trace_macro instead of println When using `trace_macro`, use `span_label`s instead of `println`: ```rust note: trace_macro --> $DIR/trace-macro.rs:14:5 | 14 | println!("Hello, World!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expands to `println! { "Hello, World!" }` = note: expands to `print! { concat ! ( "Hello, World!" , "\n" ) }` ``` Fix #22597.
2017-05-06Group "macro expansion" notes per call spanEsteban Küber-1/+1
2017-05-01Increase macro recursion limit to 1024 Fixes #22552Charlie Sheridan-1/+1
2017-04-26Implement a file-path remapping feature in support of debuginfo and ↵Michael Woerister-1/+1
reproducible builds.