mirror of
				https://github.com/rust-lang/rust-analyzer.git
				synced 2025-11-03 13:13:18 +00:00 
			
		
		
		
	Auto merge of #16652 - davidbarsky:david/deadlock-fix-for-16643, r=Veykril
internal: fix deadlock introduced by #16643 This fixes a deadlock introduced by #16643 ([backtrace](https://gist.github.com/davidbarsky/00f17598f5496a9c41aff31fec1c42d6)). `maybe_changed_after` calls back into other queries, so the cloning here is unfortunately inevitable. (Zulip conversation: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Fixing.20proc-macro.20dirtying.20with.20unindexed.20projects)
This commit is contained in:
		
						commit
						03b3cb6be9
					
				@ -146,11 +146,14 @@ where
 | 
			
		||||
        revision: Revision,
 | 
			
		||||
    ) -> bool {
 | 
			
		||||
        debug_assert!(revision < db.salsa_runtime().current_revision());
 | 
			
		||||
        let read = &self.slot_map.read();
 | 
			
		||||
        let read = self.slot_map.read();
 | 
			
		||||
        let Some((key, slot)) = read.get_index(index as usize) else {
 | 
			
		||||
            return false;
 | 
			
		||||
        };
 | 
			
		||||
        slot.maybe_changed_after(db, revision, key)
 | 
			
		||||
        let (key, slot) = (key.clone(), slot.clone());
 | 
			
		||||
        // note: this drop is load-bearing. removing it would causes deadlocks.
 | 
			
		||||
        drop(read);
 | 
			
		||||
        slot.maybe_changed_after(db, revision, &key)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn fetch(&self, db: &<Q as QueryDb<'_>>::DynDb, key: &Q::Key) -> Q::Value {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user