Fix recursive_adt fixture

This commit is contained in:
Lukas Wirth 2024-09-03 12:50:24 +02:00
parent 657a925710
commit bbaeeb8262
2 changed files with 8 additions and 6 deletions

View File

@ -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 @@ pub enum TagTree {
{
const VARIANT_TAG_TREE: TagTree = TagTree::Choice(
&[
TagTree::Leaf,
TAG_TREE,
],
);
VARIANT_TAG_TREE
@ -2905,6 +2906,6 @@ pub enum TagTree {
TAG_TREE
};
"#,
|e| matches!(e, ConstEvalError::MirEvalError(MirEvalError::StackOverflow)),
|e| matches!(e, ConstEvalError::MirLowerError(MirLowerError::Loop)),
);
}

View File

@ -51,7 +51,7 @@
#[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 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,
}