rust/src
bors 5b4bd154de 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`
2022-09-05 07:07:38 +00:00
..
bootstrap Rollup merge of #100200 - petrochenkov:zgccld2, r=lqd,Mark-Simulacrum 2022-09-02 18:21:59 +02:00
ci Test internal documentation 2022-09-04 16:51:11 +01:00
doc Rollup merge of #101347 - diminishedprime:patch-4, r=tmandry 2022-09-03 14:20:51 +02:00
etc Fix a bunch of typo 2022-08-31 18:24:55 +08:00
librustdoc Auto merge of #101386 - aDotInTheVoid:rdj-discriminant, r=GuillaumeGomez 2022-09-05 04:16:08 +00:00
llvm-project@670e5f673a Update LLVM submodule 2022-09-02 10:18:12 +02:00
rustdoc-json-types Rustdoc-Json: Add enum discriminant 2022-09-03 22:15:26 +01:00
test Auto merge of #101414 - mystor:pm_nested_cross_thread, r=eddyb 2022-09-05 07:07:38 +00:00
tools Address feedback from PR #101401 2022-09-04 08:07:53 -07:00
README.md Sunset RLS 2022-08-27 21:36:08 -07:00
stage0.json Bump stage0 2022-08-29 19:30:11 +02:00
version Bump to 1.65.0 2022-08-05 11:32:46 -04:00

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like cargo, miri, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.