Skip to content

Commit f72d965

Browse files
committed
rename ConstEvaluated to ConcreteConst
1 parent 0eb78cf commit f72d965

File tree

9 files changed

+34
-36
lines changed

9 files changed

+34
-36
lines changed

chalk-integration/src/lowering.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,10 +1135,12 @@ impl LowerConst for Const {
11351135
Const::Id { name } => match env.lookup_const(name)? {
11361136
ConstLookup::Parameter(d) => Ok(chalk_ir::ConstData::BoundVar(d).intern(interner)),
11371137
},
1138-
Const::Value { value } => Ok(chalk_ir::ConstData::Evaluated(
1139-
chalk_ir::ConstEvaluated { interned: value },
1140-
)
1141-
.intern(interner)),
1138+
Const::Value { value } => {
1139+
Ok(
1140+
chalk_ir::ConstData::Concrete(chalk_ir::ConcreteConst { interned: value })
1141+
.intern(interner),
1142+
)
1143+
}
11421144
}
11431145
}
11441146
}

chalk-ir/src/debug.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<I: Interner> Debug for Const<I> {
3939
}
4040
}
4141

42-
impl<I: Interner> Debug for ConstEvaluated<I> {
42+
impl<I: Interner> Debug for ConcreteConst<I> {
4343
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error> {
4444
write!(fmt, "{:?}", self.interned)
4545
}
@@ -205,7 +205,7 @@ impl<I: Interner> Debug for ConstData<I> {
205205
ConstData::BoundVar(db) => write!(fmt, "{:?}", db),
206206
ConstData::InferenceVar(var) => write!(fmt, "{:?}", var),
207207
ConstData::Placeholder(index) => write!(fmt, "{:?}", index),
208-
ConstData::Evaluated(evaluated) => write!(fmt, "{:?}", evaluated),
208+
ConstData::Concrete(evaluated) => write!(fmt, "{:?}", evaluated),
209209
}
210210
}
211211
}

