295 Commits

Author SHA1 Message Date
cyrgani f4780504cd add and use PanicMessage::into_string 2026-04-14 11:16:33 +00:00
Ben Kimock ff6191588a Use Vec::push_mut when adding a chunk to arenas 2026-04-11 12:58:21 -04:00
Jonathan Brouwer 66cccfde99 Rollup merge of #147859 - cyrgani:nonfatal-tokenstream-parse, r=petrochenkov,JonathanBrouwer
reduce the amount of panics in `{TokenStream, Literal}::from_str` calls

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/147859)*

Before this PR, calling `TokenStream::from_str` or `Literal::from_str` with an invalid argument would always cause a compile error, even if the `TokenStream` is not used afterwards at all.
This PR changes this so it returns a `LexError` instead in some cases.

This is very theoretically a breaking change, but the doc comment on the impl already says
```
/// NOTE: some errors may cause panics instead of returning `LexError`. We reserve the right to
/// change these errors into `LexError`s later.
```

Fixes some cases of rust-lang/rust#58736.
2026-02-22 11:31:14 +01:00
cyrgani f601b29825 inline SameThread and CrossThread 2026-02-13 11:24:50 +00:00
cyrgani 31053484a7 replace MessagePipe trait with its impl 2026-02-13 11:23:26 +00:00
cyrgani 2f24a5e491 remove DispatcherTrait 2026-02-12 11:38:33 +00:00
cyrgani 13189f48cf use ? instead of * for return types 2026-02-12 11:38:22 +00:00
cyrgani f1c80f5988 reduce the amount of panics in {TokenStream, Literal}::from_str calls 2026-02-11 20:09:30 +00:00
cyrgani 74d2616efc deduplicate Tag enum 2026-02-06 21:26:46 +00:00
cyrgani a6062a84bc use mem::conjure_zst directly 2026-02-06 21:26:46 +00:00
cyrgani 18996c6985 make with_api! take explicit type paths 2026-02-06 21:26:46 +00:00
cyrgani 1a03742c25 simplify some other generics 2026-02-06 21:26:46 +00:00
cyrgani 749d62b262 remove Closure generics 2026-02-05 11:40:11 +00:00
cyrgani 1a240d604c expand define_reify_functions! 2026-02-05 11:39:38 +00:00
bors 8340622e14 Auto merge of #151543 - GuillaumeGomez:more-proc-macro-literal-methods, r=Amanieu
Add new `byte_value` and `char_value` methods to `proc_macro::Literal`

Part of https://github.com/rust-lang/rust/issues/136652.

It adds two more methods to get unescaped `u8` and `char` from `proc_macro::Literal`.

r? @Amanieu
2026-02-01 15:46:27 +00:00
Guillaume Gomez 55e3d2206a Improve new proc-macro methods name 2026-02-01 15:05:57 +01:00
cyrgani 6e7a87c5c5 merge Mark and Unmark traits 2026-01-26 15:24:22 +00:00
cyrgani 356107e0b4 remove some unneeded impls 2026-01-26 14:59:54 +00:00
cyrgani d5328c545a introduce MarkedX type aliases 2026-01-26 14:59:25 +00:00
cyrgani f8d05b6c85 flatten the api_tags module 2026-01-26 14:59:25 +00:00
cyrgani 5fef797f6e inline Writer and Reader type aliases 2026-01-26 14:10:11 +00:00
cyrgani bf1c3f6a14 move Types from with_api! to Server 2026-01-26 14:10:11 +00:00
bjorn3 e8c48c6895 Fix review comments 2026-01-24 14:44:03 +00:00
bjorn3 d9ec1aef8d Get rid of MarkedTypes 2026-01-24 14:44:03 +00:00
bjorn3 8a119c3145 Merge FreeFunctions trait into Server trait
And rename FreeFunctions struct to Methods.
2026-01-24 14:44:03 +00:00
bjorn3 9481890143 Various simplifications after moving all bridge methods to a single type 2026-01-24 14:44:03 +00:00
bjorn3 2f44019470 Move all bridge methods into a single type 2026-01-24 14:44:03 +00:00
bjorn3 4dc28c59ab Expand with_api_handle_types 2026-01-24 14:44:03 +00:00
bjorn3 dabae7eea4 Handle FreeFunctions outside with_api_handle_types
It is a singleton which doesn't actually need to be passed through over
the bridge.
2026-01-24 14:44:03 +00:00
bjorn3 ef819e49a8 Remove a couple of unnecessary impls 2026-01-24 14:44:03 +00:00
Guillaume Gomez 36c0fb5a2d Add new byte_value and char_value methods to proc_macro::Literal 2026-01-23 16:21:27 +01:00
Guillaume Gomez 27b1083a96 Update literal-escaper version to 0.0.7 2026-01-08 14:10:33 +01:00
cyrgani 8fc2acadae test and document that proc_macro::Ident is NFC-normalized 2025-12-27 13:52:40 +00:00
cyrgani 01c23c67be several proc_macro cleanups 2025-12-23 09:56:09 +00:00
Boxy Uwu 2ffb1d55ef Handle bootstrap cfgs 2025-12-19 15:04:30 -08:00
Matthias Krüger 679ab9e061 Rollup merge of #149400 - Skgland:tracked_mod, r=Amanieu
unstable proc_macro tracked::* rename/restructure

