Skip to content

Commit e7d7a4c

Browse files
committed
rustc_data_structures::fx -> rustc_hash
1 parent a2d9bbe commit e7d7a4c

File tree

12 files changed

+46
-47
lines changed

12 files changed

+46
-47
lines changed

crates/rustc_utils/src/cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
//! can introduces non-determinism in your program.
6161
use std::{cell::RefCell, hash::Hash, pin::Pin};
6262

63-
use rustc_data_structures::fx::FxHashMap as HashMap;
63+
use rustc_hash::FxHashMap as HashMap;
6464

6565
/// Cache for non-copyable types.
6666
pub struct Cache<In, Out>(RefCell<HashMap<In, Option<Pin<Box<Out>>>>>);
@@ -208,7 +208,7 @@ mod test {
208208
}
209209
}
210210

211-
let cache = RecursiveUse(Default::default());
211+
let cache = RecursiveUse(Cache::default());
212212

213213
assert_eq!(cache.get_infinite_recursion(60), 42);
214214
assert_eq!(cache.get_safe_recursion(5), 15);

crates/rustc_utils/src/hir/ty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ mod test {
6464

6565
#[test]
6666
fn test_ty_ext() {
67-
let input = r#"
67+
let input = r"
6868
fn main() {
6969
let x = &mut 0;
7070
let y = 0;
71-
}"#;
71+
}";
7272

7373
test_utils::compile_body(input, |tcx, _, body| {
7474
let body = &body.body;

crates/rustc_utils/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ extern crate rustc_data_structures;
4646
extern crate rustc_driver;
4747
extern crate rustc_errors;
4848
extern crate rustc_graphviz;
49+
extern crate rustc_hash;
4950
extern crate rustc_hir;
5051
extern crate rustc_index;
5152
extern crate rustc_infer;
@@ -89,7 +90,7 @@ macro_rules! hashset {
8990
($($key:expr),*) => {
9091
{
9192
let _cap = hashset!(@count $($key),*);
92-
let mut _set = ::rustc_data_structures::fx::FxHashSet::default();
93+
let mut _set = ::rustc_hash::FxHashSet::default();
9394
let _ = _set.try_reserve(_cap);
9495
$(
9596
let _ = _set.insert($key);

crates/rustc_utils/src/mir/body.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::{
88

99
use anyhow::{ensure, Result};
1010
use pretty::PrettyPrintMirOptions;
11-
use rustc_data_structures::fx::FxHashMap as HashMap;
11+
use rustc_hash::FxHashMap as HashMap;
1212
use rustc_hir::{def_id::DefId, CoroutineDesugaring, CoroutineKind, HirId};
1313
use rustc_middle::{
1414
mir::{
@@ -205,14 +205,14 @@ mod test {
205205

206206
#[test]
207207
fn test_body_ext() {
208-
let input = r#"
209-
fn foobar<'a>(x: &'a i32, y: &'a i32) -> &'a i32 {
210-
if *x > 0 {
211-
return x;
212-
}
213-
214-
y
215-
}"#;
208+
let input = r"
209+
fn foobar<'a>(x: &'a i32, y: &'a i32) -> &'a i32 {
210+
if *x > 0 {
211+
return x;
212+
}
213+
214+
y
215+
}";
216216

217217
test_utils::compile_body(input, |_, _, body| {
218218
let body = &body.body;

crates/rustc_utils/src/mir/borrowck_facts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::sync::atomic::{AtomicBool, Ordering};
44

55
use rustc_borrowck::consumers::{BodyWithBorrowckFacts, ConsumerOptions};
6-
use rustc_data_structures::fx::FxHashSet as HashSet;
6+
use rustc_hash::FxHashSet as HashSet;
77
use rustc_hir::def_id::LocalDefId;
88
use rustc_middle::{
99
mir::{Body, BorrowCheckResult, StatementKind, TerminatorKind},

crates/rustc_utils/src/mir/control_dependencies.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,22 +202,22 @@ impl<Node: Idx + Ord> ControlDependencies<Node> {
202202
#[cfg(test)]
203203
mod test {
204204
use log::debug;
205-
use rustc_data_structures::fx::{FxHashMap as HashMap, FxHashSet as HashSet};
205+
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
206206
use rustc_middle::mir::Location;
207207
use test_log::test;
208208

209209
use crate::{test_utils, BodyExt};
210210

211211
#[test]
212212
fn test_control_dependencies() {
213-
let input = r#"
214-
fn main() {
215-
let mut x = 1;
216-
x = 2;
217-
if true { x = 3; }
218-
for _ in 0 .. 1 { x = 4; }
219-
x = 5;
220-
}"#;
213+
let input = r"
214+
fn main() {
215+
let mut x = 1;
216+
x = 2;
217+
if true { x = 3; }
218+
for _ in 0 .. 1 { x = 4; }
219+
x = 5;
220+
}";
221221
test_utils::compile_body(input, move |tcx, _, body_with_facts| {
222222
let body = &body_with_facts.body;
223223
let control_deps = body.control_dependencies();

crates/rustc_utils/src/mir/place.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::{borrow::Cow, collections::VecDeque};
44

55
use log::{trace, warn};
6-
use rustc_data_structures::fx::{FxHashMap as HashMap, FxHashSet as HashSet};
6+
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
77
use rustc_hir::def_id::DefId;
88
use rustc_infer::infer::TyCtxtInferExt;
99
use rustc_middle::{
@@ -649,15 +649,15 @@ mod test {
649649

650650
#[test]
651651
fn test_place_arg_direct() {
652-
let input = r#"
652+
let input = r"
653653
fn foobar(x: &i32) {
654654
let y = 1;
655655
let z = &y;
656656
let k = Box::new(*x);
657657
let ref_k = &k;
658658
let box_ref = Box::new(x);
659659
}
660-
"#;
660+
";
661661
test_utils::compile_body(input, |tcx, _, body_with_facts| {
662662
let body = &body_with_facts.body;
663663
let name_map = body.debug_info_name_map();
@@ -706,16 +706,15 @@ fn foobar(x: &i32) {
706706

707707
#[test]
708708
fn test_place_to_string() {
709-
let input = r#"
709+
let input = r"
710710
struct Point { x: usize, y: usize }
711711
fn main() {
712712
let x = (0, 0);
713713
let y = Some(1);
714714
let z = &[Some((0, 1))];
715715
let w = (&y,);
716716
let p = &Point { x: 0, y: 0 };
717-
}
718-
"#;
717+
}";
719718
test_utils::compile_body(input, |tcx, _, body_with_facts| {
720719
let body = &body_with_facts.body;
721720
let p = Placer::new(tcx, body);
@@ -753,12 +752,12 @@ fn main() {
753752

754753
#[test]
755754
fn test_place_visitors() {
756-
let input = r#"
755+
let input = r"
757756
fn main() {
758757
let x = 0;
759758
let y = (0, &x);
760759
}
761-
"#;
760+
";
762761
fn callback<'tcx>(
763762
tcx: TyCtxt<'tcx>,
764763
body_id: BodyId,

crates/rustc_utils/src/source_map/find_bodies.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ mod test {
7474

7575
#[test]
7676
fn test_find_bodies() {
77-
let input = r#"
77+
let input = r"
7878
// Ignore constants
7979
const C: usize = 0;
8080
@@ -91,7 +91,7 @@ macro_rules! m {
9191
9292
// Ignore macro-generated bodies
9393
m!{}
94-
"#;
94+
";
9595
test_utils::CompileBuilder::new(input).compile(|CompileResult { tcx }| {
9696
assert_eq!(find_bodies(tcx).len(), 3);
9797
});

crates/rustc_utils/src/source_map/range.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ use std::{
44
};
55

66
use anyhow::{bail, ensure, Context, Result};
7-
use rustc_data_structures::{fx::FxHashMap as HashMap, sync::Lrc};
7+
use rustc_data_structures::sync::Lrc;
8+
use rustc_hash::FxHashMap as HashMap;
89
use rustc_hir::{
910
intravisit::{self, Visitor},
1011
BodyId,

crates/rustc_utils/src/source_map/spanner/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ impl<'tcx> Spanner<'tcx> {
232232

233233
#[cfg(test)]
234234
mod test {
235-
use rustc_data_structures::fx::FxHashSet as HashSet;
235+
use rustc_hash::FxHashSet as HashSet;
236236
use rustc_middle::mir::BasicBlock;
237237
use test_log::test;
238238

@@ -284,7 +284,7 @@ mod test {
284284
&["w.0"],
285285
&["w.0"],
286286
];
287-
for (input_span, desired) in spans.into_iter().zip(expected.into_iter()) {
287+
for (input_span, desired) in spans.into_iter().zip(expected) {
288288
let outputs = spanner.span_to_places(input_span);
289289
let snippets = outputs
290290
.into_iter()
@@ -298,8 +298,8 @@ mod test {
298298
}
299299

300300
fn compare_sets(desired: &HashSet<impl AsRef<str>>, actual: &HashSet<impl AsRef<str>>) {
301-
let desired = desired.iter().map(|s| s.as_ref()).collect::<HashSet<_>>();
302-
let actual = actual.iter().map(|s| s.as_ref()).collect::<HashSet<_>>();
301+
let desired = desired.iter().map(AsRef::as_ref).collect::<HashSet<_>>();
302+
let actual = actual.iter().map(AsRef::as_ref).collect::<HashSet<_>>();
303303
let missing_desired = &desired - &actual;
304304
let missing_actual = &actual - &desired;
305305

@@ -315,7 +315,7 @@ mod test {
315315

316316
#[test]
317317
fn test_location_to_spans() {
318-
let src = r#"fn foo() {
318+
let src = r"fn foo() {
319319
let mut x: i32 = 1;
320320
let y = x + 2;
321321
let w = if true {
@@ -329,7 +329,7 @@ mod test {
329329
let q = x
330330
.leading_ones()
331331
.trailing_zeros();
332-
}"#;
332+
}";
333333

334334
// This affects source mapping, and this feature is primarily used by Flowistry, so
335335
// we enable MIR simplification for consistency with Flowistry.

0 commit comments

Comments
 (0)