chalk-ir/src/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ where
520520
ConstData::Placeholder(universe) => {
521521
folder.fold_free_placeholder_const(*universe, outer_binder)
522522
}
523-
ConstData::Evaluated(ev) => Ok(ConstData::Evaluated(ConstEvaluated {
523+
ConstData::Concrete(ev) => Ok(ConstData::Concrete(ConcreteConst {
524524
interned: folder.target_interner().transfer_const(&ev.interned),
525525
})
526526
.intern(folder.target_interner())),

chalk-ir/src/interner.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ pub trait Interner: Debug + Copy + Eq + Ord + Hash {
7777
type InternedConst: Debug + Clone + Eq + Hash;
7878

7979
/// "Interned" representation of an evaluated const value.
80-
/// `Self::InternedConstEvaluateed` is not referenced. Instead,
81-
/// we refer to `ConstEvaluated<Self>`, which wraps this type.
80+
/// `Self::InternedConcreteConst` is not referenced. Instead,
81+
/// we refer to `ConcreteConst<Self>`, which wraps this type.
8282
///
83-
/// `InternedConstEvaluated` instances are not created by chalk,
83+
/// `InternedConcreteConst` instances are not created by chalk,
8484
/// it can only make a query asking about equality of two
8585
/// evaluated consts.
86-
type InternedConstEvaluated: Debug + Clone + Eq + Hash;
86+
type InternedConcreteConst: Debug + Clone + Eq + Hash;
8787

8888
/// "Interned" representation of a "generic parameter", which can
8989
/// be either a type or a lifetime. In normal user code,
@@ -410,11 +410,7 @@ pub trait Interner: Debug + Copy + Eq + Ord + Hash {
410410
/// Lookup the `ConstData` that was interned to create a `InternedLifetime`.
411411
fn const_data<'a>(&self, constant: &'a Self::InternedConst) -> &'a ConstData<Self>;
412412

413-
fn const_eq(
414-
&self,
415-
c1: &Self::InternedConstEvaluated,
416-
c2: &Self::InternedConstEvaluated,
417-
) -> bool;
413+
fn const_eq(&self, c1: &Self::InternedConcreteConst, c2: &Self::InternedConcreteConst) -> bool;
418414

419415
/// Create an "interned" parameter from `data`. This is not
420416
/// normally invoked directly; instead, you invoke
@@ -507,8 +503,8 @@ pub trait TargetInterner<I: Interner>: Interner {
507503

508504
fn transfer_const(
509505
&self,
510-
const_evaluated: &I::InternedConstEvaluated,
511-
) -> Self::InternedConstEvaluated;
506+
const_evaluated: &I::InternedConcreteConst,
507+
) -> Self::InternedConcreteConst;
512508
}
513509

514510
impl<I: Interner> TargetInterner<I> for I {
@@ -518,8 +514,8 @@ impl<I: Interner> TargetInterner<I> for I {
518514

519515
fn transfer_const(
520516
&self,
521-
const_evaluated: &I::InternedConstEvaluated,
522-
) -> Self::InternedConstEvaluated {
517+
const_evaluated: &I::InternedConcreteConst,
518+
) -> Self::InternedConcreteConst {
523519
const_evaluated.clone()
524520
}
525521
}
@@ -563,7 +559,7 @@ mod default {
563559
type InternedType = Arc<TyData<ChalkIr>>;
564560
type InternedLifetime = LifetimeData<ChalkIr>;
565561
type InternedConst = Arc<ConstData<ChalkIr>>;
566-
type InternedConstEvaluated = u32;
562+
type InternedConcreteConst = u32;
567563
type InternedParameter = ParameterData<ChalkIr>;
568564
type InternedGoal = Arc<GoalData<ChalkIr>>;
569565
type InternedGoals = Vec<Goal<ChalkIr>>;

chalk-ir/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ impl<I: Interner> Const<I> {
635635
ConstData::BoundVar(_) => true,
636636
ConstData::InferenceVar(_) => false,
637637
ConstData::Placeholder(_) => false,
638-
ConstData::Evaluated(_) => false,
638+
ConstData::Concrete(_) => false,
639639
}
640640
}
641641
}
@@ -645,7 +645,7 @@ pub enum ConstData<I: Interner> {
645645
BoundVar(BoundVar),
646646
InferenceVar(InferenceVar),
647647
Placeholder(PlaceholderIndex),
648-
Evaluated(ConstEvaluated<I>),
648+
Concrete(ConcreteConst<I>),
649649
}
650650

651651
impl<I: Interner> ConstData<I> {
@@ -655,12 +655,12 @@ impl<I: Interner> ConstData<I> {
655655
}
656656

657657
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord, HasInterner)]
658-
pub struct ConstEvaluated<I: Interner> {
659-
pub interned: I::InternedConstEvaluated,
658+
pub struct ConcreteConst<I: Interner> {
659+
pub interned: I::InternedConcreteConst,
660660
}
661661

662-
impl<I: Interner> ConstEvaluated<I> {
663-
pub fn c_eq(&self, other: &ConstEvaluated<I>, interner: &I) -> bool {
662+
impl<I: Interner> ConcreteConst<I> {
663+
pub fn c_eq(&self, other: &ConcreteConst<I>, interner: &I) -> bool {
664664
interner.const_eq(&self.interned, &other.interned)
665665
}
666666
}

chalk-ir/src/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ impl<I: Interner> SuperVisit<I> for Const<I> {
467467
ConstData::Placeholder(universe) => {
468468
visitor.visit_free_placeholder_const(*universe, outer_binder)
469469
}
470-
ConstData::Evaluated(_) => R::new(),
470+
ConstData::Concrete(_) => R::new(),
471471
}
472472
}
473473
}

chalk-solve/src/infer/unify.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,13 @@ impl<'t, I: Interner> Unifier<'t, I> {
364364
}
365365

366366
// Unifying an inference variables with a non-inference variable.
367-
(&ConstData::InferenceVar(var), &ConstData::Evaluated(_))
367+
(&ConstData::InferenceVar(var), &ConstData::Concrete(_))
368368
| (&ConstData::InferenceVar(var), &ConstData::Placeholder(_)) => {
369369
debug!("unify_var_ty(var={:?}, ty={:?})", var, b);
370370
self.unify_var_const(var, b)
371371
}
372372

373-
(&ConstData::Evaluated(_), &ConstData::InferenceVar(var))
373+
(&ConstData::Concrete(_), &ConstData::InferenceVar(var))
374374
| (&ConstData::Placeholder(_), &ConstData::InferenceVar(var)) => {
375375
debug!("unify_var_ty(var={:?}, ty={:?})", var, a);
376376

@@ -381,16 +381,16 @@ impl<'t, I: Interner> Unifier<'t, I> {
381381
Zip::zip_with(self, &p1, &p2)
382382
}
383383

384-
(&ConstData::Evaluated(ref ev1), &ConstData::Evaluated(ref ev2)) => {
384+
(&ConstData::Concrete(ref ev1), &ConstData::Concrete(ref ev2)) => {
385385
if ev1.c_eq(ev2, interner) {
386386
Ok(())
387387
} else {
388388
Err(NoSolution)
389389
}
390390
}
391391

392-
(&ConstData::Evaluated(_), &ConstData::Placeholder(_))
393-
| (&ConstData::Placeholder(_), &ConstData::Evaluated(_)) => Err(NoSolution),
392+
(&ConstData::Concrete(_), &ConstData::Placeholder(_))
393+
| (&ConstData::Placeholder(_), &ConstData::Concrete(_)) => Err(NoSolution),
394394

395395
(ConstData::BoundVar(_), _) | (_, ConstData::BoundVar(_)) => panic!(
396396
"unification encountered bound variable: a={:?} b={:?}",

chalk-solve/src/solve/slg/aggregate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ impl<I: Interner> AntiUnifier<'_, '_, I> {
415415
self.new_const_variable()
416416
}
417417
}
418-
(ConstData::Evaluated(e1), ConstData::Evaluated(e2)) => {
418+
(ConstData::Concrete(e1), ConstData::Concrete(e2)) => {
419419
if e1.c_eq(e2, interner) {
420420
c1.clone()
421421
} else {

chalk-solve/src/solve/slg/resolvent.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ impl<'i, I: Interner> Zipper<'i, I> for AnswerSubstitutor<'i, I> {
502502
Ok(())
503503
}
504504

505-
(ConstData::Evaluated(c1), ConstData::Evaluated(c2)) => {
505+
(ConstData::Concrete(c1), ConstData::Concrete(c2)) => {
506506
assert!(c1.c_eq(c2, interner));
507507
Ok(())
508508
}
@@ -514,7 +514,7 @@ impl<'i, I: Interner> Zipper<'i, I> for AnswerSubstitutor<'i, I> {
514514

515515
(ConstData::BoundVar(_), _)
516516
| (ConstData::Placeholder(_), _)
517-
| (ConstData::Evaluated(_), _) => panic!(
517+
| (ConstData::Concrete(_), _) => panic!(
518518
"structural mismatch between answer `{:?}` and pending goal `{:?}`",
519519
answer, pending,
520520
),

0 commit comments

Comments
 (0)