about summary refs log tree commit diff
path: root/src/libproc_macro
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-3369/+0
2020-07-26proc_macro: Add API for tracked access to environment variablesVadim Petrochenkov-0/+28
2020-07-15Introduce restricted-std feature.Eric Huss-0/+1
2020-05-21Add test for proc_macro::LineColumnDavid Tolnay-0/+12
2020-05-21Impl Ord for proc_macro::LineColumnDavid Tolnay-0/+15
2020-05-17Rollup merge of #72233 - dtolnay:literal, r=petrochenkovDylan DPC-5/+11
Fix {:#?} representation of proc_macro::Literal Before: ```rust TokenStream [ Ident { ident: "name", span: #0 bytes(37..41), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(42..43), }, Literal { lit: Lit { kind: Str, symbol: "SNPP", suffix: None }, span: Span { lo: BytePos(44), hi: BytePos(50), ctxt: #0 } }, Punct { ch: ',', spacing: Alone, span: #0 bytes(50..51), }, Ident { ident: "owner", span: #0 bytes(56..61), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(62..63), }, Literal { lit: Lit { kind: Str, symbol: "Canary M Burns", suffix: None }, span: Span { lo: BytePos(64), hi: BytePos(80), ctxt: #0 } }, ] ``` After: ```rust TokenStream [ Ident { ident: "name", span: #0 bytes(37..41), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(42..43), }, Literal { kind: Str, symbol: "SNPP", suffix: None, span: #0 bytes(44..50), }, Punct { ch: ',', spacing: Alone, span: #0 bytes(50..51), }, Ident { ident: "owner", span: #0 bytes(56..61), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(62..63), }, Literal { kind: Str, symbol: "Canary M Burns", suffix: None, span: #0 bytes(64..80), }, ] ```
2020-05-15Clarify use of format_args in Debug for LiteralDavid Tolnay-0/+1
2020-05-15Implement Default for proc_macro::TokenStreamDavid Tolnay-0/+7
2020-05-15Fix {:#?} representation of proc_macro::LiteralDavid Tolnay-5/+10
Before: TokenStream [ Ident { ident: "name", span: #0 bytes(37..41), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(42..43), }, Literal { lit: Lit { kind: Str, symbol: "SNPP", suffix: None }, span: Span { lo: BytePos(44), hi: BytePos(50), ctxt: #0 } }, Punct { ch: ',', spacing: Alone, span: #0 bytes(50..51), }, Ident { ident: "owner", span: #0 bytes(56..61), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(62..63), }, Literal { lit: Lit { kind: Str, symbol: "Canary M Burns", suffix: None }, span: Span { lo: BytePos(64), hi: BytePos(80), ctxt: #0 } }, ] After: TokenStream [ Ident { ident: "name", span: #0 bytes(37..41), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(42..43), }, Literal { kind: Str, symbol: "SNPP", suffix: None, span: #0 bytes(44..50), }, Punct { ch: ',', spacing: Alone, span: #0 bytes(50..51), }, Ident { ident: "owner", span: #0 bytes(56..61), }, Punct { ch: '=', spacing: Alone, span: #0 bytes(62..63), }, Literal { kind: Str, symbol: "Canary M Burns", suffix: None, span: #0 bytes(64..80), }, ]
2020-04-27Rollup merge of #68716 - petrochenkov:stabmixed, r=dtolnayDylan DPC-1/+1
Stabilize `Span::mixed_site` Closes https://github.com/rust-lang/rust/issues/65049. cc https://github.com/rust-lang/rust/issues/54727#issuecomment-580647446 Pre-requisite for https://github.com/rust-lang/rust/pull/68717 ("Stabilize fn-like proc macros in expression, pattern and statement positions"). Stabilization report: https://github.com/rust-lang/rust/pull/68716#issuecomment-581076337.
2020-04-26Stabilize `Span::mixed_site`Vadim Petrochenkov-1/+1
2020-04-26proc_macro: Fix since attributes for new Span methodsJonas Platte-2/+2
2020-04-25Auto merge of #71556 - Dylan-DPC:rollup-9ll4shr, r=Dylan-DPCbors-2/+2
Rollup of 7 pull requests Successful merges: - #69041 (proc_macro: Stabilize `Span::resolved_at` and `Span::located_at`) - #69813 (Implement BitOr and BitOrAssign for the NonZero integer types) - #70712 (stabilize BTreeMap::remove_entry) - #71168 (Deprecate `{Box,Rc,Arc}::into_raw_non_null`) - #71544 (Replace filter_map().next() calls with find_map()) - #71545 (Fix comment in docstring example for Error::kind) - #71548 (Add missing Send and Sync impls for linked list Cursor and CursorMut.) Failed merges: r? @ghost
2020-04-25Bump rustfmt to most recently shippedMark Rousskov-2/+2
2020-04-25Bump bootstrap compilerMark Rousskov-3/+2
2020-04-25proc_macro: Stabilize `Span::resolved_at` and `Span::located_at`Vadim Petrochenkov-2/+2
2020-04-22Add tracking issue for proc_macro_is_availableDavid Tolnay-1/+1
2020-04-21proc_macro::is_available()David Tolnay-0/+25
2020-03-26introduce `negative_impls` feature gate and documentNiko Matsakis-0/+1
They used to be covered by `optin_builtin_traits` but negative impls are now applicable to all traits, not just auto traits. This also adds docs in the unstable book for the current state of auto traits.
2020-03-15Use min_specialization in libstd and libproc_macroMatthew Jasper-1/+2
2020-03-11Give LexError more descriptive Display implKinsey Favre-1/+1
2020-03-11Correct stability attribute for new LexError implsKinsey Favre-2/+2
2020-03-11Add Display and Error impls for proc_macro::LexErrorKinsey Favre-1/+11
This should allow LexError to play much nicer with the `?` operator.
2020-03-07Rollup merge of #69773 - matthiaskrgr:typos, r=petrochenkovMazdak Farrokhzad-2/+2
fix various typos
2020-03-06Don't redundantly repeat field names (clippy::redundant_field_names)Matthias Krüger-10/+7
2020-03-06fix various typosMatthias Krüger-2/+2
2020-01-10Remove unnecessary `const_fn` feature gatesDylan MacKenzie-1/+0
This flag opts out of the min-const-fn checks entirely, which is usually not what we want. The few cases where the flag is still necessary have been annotated.
2019-12-22Format the worldMark Rousskov-143/+54
2019-11-12Snap cfgsMark Rousskov-1/+0
2019-10-28proc_macro: don't use Rust ABI fn pointers in a C ABI fn signature.Eduard-Mihai Burtescu-2/+2
2019-10-28proc_macro: consolidate bridge::client::run_expand{1,2} into one helper.Eduard-Mihai Burtescu-48/+23
2019-10-28proc_macro: remove now-unnecessary ICE workarounds from bridge::client.Eduard-Mihai Burtescu-10/+9
2019-10-25RFC 2008: StabilizationDavid Wood-1/+1
This commit stabilizes RFC 2008 (#44109) by removing the feature gate. Signed-off-by: David Wood <david@davidtw.co>
2019-10-08Stabilize mem::take (mem_take)Jon Gjengset-1/+0
Tracking issue: https://github.com/rust-lang/rust/issues/61129
2019-10-03proc_macro: Add `Span::mixed_site` exposing `macro_rules` hygieneVadim Petrochenkov-0/+10
2019-09-25Snap cfgs to new betaMark Rousskov-1/+1
2019-08-27proc_macro: Turn `quote` into a regular built-in macroVadim Petrochenkov-6/+8
Previously in was implemented using a special hack in the metadata loader
2019-08-23bootstrap: Merge the libtest build step with libstdAlex Crichton-0/+3
Since its inception rustbuild has always worked in three stages: one for libstd, one for libtest, and one for rustc. These three stages were architected around crates.io dependencies, where rustc wants to depend on crates.io crates but said crates don't explicitly depend on libstd, requiring a sysroot assembly step in the middle. This same logic was applied for libtest where libtest wants to depend on crates.io crates (`getopts`) but `getopts` didn't say that it depended on std, so it needed `std` built ahead of time. Lots of time has passed since the inception of rustbuild, however, and we've since gotten to the point where even `std` itself is depending on crates.io crates (albeit with some wonky configuration). This commit applies the same logic to the two dependencies that the `test` crate pulls in from crates.io, `getopts` and `unicode-width`. Over the many years since rustbuild's inception `unicode-width` was the only dependency picked up by the `test` crate, so the extra configuration necessary to get crates building in this crate graph is unlikely to be too much of a burden on developers. After this patch it means that there are now only two build phasese of rustbuild, one for libstd and one for rustc. The libtest/libproc_macro build phase is all lumped into one now with `std`. This was originally motivated by rust-lang/cargo#7216 where Cargo was having to deal with synthesizing dependency edges but this commit makes them explicit in this repository.
2019-08-17Serialize additional data for procedural macrosAaron Hill-0/+8
Split off from #62855 This PR deerializes the declaration `Span` and attributes for all procedural macros from their underlying function definitions. This allows Rustdoc to properly render doc comments and source links when inlining procedural macros across crates
2019-07-28Deny `unused_lifetimes` through rustbuildVadim Petrochenkov-0/+1
2019-07-28Remove lint annotations in specific crates that are already enforced by ↵Vadim Petrochenkov-2/+0
rustbuild Remove some random unnecessary lint `allow`s
2019-07-04Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, ↵Mazdak Farrokhzad-1/+2
r=dtolnay,Centril Use mem::take instead of mem::replace with default
2019-07-03Remove needless lifetimesJeremy Stucki-1/+1
2019-07-01Enable mem_take feature in relevant cratesChris Gregory-0/+1
2019-07-01Use mem::take instead of mem::replace with defaultChris Gregory-1/+1
2019-06-23Fix meta-variable binding errors in macrosJulien Cretin-3/+3
The errors are either: - The meta-variable used in the right-hand side is not bound (or defined) in the left-hand side. - The meta-variable used in the right-hand side does not repeat with the same kleene operator as its binder in the left-hand side. Either it does not repeat enough, or it uses a different operator somewhere. This change should have no semantic impact.
2019-04-09proc_macro: stop using LEB128 for RPC.Eduard-Mihai Burtescu-23/+13
2019-04-05Use for_each to extend collectionsJosh Stone-3/+1
This updates the `Extend` implementations to use `for_each` for many collections: `BinaryHeap`, `BTreeMap`, `BTreeSet`, `LinkedList`, `Path`, `TokenStream`, `VecDeque`, and `Wtf8Buf`. Folding with `for_each` enables better performance than a `for`-loop for some iterators, especially if they can just forward to internal iterators, like `Chain` and `FlatMap` do.
2019-03-27Auto merge of #55780 - ogoffart:span_source_text, r=petrochenkovbors-0/+13
Introduce proc_macro::Span::source_text A function to extract the actual source behind a Span. Background: I would like to use `syn` in a `build.rs` script to parse the rust code, and extract part of the source code. However, `syn` only gives access to proc_macro2::Span, and i would like to get the source code behind that. I opened an issue on proc_macro2 bug tracker for this feature https://github.com/alexcrichton/proc-macro2/issues/110 and @alexcrichton said the feature should first go upstream in proc_macro. So there it is! Since most of the Span API is unstable anyway, this is guarded by the same `proc_macro_span` feature as everything else.
2019-02-24Use ? in some macrosTaiki Endo-16/+16