Austin Bonander
7c0124dd35
Expand attribute macros on statements and expressions.
...
Retains the `stmt_expr_attributes` feature requirement for attributes on expressions.
closes #41475
cc #38356
2018-04-02 01:56:12 -07:00
Lymia Aluysia
fad1648e0f
Initial implementation of RFC 2151, Raw Identifiers
2018-03-18 10:07:19 -05:00
Austin Bonander
69035f20b9
check stability of macro invocations
2018-03-07 16:52:28 -08:00
John Kåre Alsaker
b74e97cf42
Replace Rc with Lrc for shared data
2018-03-02 10:48:52 +01:00
Michael Lamparski
1137fb1935
libsyntax/ext: trailing commas in builtin macros
...
Most notably this changes 'syntax::ext::base::get_single_str_from_tts'
to accept a trailing comma, and revises the documentation so that this
aspect is not surprising. I made this change under the understanding
that this crate is private rustc implementation detail (I hope this is
correct!). After reviewing all call sites, I believe the revised
semantics are closer to the intended spirit of the function.
2018-02-07 12:48:21 -05:00
John Kåre Alsaker
9a8d6b8bb5
Do not capture stderr in the compiler. Instead just panic silently for fatal errors
2018-01-26 04:52:30 +01:00
Esteban Küber
a4660dfea2
Point at unused arguments for format string
...
Avoid overlapping spans by only pointing at the arguments that are not
being used in the argument string. Enable libsyntax to have diagnostics
with multiple primary spans by accepting `Into<MultiSpan>` instead of
`Span`.
2018-01-15 21:38:12 -08:00
Malo Jaffré
cbb32a9418
Fix docs for future pulldown migration
2018-01-01 14:44:12 +01:00
Seiichi Uchida
18da3c671b
Do not expand a derive invocation when derive is not allowed
...
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-26 16:47:32 +09:00
Taylor Cramer
07f51fb868
Implement non-mod.rs mod statements
2017-12-19 14:58:51 -08:00
Vadim Petrochenkov
a4aa26aaa0
syntax: Rename P::unwrap
into P::into_inner
2017-12-17 02:21:29 +03:00
Jeffrey Seyfried
9c7969d3df
Use hygiene to access the injected crate (core
or std
) from builtin macros.
2017-12-09 17:22:07 -08:00
QuietMisdreavus
f9f3611f5c
allow loading external files in documentation
...
Partial implementation of https://github.com/rust-lang/rfcs/pull/1990
(needs error reporting work)
cc #44732
2017-11-21 15:46:49 -06:00
Zack M. Davis
083f053294
suggest an outer attribute when #![derive(...)]
(predictably) fails
2017-09-21 21:20:31 -07:00
Tim Neumann
bc638b8635
Rollup merge of #44088 - bjorn3:better_trace_macros, r=jseyfried
...
Fix "new trace_macros doesn't work if there's an error during expansion"
Fixes #43493
2017-09-17 13:19:00 +02:00
bjorn3
8b71e0bbd5
Better trace-macro and less span_err_fatal
2017-09-02 18:13:25 +02:00
Vadim Petrochenkov
3da868dcb6
Make fields of Span
private
2017-08-30 01:38:54 +03:00
Zack M. Davis
1b6c9605e4
use field init shorthand EVERYWHERE
...
Like #43008 (f668999), but _much more aggressive_.
2017-08-15 15:29:17 -07:00
Eduard-Mihai Burtescu
8a4facc3c3
syntax: #[allow_internal_unsafe] bypasses the unsafe_code lint in macros.
2017-08-12 09:14:50 +03:00
Oliver Schneider
970c78094f
Reexport all SyntaxExtension variants
2017-08-07 10:22:28 +02:00
Vadim Petrochenkov
1e8a7f68e9
Avoid duplicated errors for generic arguments in macro paths
2017-07-27 23:01:17 +03:00
Jeffrey Seyfried
7d493bdd2a
Add LazyTokenStream
.
2017-06-26 02:06:31 +00:00
Jeffrey Seyfried
e42836b208
Implement quote!
and other proc_macro
API.
2017-06-26 02:06:26 +00:00
Jeffrey Seyfried
d4488b7df9
Simplify hygiene::Mark
application, and
...
remove variant `Token::SubstNt` in favor of `quoted::TokenTree::MetaVar`.
2017-06-26 02:05:45 +00:00
est31
602036370f
Extend the unused macro lint to macros 2.0
2017-05-31 17:03:41 +02:00
Jeffrey Seyfried
1f175fa35d
Hygienize librustc_resolve
.
2017-05-25 05:51:50 +00:00
Mark Simulacrum
8b93680d28
Rollup merge of #42006 - jseyfried:fix_include_regression, r=nrc
...
Fix ICE on `include!(line!())` (regression)
Fixes #41776 .
r? @nrc
2017-05-19 14:16:15 -06:00
bors
d8215fc238
Auto merge of #42049 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
...
Rollup of 5 pull requests
- Successful merges: #41937 , #41957 , #42017 , #42039 , #42046
- Failed merges:
2017-05-17 01:57:45 +00:00
Andre Bogus
958c67d9c8
adressed comments by @kennytm and @petrochenkov
2017-05-15 23:56:09 +02:00
Jeffrey Seyfried
4f2f27014d
Fix regression on include!(line!())
.
2017-05-15 09:41:05 +00:00
est31
d14d194f61
Support #[allow] etc logic on a per macro level
...
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-13 16:02:29 +02:00
est31
df188b8f97
Add lint for unused macros
2017-05-13 16:02:29 +02:00
Andre Bogus
a9c163ebe9
Fix some clippy warnings in libsyntax
...
This is mostly removing stray ampersands, needless returns and lifetimes.
2017-05-12 20:05:39 +02:00
Esteban Küber
8c9ad8d72c
Group "macro expansion" notes per call span
2017-05-06 00:55:42 -07:00
Esteban Küber
56411443f2
Use diagnostics for trace_macro instead of println
2017-05-05 15:51:48 -07:00
Jeffrey Seyfried
8fde04b4a2
Improve Path
spans.
2017-03-30 05:44:56 +00:00
Jeffrey Seyfried
ec7c0aece1
Merge ExpnId
and SyntaxContext
.
2017-03-29 00:41:10 +00:00
Jeffrey Seyfried
e839486318
Move resolve_invoc
from syntax
to resolve
.
2017-03-10 08:08:32 -08:00
Jeffrey Seyfried
212b6c2550
Refactor out ast::ItemKind::MacroDef
.
2017-03-10 08:08:32 -08:00
Jeffrey Seyfried
f6eaaf350e
Integrate TokenStream
.
2017-03-03 02:15:37 +00:00
bors
5907ed63d3
Auto merge of #39655 - durka:recursion-limit-suggestion, r=nikomatsakis
...
suggest doubling recursion limit in more situations
Fixes #38852 .
r? @bluss
2017-03-02 17:44:17 +00:00
Alex Burka
6e259dc778
note -> help
2017-03-02 07:11:22 +00:00
Josh Driver
4ecdc68153
Move MacroKind into Def::Macro
2017-02-23 20:12:33 +10:30
Josh Driver
2d91e7aab8
Refactor macro resolution errors + add derive macro suggestions
2017-02-16 22:03:15 +10:30
Jeffrey Seyfried
2cc61eebb7
Allow using inert attributes from proc_macro_derive
s with #![feature(proc_macro)]
.
2017-02-12 07:20:04 +00:00
Alex Burka
b4993ec863
suggest doubling recursion limit in more situations
2017-02-09 06:40:23 +00:00
Josh Driver
fbdd038866
Move derive macro expansion into the MacroExpander
...
This removes the expand_derives function, and sprinkles
the functionality throughout the Invocation Collector,
Expander and Resolver.
2017-02-05 09:31:02 +10:30
Josh Driver
0a7380d7fc
Rename CustomDerive to ProcMacroDerive for macros 1.1
2017-02-05 09:31:02 +10:30
Josh Driver
0477daf9f0
Make builtin derives a SyntaxExtension
...
This allows builtin derives to be registered and
resolved, just like other derive types.
2017-02-05 09:31:01 +10:30
Jeffrey Seyfried
debcbf0b8e
Refactor the parser to consume token trees.
2017-01-17 08:17:26 +00:00