We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ec3e182 commit fdbf2c8Copy full SHA for fdbf2c8
src/librustc/ty/context.rs
@@ -1754,7 +1754,7 @@ pub mod tls {
1754
use rustc_data_structures::OnDrop;
1755
use rayon_core;
1756
use dep_graph::OpenTask;
1757
- use rustc_data_structures::sync::{Lrc, Lock};
+ use rustc_data_structures::sync::{self, Lrc, Lock};
1758
1759
/// This is the implicit state of rustc. It contains the current
1760
/// TyCtxt and query. It is updated when creating a local interner or
@@ -1924,6 +1924,10 @@ pub mod tls {
1924
if context == 0 {
1925
f(None)
1926
} else {
1927
+ // We could get a ImplicitCtxt pointer from another thread.
1928
+ // Ensure that ImplicitCtxt is Sync
1929
+ sync::assert_sync::<ImplicitCtxt>();
1930
+
1931
unsafe { f(Some(&*(context as *const ImplicitCtxt))) }
1932
}
1933
0 commit comments