Skip to content

Commit

Permalink
Fix recursive_adt fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Oct 21, 2024
1 parent 657a925 commit bbaeeb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -2896,7 +2897,7 @@ fn recursive_adt() {
{
const VARIANT_TAG_TREE: TagTree = TagTree::Choice(
&[
TagTree::Leaf,
TAG_TREE,
],
);
VARIANT_TAG_TREE
Expand All @@ -2905,6 +2906,6 @@ fn recursive_adt() {
TAG_TREE
};
"#,
|e| matches!(e, ConstEvalError::MirEvalError(MirEvalError::StackOverflow)),
|e| matches!(e, ConstEvalError::MirLowerError(MirLowerError::Loop)),
);
}
7 changes: 4 additions & 3 deletions src/tools/rust-analyzer/crates/hir-ty/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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;
Expand Down Expand Up @@ -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,
}

Expand Down

0 comments on commit bbaeeb8

Please sign in to comment.