1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
//! Implementations of the Chalk `Cast` trait for our types.
use chalk_ir::{
cast::{Cast, CastTo},
interner::HasInterner,
};
use crate::{
AliasEq, CallableSig, DomainGoal, GenericArg, GenericArgData, Interner, PolyFnSig,
ReturnTypeImplTraits, TraitRef, Ty, WhereClause,
};
macro_rules! has_interner {
($t:ty) => {
impl HasInterner for $t {
type Interner = crate::Interner;
}
};
}
macro_rules! transitive_impl {
($a:ty, $b:ty, $c:ty) => {
impl CastTo<$c> for $a {
fn cast_to(self, interner: &Interner) -> $c {
self.cast::<$b>(interner).cast(interner)
}
}
};
}
has_interner!(CallableSig);
has_interner!(ReturnTypeImplTraits);
|