about summary refs log tree commit diff
path: root/library/proc_macro
AgeCommit message (Collapse)AuthorLines
2025-09-30explicitly implement `!Send` and `!Sync`cyrgani-31/+12
2025-09-30remove unused `#![feature(stmt_expr_attributes)]`cyrgani-1/+0
2025-09-29remove `reverse_{encode, decode}!`cyrgani-22/+2
2025-07-17Rollup merge of #143631 - hkBst:update-escaper-2, r=compiler-errorsMatthias Krüger-4/+4
update to literal-escaper-0.0.5 Quoting from the changelog, this version brings: - Use `NonZero<char/u8>` in `unescape_c_str` and `check_raw_c_str` to statically exclude nuls - Add `#[inline]` to small functions for improved performance
2025-07-10Rollup merge of #141996 - Daniel-Aaron-Bloom:dollar_crate, r=petrochenkovTrevor Gross-2/+2
Fix `proc_macro::Ident`'s handling of `$crate` This PR is addresses a few minor bugs, all relating to `proc_macro::Ident`'s support for `$crate`. `Ident` currently supports `$crate` (as can be seen in the `mixed-site-span` test), but: * `proc_macro::Symbol::can_be_raw` is out of sync with `rustc_span::Symbol::can_be_raw` * former doesn't cover `$crate` while the latter does cover `kw::DollarCrate` * `Ident::new` rejects `$crate` * This conflicts with the [reference definition](https://doc.rust-lang.org/nightly/reference/macros-by-example.html#r-macro.decl.meta.specifier) of `ident` which includes `$crate`. * This also conflicts with the documentation on [`Display for Ident`](https://doc.rust-lang.org/proc_macro/struct.Ident.html#impl-Display-for-Ident) which says the output "should be losslessly convertible back into the same identifier". This PR fixes the above issues and extends the `mixed-site-span` test to exercise these fixed code paths, as well as validating the different possible spans resolve `$crate` as expected (for both the new and old `$crate` construction code paths).
2025-07-08update to literal-escaper-0.0.5Marijn Schouten-4/+4
2025-06-25Auto merge of #140999 - hkBst:update-escaper, r=nnethercotebors-8/+7
update to literal-escaper 0.0.4 for better API without `unreachable` and faster string parsing This is the replacement for just the part of https://github.com/rust-lang/rust/pull/138163 dealing with the changed API of unescape functionality, since that got moved into its own crate. <del>This uses an unpublished version of literal-escaper (https://github.com/rust-lang/literal-escaper/pull/8).</del> r? `@nnethercote`
2025-06-23update to literal-escaper 0.0.4 for better API without `unreachable` and ↵Marijn Schouten-8/+7
faster string parsing
2025-06-17Add support for repetition to `proc_macro::quote`Tomoaki Kobayashi-4/+327
2025-06-14Remove all support for wasm's legacy ABIbjorn3-3/+0
2025-06-12Add support for $crate to IdentDaniel Bloom-2/+2
2025-05-27Do not get proc_macro from the sysroot in rustcbjorn3-1/+6
With the stage0 refactor the proc_macro version found in the sysroot will no longer always match the proc_macro version that proc-macros get compiled with by the rustc executable that uses this proc_macro. This will cause problems as soon as the ABI of the bridge gets changed to implement new features or change the way existing features work. To fix this, this commit changes rustc crates to depend directly on the local version of proc_macro which will also be used in the sysroot that rustc will build.
2025-05-12manual clippy fixesPietro Albini-0/+1
2025-05-12update version placeholdersPietro Albini-6/+6
2025-04-30Update doc comments.Mara Bos-2/+2
2025-04-30Stabilize proc_macro::Span::{file, local_file}.Mara Bos-2/+2
2025-04-15Stabilize proc_macro::Span::{start, end, line, column}.Mara Bos-4/+4
2025-04-11Replace proc_macro::SourceFile by Span::{file, local_file}.Mara Bos-56/+21
2025-04-11Remove proc_macro::SourceFile::is_real().Mara Bos-20/+2
2025-04-09update cfgsBoxy-1/+0
2025-04-04bootstrap: Only add `rustc_randomized_layouts` if the crate has itGuillaume Gomez-1/+2
2025-04-04Add `_value` methods to proc_macro libGuillaume Gomez-0/+115
2025-03-25allow wasm_c_abi in proc_macro bridgeRalf Jung-0/+4
2025-03-18Revert "Rollup merge of #136355 - ↵Ralf Jung-116/+0
GuillaumeGomez:proc-macro_add_value_retrieval_methods, r=Amanieu" This reverts commit 08dfbf49e30d917c89e49eb14cb3f1e8b8a1c9ef, reversing changes made to 10bcdad7df0de3cfb95c7bdb7b16908e73cafc09.
2025-03-17Rollup merge of #136355 - ↵Jacob Pratt-0/+116
GuillaumeGomez:proc-macro_add_value_retrieval_methods, r=Amanieu Add `*_value` methods to proc_macro lib This is the implementation of https://github.com/rust-lang/libs-team/issues/459. It allows to get the actual value (unescaped) of the different string literals. Part of https://github.com/rust-lang/rust/issues/136652. r? libs-api
2025-03-16Add test for new proc_macro literal methodsGuillaume Gomez-0/+1
2025-03-11Migrate proc_macro to Rust 2024Eric Huss-1/+1
2025-03-06library: Use size_of from the prelude instead of importedThalia Archibald-1/+1
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-02-14proc_macro: Apply unsafe_op_in_unsafe_fnEric Huss-1/+2
2025-02-10Add `_value` methods to proc_macro libGuillaume Gomez-0/+115
2025-01-20proc_macro: add `#![warn(unreachable_pub)]`Urgau-7/+8
2025-01-11Add inherent versions of MaybeUninit methods for slicesltdk-1/+1
2025-01-10Rollup merge of #134693 - SpriteOvO:proc-macro-use-to-tokens-in-quote, ↵Jacob Pratt-64/+87
r=tgross35 proc_macro: Use `ToTokens` trait in `quote` macro Tracking issues: #130977, #54722 This PR changed `proc_macro::quote!` to use `ToTokens` trait instead of `TokenStream::from`, and migrated test cases from `quote` crate. r? `@dtolnay` CC `@tgross35`
2025-01-09Fix `proc_macro::quote!` for raw identAsuna-2/+8
2025-01-09Append `TokenTree` with `ToTokens` in `proc_macro::quote!`Asuna-47/+64
2025-01-01Rename the internal simpler `quote` macro to `minimal_quote`Asuna-24/+24
2024-12-23Use `#[derive(Default)]` instead of manually implementing itEsteban Küber-7/+1
2024-12-13Remove support for specializing ToString outside the standard librarybjorn3-72/+11
This is the only trait specializable outside of the standard library. Before stabilizing specialization we will probably want to remove support for this. It was originally made specializable to allow a more efficient ToString in libproc_macro back when this way the only way to get any data out of a TokenStream. We now support getting individual tokens, so proc macros no longer need to call it as often.
2024-11-30rustc_allow_const_fn_unstable is not used in proc_macroRalf Jung-1/+0
2024-10-27Add a new trait `proc_macro::ToTokens`Asuna-0/+314
2024-10-25library: consistently use American spelling for 'behavior'Ralf Jung-1/+1
2024-10-21move strict provenance lints to new feature gate, remove old feature gatesRalf Jung-1/+0
2024-10-17Remove TODO in proc_macro now `const_refs_to_static` is stableGnomedDev-20/+11
2024-10-02update `Literal`'s introSlanterns-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-2/+2
2024-09-18Revert "Add a hack to prevent proc_macro misopt in CI"Josh Stone-3/+1
This reverts commit da8ac73d910a446e796f511c0dda97e49d14f044.
2024-08-27library: Stabilize new_uninit for Box, Rc, and ArcJubilee Young-1/+0
A partial stabilization that only affects: - AllocType<T>::new_uninit - AllocType<T>::assume_init - AllocType<[T]>::new_uninit_slice - AllocType<[T]>::assume_init where "AllocType" is Box, Rc, or Arc
2024-07-29Rollup merge of #128307 - ojeda:unescaped_backticks, r=GuillaumeGomezMatthias Krüger-0/+1
Clean and enable `rustdoc::unescaped_backticks` for `core/alloc/std/test/proc_macro` I am not sure if the lint is supposed to be "ready enough" (since it is `allow` by default), but it does catch a couple issues in `core` (`alloc`, `std`, `test` and `proc_macro` are already clean), so I propose making it `warn` in all the crates rendered in the website. Cc: `@GuillaumeGomez`
2024-07-29Warn on `rustdoc::unescaped_backticks` for `core/alloc/std/test/proc_macro`Miguel Ojeda-0/+1
They are all clean now, so enable the lint to keep them clean going forward. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2024-07-29Reformat `use` declarations.Nicholas Nethercote-23/+17
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.