Picking up what should be the uncontroversial part of rust-lang/rust#87173 (closed due to inactivity over two years ago).

Part of rust-lang/rust#99515.

- move `proc_macro::tracked_env::var` to `proc_macro::tracked::env_var`
- move `proc_macro::tracked_path::path` to `proc_macro::tracked::path`
- change the argument of `proc_macro::tracked::path` from `AsRef<str>` to `AsRef<Path>`.
2025-12-09 17:36:48 +01:00
Stuart Cook a32d3103d5 Rollup merge of #148048 - thaliaarchi:stabilize-maybeuninit-write-slice, r=Mark-Simulacrum
Stabilize `maybe_uninit_write_slice`

Stabilize feature `maybe_uninit_write_slice` (closes https://github.com/rust-lang/rust/issues/79995).

Note that this also const-stabilizes `<[MaybeUninit<_>]>::write_copy_of_slice`. That method depends on `<[_]>::copy_from_slice`, which is already const-stable, and `<[MaybeUninit<_>]>::assume_init_mut` which is now also stable.
2025-11-27 12:36:48 +11:00
Skgland 8d8d7021c6 change proc_macro::tracked::path to take an AsRef<Path> instead of an AsRef<str> 2025-11-26 22:44:30 +01:00
Skgland 72076c6b54 move and rename proc_macro::tracked_{env::var,path::path} 2025-11-26 22:44:25 +01:00
Josh Stone f25ca45fd1 Update CURRENT_RUSTC_VERSION post-bump
(cherry picked from commit 813072186c)
2025-10-28 13:22:00 -07:00
Thalia Archibald 5088b3816b Stabilize maybe_uninit_write_slice 2025-10-23 14:02:41 -06:00
Stuart Cook 428be2fbc9 Rollup merge of #147497 - cyrgani:proc-macro-cleanups-3, r=petrochenkov
`proc_macro` cleanups (3/N)

Followup to rust-lang/rust#147386, which removed the old `Decode` trait.
Can be reviewed commit by commit.
2025-10-14 16:30:58 +11:00
dianqk 6967a8561b Rollup merge of #145722 - Qelxiros:112815-tokenstream-extend, r=dtolnay
implement Extend<{Group, Literal, Punct, Ident}> for TokenStream

Tracking issue: rust-lang/rust#112815
2025-10-11 07:05:54 +08:00
cyrgani 6a12470210 rename DecodeMut to Decode 2025-10-10 22:19:04 +02:00
cyrgani e3d2016a22 inline constants in generated enum Encode impls 2025-10-08 21:32:28 +02:00
cyrgani 0355358e6c run zero-size assertion in const {} 2025-10-08 21:32:27 +02:00
cyrgani 7aa52ea97a remove Decode trait and only impl 2025-10-07 21:21:40 +02:00
cyrgani 74ec42e000 refactor confusing loop in proc_macro arena 2025-10-07 21:21:07 +02:00
cyrgani 0a6462be90 remove unneeded imports 2025-10-05 23:25:08 +02:00
cyrgani d7773f6b1c explicitly implement !Send and !Sync 2025-09-30 00:09:12 +02:00