Rollup merge of #148261 - aDotInTheVoid:no-sync-for-smir, r=celinval

rustc_public: Make Id types !Send / !Sync

These types are Id's to a table stored in TLS, so using them from another tread will either panic, or give wrong results.

Therefor, I've added a ~~`ReferencesTls`~~`ThreadLocalIndex`  marker type, which ensures types arn't `Send`/`Sync`.

This is a breaking change for users of the `rustc_public` crate.

~~It also changes how `DefId` and similar are `Serialize`d. It would be possible to preserve the old behavior if that's needed, but I couldn't see any tests for these.~~ EDIT: Not anymore: https://github.com/rust-lang/rust/pull/148261#discussion_r2476111612

Zulip Discussion: https://rust-lang.zulipchat.com/#narrow/channel/320896-project-stable-mir/topic/WDYM.20.22should.20not.20.20be.20shared.20across.20threads.22/with/547374171
This commit is contained in:
Matthias Krüger 2025-11-20 11:15:52 +01:00 committed by GitHub
commit 34b3c9dd4d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 153 additions and 74 deletions

View file

@ -4472,6 +4472,7 @@ dependencies = [
"rustc_target",
"scoped-tls",
"serde",
"serde_json",
"tracing",
]