diff options
| author | bors <bors@rust-lang.org> | 2022-09-05 07:07:38 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-09-05 07:07:38 +0000 |
| commit | 5b4bd154de6e41d4739914f446349f8201ec3ef9 (patch) | |
| tree | 4492f161c100bbbb943f68a82fc030e7b54cf691 /compiler/rustc_codegen_llvm/src/llvm_util.rs | |
| parent | 406e03fd02faf5cc8409a8b6b04c26990d6227e6 (diff) | |
| parent | efda49712b35009c0096217ce2aa262fc5ab8174 (diff) | |
| download | rust-5b4bd154de6e41d4739914f446349f8201ec3ef9.tar.gz rust-5b4bd154de6e41d4739914f446349f8201ec3ef9.zip | |
Auto merge of #101414 - mystor:pm_nested_cross_thread, r=eddyb
proc_macro/bridge: use the cross-thread executor for nested proc-macros While working on some other changes in the bridge, I noticed that when running a nested proc-macro (which is currently only possible using the unstable `TokenStream::expand_expr`), any symbols held by the proc-macro client would be invalidated, as the same thread would be used for the nested macro by default, and the interner doesn't handle nested use. After discussing with `@eddyb,` we decided the best approach might be to force the use of the cross-thread executor for nested invocations, as it will never re-use thread-local storage, avoiding the issue. This shouldn't impact performance, as expand_expr is still unstable, and infrequently used. This was chosen rather than making the client symbol interner handle nested invocations, as that would require replacing the internal interner `Vec` with a `BTreeMap` (as valid symbol id ranges could now be disjoint), and the symbol interner is known to be fairly perf-sensitive. This patch adds checks to the execution strategy to use the cross-thread executor when doing nested invocations. An alternative implementation strategy could be to track this information in the `ExtCtxt`, however a thread-local in the `proc_macro` crate was chosen to add an assertion so that `rust-analyzer` is aware of the issue if it implements `expand_expr` in the future. r? `@eddyb`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
0 files changed, 0 insertions, 0 deletions
