Rollup merge of #138092 - lqd:revert-136731, r=SparrowLii
Re-add `DynSend` and `DynSync` impls for `TyCtxt` They were somewhat unexpectedly removed in #136731. This PR adds them back, as requested in https://github.com/rust-lang/rust/pull/136731#issuecomment-2702504644. I've also tried to expand the comments a bit to make it less likely that they're removed again in the future. r? `@SparrowLii`
This commit is contained in:
commit
efd22c2236
1 changed files with 5 additions and 0 deletions
|
|
@ -1327,6 +1327,11 @@ pub struct TyCtxt<'tcx> {
|
|||
gcx: &'tcx GlobalCtxt<'tcx>,
|
||||
}
|
||||
|
||||
// Explicitly implement `DynSync` and `DynSend` for `TyCtxt` to short circuit trait resolution. Its
|
||||
// field are asserted to implement these traits below, so this is trivially safe, and it greatly
|
||||
// speeds-up compilation of this crate and its dependents.
|
||||
unsafe impl DynSend for TyCtxt<'_> {}
|
||||
unsafe impl DynSync for TyCtxt<'_> {}
|
||||
fn _assert_tcx_fields() {
|
||||
sync::assert_dyn_sync::<&'_ GlobalCtxt<'_>>();
|
||||
sync::assert_dyn_send::<&'_ GlobalCtxt<'_>>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue