Skip to content

Commit 1a7b113

Browse files
committed
Fix recursive_adt fixture
1 parent 512b6bc commit 1a7b113

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

crates/hir-ty/src/consteval/tests.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ fn check_answer(ra_fixture: &str, check: impl FnOnce(&[u8], &MemoryMap)) {
9595
fn pretty_print_err(e: ConstEvalError, db: TestDB) -> String {
9696
let mut err = String::new();
9797
let span_formatter = |file, range| format!("{file:?} {range:?}");
98-
let edition = db.crate_graph()[db.test_crate()].edition;
98+
let edition =
99+
db.crate_graph()[*db.crate_graph().crates_in_topological_order().last().unwrap()].edition;
99100
match e {
100101
ConstEvalError::MirLowerError(e) => e.pretty_print(&mut err, &db, span_formatter, edition),
101102
ConstEvalError::MirEvalError(e) => e.pretty_print(&mut err, &db, span_formatter, edition),
@@ -2881,7 +2882,7 @@ fn recursive_adt() {
28812882
{
28822883
const VARIANT_TAG_TREE: TagTree = TagTree::Choice(
28832884
&[
2884-
TagTree::Leaf,
2885+
TAG_TREE,
28852886
],
28862887
);
28872888
VARIANT_TAG_TREE
@@ -2890,6 +2891,6 @@ fn recursive_adt() {
28902891
TAG_TREE
28912892
};
28922893
"#,
2893-
|e| matches!(e, ConstEvalError::MirEvalError(MirEvalError::StackOverflow)),
2894+
|e| matches!(e, ConstEvalError::MirLowerError(MirLowerError::Loop)),
28942895
);
28952896
}

crates/hir-ty/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mod test_db;
4848
#[cfg(test)]
4949
mod tests;
5050

51-
use std::{collections::hash_map::Entry, hash::Hash};
51+
use std::hash::Hash;
5252

5353
use base_db::salsa::InternValueTrivial;
5454
use chalk_ir::{
@@ -59,10 +59,11 @@ use chalk_ir::{
5959
use either::Either;
6060
use hir_def::{hir::ExprId, type_ref::Rawness, CallableDefId, GeneralConstId, TypeOrConstParamId};
6161
use hir_expand::name::Name;
62+
use indexmap::{map::Entry, IndexMap};
6263
use intern::{sym, Symbol};
6364
use la_arena::{Arena, Idx};
6465
use mir::{MirEvalError, VTableMap};
65-
use rustc_hash::{FxHashMap, FxHashSet};
66+
use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet};
6667
use span::Edition;
6768
use syntax::ast::{make, ConstArg};
6869
use traits::FnTrait;
@@ -192,7 +193,7 @@ pub enum MemoryMap {
192193

193194
#[derive(Debug, Default, Clone, PartialEq, Eq)]
194195
pub struct ComplexMemoryMap {
195-
memory: FxHashMap<usize, Box<[u8]>>,
196+
memory: IndexMap<usize, Box<[u8]>, FxBuildHasher>,
196197
vtable: VTableMap,
197198
}
198199

0 commit comments

Comments
 (0)