Skip to content

Commit ece9c2f

Browse files
committed
Update hasher
1 parent 4ad8bdc commit ece9c2f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

generate/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(is_sorted)]
21
#![feature(exact_size_is_empty)]
32
#![feature(iter_advance_by)]
43
#![feature(variant_count)]

mir/src/syntax.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -718,16 +718,17 @@ impl Program {
718718
pub const FUNCTION_ATTRIBUTE: &'static str =
719719
"#[custom_mir(dialect = \"runtime\", phase = \"initial\")]";
720720
pub const HEADER: &'static str = "#![recursion_limit = \"1024\"]
721-
#![feature(custom_mir, core_intrinsics, const_hash)]
721+
#![feature(custom_mir, core_intrinsics, lazy_get)]
722722
#![allow(unused_parens, unused_assignments, overflowing_literals)]
723723
extern crate core;
724724
use core::intrinsics::mir::*;\n";
725725

726726
pub const DUMPER: &'static str = r#"
727727
use std::collections::hash_map::DefaultHasher;
728728
use std::hash::{Hash, Hasher};
729+
use std::sync::LazyLock;
729730
730-
static mut H: DefaultHasher = DefaultHasher::new();
731+
static mut H: LazyLock<DefaultHasher> = LazyLock::new(|| DefaultHasher::new());
731732
732733
#[inline(never)]
733734
fn dump_var(
@@ -737,10 +738,10 @@ impl Program {
737738
val3: impl Hash,
738739
) {
739740
unsafe {
740-
val0.hash(&mut H);
741-
val1.hash(&mut H);
742-
val2.hash(&mut H);
743-
val3.hash(&mut H);
741+
val0.hash(LazyLock::force_mut(&mut H));
742+
val1.hash(LazyLock::force_mut(&mut H));
743+
val2.hash(LazyLock::force_mut(&mut H));
744+
val3.hash(LazyLock::force_mut(&mut H));
744745
}
745746
}
746747
"#;

0 commit comments

Comments
 (0)