Skip to content

Commit 7d18cfc

Browse files
authored
Unrolled build for rust-lang#133547
Rollup merge of rust-lang#133547 - cuviper:span-set-entry, r=jieyouxu rustc_span: Replace a `HashMap<_, ()>` with `HashSet` Now that `HashSet::entry()` exists, we don't need to fake it with a map.
2 parents eddb717 + e37ac2a commit 7d18cfc

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

compiler/rustc_span/src/hygiene.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
use std::cell::RefCell;
2828
use std::collections::hash_map::Entry;
29+
use std::collections::hash_set::Entry as SetEntry;
2930
use std::fmt;
3031
use std::hash::Hash;
3132

@@ -1270,7 +1271,7 @@ pub struct HygieneDecodeContext {
12701271
inner: Lock<HygieneDecodeContextInner>,
12711272

12721273
/// A set of serialized `SyntaxContext` ids that are currently being decoded on each thread.
1273-
local_in_progress: WorkerLocal<RefCell<FxHashMap<u32, ()>>>,
1274+
local_in_progress: WorkerLocal<RefCell<FxHashSet<u32>>>,
12741275
}
12751276

12761277
/// Register an expansion which has been decoded from the on-disk-cache for the local crate.
@@ -1364,14 +1365,14 @@ pub fn decode_syntax_context<D: Decoder, F: FnOnce(&mut D, u32) -> SyntaxContext
13641365
match inner.decoding.entry(raw_id) {
13651366
Entry::Occupied(ctxt_entry) => {
13661367
match context.local_in_progress.borrow_mut().entry(raw_id) {
1367-
Entry::Occupied(..) => {
1368+
SetEntry::Occupied(..) => {
13681369
// We're decoding this already on the current thread. Return here
13691370
// and let the function higher up the stack finish decoding to handle
13701371
// recursive cases.
13711372
return *ctxt_entry.get();
13721373
}
1373-
Entry::Vacant(entry) => {
1374-
entry.insert(());
1374+
SetEntry::Vacant(entry) => {
1375+
entry.insert();
13751376

13761377
// Some other thread is current decoding this. Race with it.
13771378
*ctxt_entry.get()
@@ -1380,7 +1381,7 @@ pub fn decode_syntax_context<D: Decoder, F: FnOnce(&mut D, u32) -> SyntaxContext
13801381
}
13811382
Entry::Vacant(entry) => {
13821383
// We are the first thread to start decoding. Mark the current thread as being progress.
1383-
context.local_in_progress.borrow_mut().insert(raw_id, ());
1384+
context.local_in_progress.borrow_mut().insert(raw_id);
13841385

13851386
// Allocate and store SyntaxContext id *before* calling the decoder function,
13861387
// as the SyntaxContextData may reference itself.

compiler/rustc_span/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#![feature(array_windows)]
2323
#![feature(cfg_match)]
2424
#![feature(core_io_borrowed_buf)]
25+
#![feature(hash_set_entry)]
2526
#![feature(if_let_guard)]
2627
#![feature(let_chains)]
2728
#![feature(min_specialization)]

0 commit comments

Comments
 (0)