about summary refs log tree commit diff
path: root/library/proc_macro/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2025-09-30remove unused `#![feature(stmt_expr_attributes)]`cyrgani-1/+0
2025-07-08update to literal-escaper-0.0.5Marijn Schouten-3/+3
2025-06-25Auto merge of #140999 - hkBst:update-escaper, r=nnethercotebors-7/+6
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-7/+6
faster string parsing
2025-06-17Add support for repetition to `proc_macro::quote`Tomoaki Kobayashi-1/+2
2025-05-27Do not get proc_macro from the sysroot in rustcbjorn3-1/+2
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-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-41/+19
2025-04-11Remove proc_macro::SourceFile::is_real().Mara Bos-19/+2
2025-04-04bootstrap: Only add `rustc_randomized_layouts` if the crate has itGuillaume Gomez-0/+1
2025-04-04Add `_value` methods to proc_macro libGuillaume Gomez-0/+114
2025-03-18Revert "Rollup merge of #136355 - ↵Ralf Jung-115/+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/+115
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-02-14proc_macro: Apply unsafe_op_in_unsafe_fnEric Huss-0/+1
2025-02-10Add `_value` methods to proc_macro libGuillaume Gomez-0/+114
2025-01-20proc_macro: add `#![warn(unreachable_pub)]`Urgau-0/+1
2025-01-09Append `TokenTree` with `ToTokens` in `proc_macro::quote!`Asuna-1/+1
2024-12-13Remove support for specializing ToString outside the standard librarybjorn3-66/+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/+4
2024-10-21move strict provenance lints to new feature gate, remove old feature gatesRalf Jung-1/+0
2024-10-02update `Literal`'s introSlanterns-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-2/+2
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-4/+5
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-19Avoid ref when using format! for perfYuri Astrakhan-2/+2
Clean up a few minor refs in `format!` macro, as it has a tiny perf cost. A few more minor related cleanups.
2024-06-13Remove superfluous escaping from byte, byte str, and c str literalsDavid Tolnay-14/+37
2024-05-23Rollup merge of #124389 - CensoredUsername:master, r=petrochenkovLeón Orell Valerian Liehr-0/+12
Add a warning to proc_macro::Delimiter::None that rustc currently does not respect it. It does not provide the behaviour it is indicated to provide when used in a proc_macro context. This seems to be a bug, (https://github.com/rust-lang/rust/issues/67062), but it is a long standing one, and hard to discover. This pull request adds a warning to inform users of this issue, with a link to the relevant issue, and a version number of the last known affected rustc version.
2024-05-18Add a warning to Delimiter::None that rustc currently does not respect it.CensoredUsername-0/+12
It does not provide the behaviour it is indicated to provide when used in a proc_macro context.
2024-05-01Replace version placeholders for 1.79Mark Rousskov-2/+2
2024-04-22Stabilize generic `NonZero`.Markus Reiter-1/+0
2024-04-16Fix empty-set symbol in commentsDavid Tolnay-1/+1
2024-04-11Call the panic hook for non-unwind panics in proc-macrosBen Kimock-0/+1
2024-04-04Stabilize `Literal::c_string`Slanterns-1/+1
2024-04-04Stabilize `Literal::byte_character`Slanterns-1/+1
2024-03-12Fix typo in lib.rs of proc_macroJonathan Jensen-1/+1
2024-02-24Forbid use of `extern "C-unwind"` inside standard libraryGary Guo-0/+1
Those libraries are build with `-C panic=unwind` and is expected to be linkable to `-C panic=abort` library. To ensure unsoundness compiler needs to prevent a `C-unwind` call to exist, as doing so may leak foreign exceptions into `-C panic=abort`.
2024-02-16Auto merge of #120486 - reitermarkus:use-generic-nonzero, r=dtolnaybors-0/+1
Use generic `NonZero` internally. Tracking issue: https://github.com/rust-lang/rust/issues/120257
2024-02-15Use generic `NonZero` internally.Markus Reiter-0/+1
2024-02-15Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`.Nicholas Nethercote-1/+1
This mostly works well, and eliminates a couple of delayed bugs. One annoying thing is that we should really also add an `ErrorGuaranteed` to `proc_macro::bridge::LitKind::Err`. But that's difficult because `proc_macro` doesn't have access to `ErrorGuaranteed`, so we have to fake it.
2024-02-11Rollup merge of #119449 - Nilstrieb:library-clippy, r=cuviperMatthias Krüger-0/+3
Fix `clippy::correctness` in the library needs https://github.com/rust-lang/backtrace-rs/pull/579 to be complete for https://github.com/rust-lang/compiler-team/issues/709
2024-01-22Document `Token{Stream,Tree}::Display` more thoroughly.Nicholas Nethercote-0/+16
To expressly warn against the kind of proc macro implementation that was broken in #119875.
2024-01-21Fix `clippy::correctness` in the libraryNilstrieb-0/+3
2024-01-16proc_macro_c_str_literals: Implement Literal::c_string constructornovafacing-0/+8