Skip to content

Commit bbaeeb8

Browse files
committed
Fix recursive_adt fixture
1 parent 657a925 commit bbaeeb8

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/tools/rust-analyzer/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),
@@ -2896,7 +2897,7 @@ fn recursive_adt() {
28962897
{
28972898
const VARIANT_TAG_TREE: TagTree = TagTree::Choice(
28982899
&[
2899-
TagTree::Leaf,
2900+
TAG_TREE,
29002901
],
29012902
);
29022903
VARIANT_TAG_TREE
@@ -2905,6 +2906,6 @@ fn recursive_adt() {
29052906
TAG_TREE
29062907
};
29072908
"#,
2908-
|e| matches!(e, ConstEvalError::MirEvalError(MirEvalError::StackOverflow)),
2909+
|e| matches!(e, ConstEvalError::MirLowerError(MirLowerError::Loop)),
29092910
);
29102911
}

src/tools/rust-analyzer/crates/hir-ty/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ mod test_db;
5151
#[cfg(test)]
5252
mod tests;
5353

54-
use std::{collections::hash_map::Entry, hash::Hash};
54+
use std::hash::Hash;
5555

5656
use base_db::ra_salsa::InternValueTrivial;
5757
use chalk_ir::{
@@ -62,10 +62,11 @@ use chalk_ir::{
6262
use either::Either;
6363
use hir_def::{hir::ExprId, type_ref::Rawness, CallableDefId, GeneralConstId, TypeOrConstParamId};
6464
use hir_expand::name::Name;
65+
use indexmap::{map::Entry, IndexMap};
6566
use intern::{sym, Symbol};
6667
use la_arena::{Arena, Idx};
6768
use mir::{MirEvalError, VTableMap};
68-
use rustc_hash::{FxHashMap, FxHashSet};
69+
use rustc_hash::{FxBuildHasher, FxHashMap, FxHashSet};
6970
use span::Edition;
7071
use syntax::ast::{make, ConstArg};
7172
use traits::FnTrait;
@@ -196,7 +197,7 @@ pub enum MemoryMap {
196197

197198
#[derive(Debug, Default, Clone, PartialEq, Eq)]
198199
pub struct ComplexMemoryMap {
199-
memory: FxHashMap<usize, Box<[u8]>>,
200+
memory: IndexMap<usize, Box<[u8]>, FxBuildHasher>,
200201
vtable: VTableMap,
201202
}
202203

0 commit comments

Comments
 (0)