about summary refs log tree commit diff
path: root/library/proc_macro/src/bridge
AgeCommit message (Collapse)AuthorLines
2025-09-30explicitly implement `!Send` and `!Sync`cyrgani-31/+12
2025-09-29remove `reverse_{encode, decode}!`cyrgani-22/+2
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-06-14Remove all support for wasm's legacy ABIbjorn3-3/+0
2025-06-12Add support for $crate to IdentDaniel Bloom-2/+2
2025-05-12manual clippy fixesPietro Albini-0/+1
2025-04-11Replace proc_macro::SourceFile by Span::{file, local_file}.Mara Bos-15/+2
2025-04-11Remove proc_macro::SourceFile::is_real().Mara Bos-1/+0
2025-04-09update cfgsBoxy-1/+0
2025-03-25allow wasm_c_abi in proc_macro bridgeRalf Jung-0/+4
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/+1
2025-01-20proc_macro: add `#![warn(unreachable_pub)]`Urgau-7/+7
2025-01-11Add inherent versions of MaybeUninit methods for slicesltdk-1/+1
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-6/+0
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-10-25library: consistently use American spelling for 'behavior'Ralf Jung-1/+1
2024-10-17Remove TODO in proc_macro now `const_refs_to_static` is stableGnomedDev-20/+11
2024-09-18Revert "Add a hack to prevent proc_macro misopt in CI"Josh Stone-3/+1
This reverts commit da8ac73d910a446e796f511c0dda97e49d14f044.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-19/+12
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-26Fix doc nitsJohn Arundel-4/+4
Many tiny changes to stdlib doc comments to make them consistent (for example "Returns foo", rather than "Return foo", per RFC1574), adding missing periods, paragraph breaks, backticks for monospace style, and other minor nits. https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
2024-07-15lib: replace some `mem::forget`'s with `ManuallyDrop`Pavel Grigorenko-9/+6
2024-06-19Add a hack to prevent proc_macro misopt in CIGary Guo-1/+3
2024-06-05Rollup merge of #123168 - joshtriplett:size-of-prelude, r=AmanieuJubilee-1/+0
Add `size_of` and `size_of_val` and `align_of` and `align_of_val` to the prelude (Note: need to update the PR to add `align_of` and `align_of_val`, and remove the second commit with the myriad changes to appease the lint.) Many, many projects use `size_of` to get the size of a type. However, it's also often equally easy to hardcode a size (e.g. `8` instead of `size_of::<u64>()`). Minimizing friction in the use of `size_of` helps ensure that people use it and make code more self-documenting. The name `size_of` is unambiguous: the name alone, without any prefix or path, is self-explanatory and unmistakeable for any other functionality. Adding it to the prelude cannot produce any name conflicts, as any local definition will silently shadow the one from the prelude. Thus, we don't need to wait for a new edition prelude to add it.
2024-05-30Apply x clippy --fix and x fmtr0cky-4/+4
2024-05-13Add `size_of`, `size_of_val`, `align_of`, and `align_of_val` to the preludeJosh Triplett-1/+0
Many, many projects use `size_of` to get the size of a type. However, it's also often equally easy to hardcode a size (e.g. `8` instead of `size_of::<u64>()`). Minimizing friction in the use of `size_of` helps ensure that people use it and make code more self-documenting. The name `size_of` is unambiguous: the name alone, without any prefix or path, is self-explanatory and unmistakeable for any other functionality. Adding it to the prelude cannot produce any name conflicts, as any local definition will silently shadow the one from the prelude. Thus, we don't need to wait for a new edition prelude to add it. Add `size_of_val`, `align_of`, and `align_of_val` as well, with similar justification: widely useful, self-explanatory, unmistakeable for anything else, won't produce conflicts.
2024-04-11Call the panic hook for non-unwind panics in proc-macrosBen Kimock-1/+5
2024-03-23proc_macro: simplify bridge statejoboet-135/+61
2024-03-19SeqCst->Relaxed for proc_macro bridge counter.Mara Bos-2/+2
Relaxed is enough here.
2024-03-04Rollup merge of #120976 - matthiaskrgr:constify_TL_statics, r=lcnrMatthias Krüger-2/+2
constify a couple thread_local statics
2024-03-01Move `HandleStore` into `server.rs`.Nicholas Nethercote-86/+99
This just moves the server-relevant parts of handles into `server.rs`. It introduces a new higher-order macro `with_api_handle_types` to avoid some duplication. This fixes two `FIXME` comments, and makes things clearer, by not having server code in `client.rs`.
2024-02-23Auto merge of #121454 - reitermarkus:generic-nonzero-library, r=dtolnaybors-1/+1
Use generic `NonZero` everywhere in `library`. Tracking issue: https://github.com/rust-lang/rust/issues/120257 Use generic `NonZero` everywhere (except stable examples). r? `@dtolnay`
2024-02-22Add `rustc_confusables` annotations to some stdlib APIsEsteban Küber-0/+1
Help with common API confusion, like asking for `push` when the data structure really has `append`. ``` error[E0599]: no method named `size` found for struct `Vec<{integer}>` in the current scope --> $DIR/rustc_confusables_std_cases.rs:17:7 | LL | x.size(); | ^^^^ | help: you might have meant to use `len` | LL | x.len(); | ~~~ help: there is a method with a similar name | LL | x.resize(); | ~~~~~~ ``` #59450
2024-02-22Use generic `NonZero` everywhere else.Markus Reiter-1/+1
2024-02-19Remove `RefMutL` hack in `proc_macro::bridge`Pavel Grigorenko-26/+3
2024-02-16Auto merge of #116385 - kornelski:maybe-rename, r=Amanieubors-1/+1
Rename MaybeUninit::write_slice A step to push #79995 forward. https://github.com/rust-lang/libs-team/issues/122 also suggested to make them inherent methods, but they can't be — they'd conflict with slice's regular methods.
2024-02-16Auto merge of #120486 - reitermarkus:use-generic-nonzero, r=dtolnaybors-10/+10
Use generic `NonZero` internally. Tracking issue: https://github.com/rust-lang/rust/issues/120257
2024-02-15Replace `NonZero::<_>::new` with `NonZero::new`.Markus Reiter-1/+1
2024-02-15Use generic `NonZero` internally.Markus Reiter-10/+10
2024-02-15Add `ErrorGuaranteed` to `ast::LitKind::Err`, `token::LitKind::Err`.Nicholas Nethercote-2/+6
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-12constify a couple thread_local staticsMatthias Krüger-2/+2
2024-02-11Rollup merge of #119449 - Nilstrieb:library-clippy, r=cuviperMatthias Krüger-0/+1
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-31Switch OwnedStore handle count to AtomicU32GnomedDev-10/+10
2024-01-21Fix `clippy::correctness` in the libraryNilstrieb-0/+1
2023-12-11Add support for `--env` on `tracked_env::var`Guillaume Gomez-0/+1
2023-11-11Rename MaybeUninit::write_sliceKornel-1/+1
#79995
2023-06-20Add `Span::{line, column}`Jacob Pratt-0/+2
2023-06-20`Span::{before, after}` → `Span::{start, end}`Jacob Pratt-2/+2
2023-06-20Remove `LineColumn`, `Span::start`, `Span::end`Jacob Pratt-5/+1
2023-05-02fix TODO commentsDeadbeef-0/+4