Unnamed repository; edit this file 'description' to name the repository.
Fix recursive_adt fixture
Lukas Wirth 2024-10-21
parent 6a2b827 · commit 1cdc34f
-rw-r--r--crates/hir-ty/src/consteval/tests.rs7
-rw-r--r--crates/hir-ty/src/lib.rs7
2 files changed, 8 insertions, 6 deletions
diff --git a/crates/hir-ty/src/consteval/tests.rs b/crates/hir-ty/src/consteval/tests.rs
index 7093fcadcb..0a8bfaa70f 100644
--- a/crates/hir-ty/src/consteval/tests.rs
+++ b/crates/hir-ty/src/consteval/tests.rs
@@ -95,7 +95,8 @@ fn check_answer(ra_fixture: &str, check: impl FnOnce(&[u8], &MemoryMap)) {
fn pretty_print_err(e: ConstEvalError, db: TestDB) -> String {
let mut err = String::new();
let span_formatter = |file, range| format!("{file:?} {range:?}");
- let edition = db.crate_graph()[db.test_crate()].edition;
+ let edition =
+ db.crate_graph()[*db.crate_graph().crates_in_topological_order().last().unwrap()].edition;
match e {
ConstEvalError::MirLowerError(e) => e.pretty_print(&mut err, &db, span_formatter, edition),
ConstEvalError::MirEvalError(e) => e.pretty_print(&mut err, &db, span_formatter, edition),
@@ -2896,7 +2897,7 @@ fn recursive_adt() {
{
const VARIANT_TAG_TREE: TagTree = TagTree::Choice(
&[
- TagTree::Leaf,
+ TAG_TREE,
],
);
VARIANT_TAG_TREE
@@ -2905,6 +2906,6 @@ fn recursive_adt() {
TAG_TREE
};
"#,
- |e| matches!(e, ConstEvalError::MirEvalError(MirEvalError::StackOverflow)),
+ |e| matches!(e, ConstEvalError::MirLowerError(MirLowerError::Loop)),
);
}
diff --git a/crates/hir-ty/src/lib.rs b/crates/hir-ty/src/lib.rs
index 70e580eeae..9c1d8bcf36 100644
--- a/crates/hir-ty/src/lib.rs
+++ b/crates/hir-ty/src/lib.rs
@@ -51,7 +51,7 @@ mod test_db;
#[cfg(test)]
mod tests;
-use std::{collections::hash_map::Entry, hash::Hash};
+use std::hash::Hash;
use base_db::ra_salsa::InternValueTrivial;
use chalk_ir::{
@@ -62,10 +62,11 @@ use chalk_ir::{
use either::Either;
use hir_def::{hir::ExprId, type_ref::Rawness, CallableDefId, GeneralConstId, TypeOrConstParamId};
use hir_expand::name::Name;
+use indexmap::{map::Entry, IndexMap};
use intern::{sym, Symbol};
use la_arena::{Arena, Idx};
use mir::{MirEvalError, VTableMap};
-use rustc_hash::{FxHashMap, FxHashSet};
+use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet};
use span::Edition;
use syntax::ast::{make, ConstArg};
use traits::FnTrait;
@@ -196,7 +197,7 @@ pub enum MemoryMap {
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct ComplexMemoryMap {
- memory: FxHashMap<usize, Box<[u8]>>,
+ memory: IndexMap<usize, Box<[u8]>, FxBuildHasher>,
vtable: VTableMap,
}