mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Evaluate UnevalutedConst
before trait solving
This commit is contained in:
parent
08f0c29954
commit
cd4bffdd69
4 changed files with 80 additions and 14 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::env::var;
|
||||
|
||||
use chalk_ir::GoalData;
|
||||
use chalk_ir::{fold::TypeFoldable, DebruijnIndex, GoalData};
|
||||
use chalk_recursive::Cache;
|
||||
use chalk_solve::{logging_db::LoggingRustIrDatabase, rust_ir, Solver};
|
||||
|
||||
|
@ -16,9 +16,9 @@ use stdx::panic_context;
|
|||
use triomphe::Arc;
|
||||
|
||||
use crate::{
|
||||
db::HirDatabase, infer::unify::InferenceTable, AliasEq, AliasTy, Canonical, DomainGoal, Goal,
|
||||
Guidance, InEnvironment, Interner, ProjectionTy, ProjectionTyExt, Solution, TraitRefExt, Ty,
|
||||
TyKind, WhereClause,
|
||||
db::HirDatabase, infer::unify::InferenceTable, utils::UnevaluatedConstEvaluatorFolder, AliasEq,
|
||||
AliasTy, Canonical, DomainGoal, Goal, Guidance, InEnvironment, Interner, ProjectionTy,
|
||||
ProjectionTyExt, Solution, TraitRefExt, Ty, TyKind, WhereClause,
|
||||
};
|
||||
|
||||
/// This controls how much 'time' we give the Chalk solver before giving up.
|
||||
|
@ -106,6 +106,12 @@ pub(crate) fn trait_solve_query(
|
|||
}
|
||||
}
|
||||
|
||||
// Chalk see `UnevaluatedConst` as a unique concrete value, but we see it as an alias for another const. So
|
||||
// we should get rid of it when talking to chalk.
|
||||
let goal = goal
|
||||
.try_fold_with(&mut UnevaluatedConstEvaluatorFolder { db }, DebruijnIndex::INNERMOST)
|
||||
.unwrap();
|
||||
|
||||
// We currently don't deal with universes (I think / hope they're not yet
|
||||
// relevant for our use cases?)
|
||||
let u_canonical = chalk_ir::UCanonical { canonical: goal, universes: 1 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue