diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests.rs b/src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests.rs index 7093fcadcb030..0a8bfaa70f86f 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests.rs +++ b/src/tools/rust-analyzer/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/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs b/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs index 70e580eeae90a..9c1d8bcf36f02 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/lib.rs +++ b/src/tools/rust-analyzer/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>, + memory: IndexMap, FxBuildHasher>, vtable: VTableMap, }