Skip to content

Commit 85acb1d

Browse files
committed
Ensure ImplicitCtxt is Sync
1 parent 9eb4f73 commit 85acb1d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/librustc/ty/context.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1704,7 +1704,7 @@ pub mod tls {
17041704
use ty::maps;
17051705
use errors::{Diagnostic, TRACK_DIAGNOSTICS};
17061706
use rustc_data_structures::OnDrop;
1707-
use rustc_data_structures::sync::Lrc;
1707+
use rustc_data_structures::sync::{self, Lrc};
17081708
use dep_graph::OpenTask;
17091709

17101710
/// This is the implicit state of rustc. It contains the current
@@ -1832,6 +1832,10 @@ pub mod tls {
18321832
if context == 0 {
18331833
f(None)
18341834
} else {
1835+
// We could get a ImplicitCtxt pointer from another thread.
1836+
// Ensure that ImplicitCtxt is Sync
1837+
sync::assert_sync::<ImplicitCtxt>();
1838+
18351839
unsafe { f(Some(&*(context as *const ImplicitCtxt))) }
18361840
}
18371841
}

0 commit comments

Comments
 (0)