about summary refs log tree commit diff
path: root/library/proc_macro/src/bridge/client.rs
AgeCommit message (Collapse)AuthorLines
2025-04-11Replace proc_macro::SourceFile by Span::{file, local_file}.Mara Bos-6/+0
2024-10-17Remove TODO in proc_macro now `const_refs_to_static` is stableGnomedDev-16/+7
2024-07-29Reformat `use` declarations.Nicholas Nethercote-3/+4
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-15lib: replace some `mem::forget`'s with `ManuallyDrop`Pavel Grigorenko-3/+1
2024-04-11Call the panic hook for non-unwind panics in proc-macrosBen Kimock-1/+5
2024-03-23proc_macro: simplify bridge statejoboet-68/+60
2024-03-04Rollup merge of #120976 - matthiaskrgr:constify_TL_statics, r=lcnrMatthias Krüger-1/+1
constify a couple thread_local statics
2024-03-01Move `HandleStore` into `server.rs`.Nicholas Nethercote-80/+5
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-19Remove `RefMutL` hack in `proc_macro::bridge`Pavel Grigorenko-6/+1
2024-02-12constify a couple thread_local staticsMatthias Krüger-1/+1
2024-01-31Switch OwnedStore handle count to AtomicU32GnomedDev-4/+5
2022-12-30Replace libstd, libcore, liballoc in line comments.jonathanCogan-1/+1
2022-10-05A tiny fix for `define_client_side`.Nicholas Nethercote-2/+2
The return type can only appear once.
2022-08-06proc_macro/bridge: send diagnostics over the bridge as a structNika Layzell-2/+0
This removes some RPC when creating and emitting diagnostics, and simplifies the bridge slightly. After this change, there are no remaining methods which take advantage of the support for `&mut` references to objects in the store as arguments, meaning that support for them could technically be removed if we wanted. The only remaining uses of immutable references into the store are `TokenStream` and `SourceFile`.
2022-07-18proc_macro: stop using a remote object handle for LiteralNika Layzell-20/+0
This builds on the symbol infrastructure built for `Ident` to replicate the `LitKind` and `Lit` structures in rustc within the `proc_macro` client, allowing literals to be fully created and interacted with from the client thread. Only parsing and subspan operations still require sync RPC.
2022-07-18proc_macro: stop using a remote object handle for IdentNika Layzell-1/+9
Doing this for all unicode identifiers would require a dependency on `unicode-normalization` and `rustc_lexer`, which is currently not possible for `proc_macro` due to it being built concurrently with `std` and `core`. Instead, ASCII identifiers are validated locally, and an RPC message is used to validate unicode identifiers when needed. String values are interned on the both the server and client when deserializing, to avoid unnecessary copies and keep Ident cheap to copy and move. This appears to be important for performance. The client-side interner is based roughly on the one from rustc_span, and uses an arena inspired by rustc_arena. RPC messages passing symbols always include the full value. This could potentially be optimized in the future if it is revealed to be a performance bottleneck. Despite now having a relevant implementaion of Display for Ident, ToString is still specialized, as it is a hot-path for this object. The symbol infrastructure will also be used for literals in the next part.
2022-06-26proc_macro: stop using a remote object handle for GroupNika Layzell-7/+0
This greatly reduces round-trips to fetch relevant extra information about the token in proc macro code, and avoids RPC messages to create Group tokens.
2022-06-26proc_macro: stop using a remote object handle for PunctNika Layzell-1/+0
This greatly reduces round-trips to fetch relevant extra information about the token in proc macro code, and avoids RPC messages to create Punct tokens.
2022-06-26proc_macro: Rename ExpnContext to ExpnGlobals, and unify method on Server traitNika Layzell-7/+7
2022-06-25proc_macro: cache static spans in client's thread-local stateNika Layzell-55/+85
This greatly improves the performance of the very frequently called `call_site()` macro when running in a cross-thread configuration.
2022-06-19Auto merge of #98224 - eddyb:proc-macro-spurious-repr, r=bjorn3bors-3/+0
proc_macro/bridge: remove `#[repr(C)]` from non-ABI-relevant types. Not sure how this happened, maybe some of these were passed through the bridge a long time ago? r? `@bjorn3`
2022-06-18proc_macro/bridge: remove `#[repr(C)]` from non-ABI-relevant types.Eduard-Mihai Burtescu-3/+0
2022-06-17Move empty final TokenStream handling to server side of bridgeNika Layzell-8/+2
2022-06-17proc_macro: reduce the number of messages required to create, extend, and ↵Nika Layzell-10/+8
iterate TokenStreams This significantly reduces the cost of common interactions with TokenStream when running with the CrossThread execution strategy, by reducing the number of RPC calls required.
2022-05-27proc_macro: don't pass a client-side function pointer through the server.Eduard-Mihai Burtescu-35/+46
2022-05-27Rename `b` as `buf` in several places.Nicholas Nethercote-16/+16
Because it's easy to confuse with `bridge`.
2022-05-27Add some comments about `_marker` fields.Nicholas Nethercote-2/+6
There is some non-obvious information required to understand them.
2022-05-27Make `Buffer<T>` non-generic.Nicholas Nethercote-4/+4
`u8` is the only type that makes sense for `T`, as demonstrated by the fact that several impls and functions are hardwired to `Buffer<u8>`.
2022-05-27Fix a typo in a comment.Nicholas Nethercote-1/+1
2022-05-13Remove some unnecessary `rustc_allow_const_fn_unstable` attributes.Nicholas Nethercote-5/+0
2022-03-25Avoid negative impls in the bridgebjorn3-13/+28
2022-03-25Remove usage of panic_update_hook feature gatebjorn3-2/+3
2022-01-08Change panic::update_hook to simplify usageBadel2-10/+8
And to remove possibility of panics while changing the panic handler, because that resulted in a double panic.
2022-01-07Implement panic::update_hookBadel2-10/+11
2021-12-14made compiler happyAnuvrat-2/+2
2021-07-29Fix may not to appropriate might not or must notAli Malik-1/+1
2020-11-19Bump bootstrap compiler versionJake Goulding-10/+5
2020-10-21switch allow_internal_unstable const fns to rustc_allow_const_fn_unstableFlorian Warzecha-5/+10
2020-09-22Update library functions with stability attributesDylan MacKenzie-0/+5
This may not be strictly minimal, but all unstable functions also need a `rustc_const_unstable` attribute.
2020-09-03Respect `-Z proc-macro-backtrace` flag for panics inside libproc_macroAaron Hill-3/+2
Fixes #76270 Previously, any panic occuring during a call to a libproc_macro method (e.g. calling `Ident::new` with an invalid identifier) would always cause an ICE message to be printed.
2020-08-30Add `-Z proc-macro-backtrace` to allow showing proc-macro panicsAaron Hill-4/+6
Fixes #75050 Previously, we would unconditionally suppress the panic hook during proc-macro execution. This commit adds a new flag -Z proc-macro-backtrace, which allows running the panic hook for easier debugging.
2020-07-27mv std libs to library/mark-0/+480