diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-12-08 11:02:47 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-02-20 15:28:58 +0000 |
| commit | 6924e3c374563217a724f7ffca1a5087166e8f49 (patch) | |
| tree | 409ef2c141665701623473ddea7fb4b14dfdf255 /compiler/rustc_resolve/src/lib.rs | |
| parent | ade3dceb38c6e41e3b8623e252d9413052e3a0af (diff) | |
| download | rust-6924e3c374563217a724f7ffca1a5087166e8f49.tar.gz rust-6924e3c374563217a724f7ffca1a5087166e8f49.zip | |
Make untracked.source_span lockable so that resolution can still write to it when using TyCtxt
Diffstat (limited to 'compiler/rustc_resolve/src/lib.rs')
| -rw-r--r-- | compiler/rustc_resolve/src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index afadc0b2a0c..7a8e594a8f9 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -1180,7 +1180,7 @@ impl<'tcx> Resolver<'_, 'tcx> { // A relative span's parent must be an absolute span. debug_assert_eq!(span.data_untracked().parent, None); - let _id = self.untracked.source_span.push(span); + let _id = self.untracked.source_span.write().push(span); debug_assert_eq!(_id, def_id); // Some things for which we allocate `LocalDefId`s don't correspond to @@ -1329,7 +1329,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { used_extern_options: Default::default(), untracked: Untracked { cstore: RwLock::new(Box::new(CStore::new(session))), - source_span, + source_span: RwLock::new(source_span), definitions: RwLock::new(definitions), }, macro_names: FxHashSet::default(), @@ -1932,7 +1932,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { /// Retrieves the span of the given `DefId` if `DefId` is in the local crate. #[inline] fn opt_span(&self, def_id: DefId) -> Option<Span> { - def_id.as_local().map(|def_id| self.untracked.source_span[def_id]) + def_id.as_local().map(|def_id| self.untracked.source_span.read()[def_id]) } /// Retrieves the name of the given `DefId`. |
