mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Bump chalk
This commit is contained in:
parent
e05e6c60a7
commit
78beb4c444
16
Cargo.lock
generated
16
Cargo.lock
generated
@ -171,9 +171,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chalk-derive"
|
||||
version = "0.82.0"
|
||||
version = "0.83.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ee9cd790d543c29ce953abcb28d54b9fbaf9c4033bfd3024de99b1aa0f3c3ada"
|
||||
checksum = "83553c2ef7717e58aecdf42dd9e3c876229f5a1f35a16435b5ddc4addef81827"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -183,9 +183,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "chalk-ir"
|
||||
version = "0.82.0"
|
||||
version = "0.83.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dddf2c11f9de666c08c7591eb113efcdc740bd8ac602915475b045bcbe7f27a5"
|
||||
checksum = "2dd42107d579d8ec2a5af20a8de62a37524a67bf6a4c0ff08a950068f0bfea91"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"chalk-derive",
|
||||
@ -194,9 +194,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "chalk-recursive"
|
||||
version = "0.82.0"
|
||||
version = "0.83.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a60d5b35598702963ffd145b8bfa0d8d8ae9da3a731e4e0814aa21541b85c2d5"
|
||||
checksum = "c444031541a76c13c145e76d91f1548e9feb2240e7f0c3e77879ceb694994f2d"
|
||||
dependencies = [
|
||||
"chalk-derive",
|
||||
"chalk-ir",
|
||||
@ -207,9 +207,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "chalk-solve"
|
||||
version = "0.82.0"
|
||||
version = "0.83.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d99da4fa3b224c07f6c2506e6905bca9d6aad665f11d25364e6818a7ea149215"
|
||||
checksum = "c76f2db19c5e8a3d42340cf5b4d90b8c218750536fca35e2bb285ab6653c0bc8"
|
||||
dependencies = [
|
||||
"chalk-derive",
|
||||
"chalk-ir",
|
||||
|
@ -18,9 +18,9 @@ ena = "0.14.0"
|
||||
tracing = "0.1.35"
|
||||
rustc-hash = "1.1.0"
|
||||
scoped-tls = "1.0.0"
|
||||
chalk-solve = { version = "0.82.0", default-features = false }
|
||||
chalk-ir = "0.82.0"
|
||||
chalk-recursive = { version = "0.82.0", default-features = false }
|
||||
chalk-solve = { version = "0.83.0", default-features = false }
|
||||
chalk-ir = "0.83.0"
|
||||
chalk-recursive = { version = "0.83.0", default-features = false }
|
||||
la-arena = { version = "0.3.0", path = "../../lib/la-arena" }
|
||||
once_cell = "1.12.0"
|
||||
typed-arena = "2.0.1"
|
||||
|
@ -4,7 +4,7 @@ use std::iter;
|
||||
|
||||
use chalk_ir::{
|
||||
cast::{Cast, CastTo, Caster},
|
||||
fold::Fold,
|
||||
fold::TypeFoldable,
|
||||
interner::HasInterner,
|
||||
AdtId, BoundVar, DebruijnIndex, Scalar,
|
||||
};
|
||||
@ -276,7 +276,7 @@ impl TyBuilder<TypeAliasId> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: HasInterner<Interner = Interner> + Fold<Interner>> TyBuilder<Binders<T>> {
|
||||
impl<T: HasInterner<Interner = Interner> + TypeFoldable<Interner>> TyBuilder<Binders<T>> {
|
||||
fn subst_binders(b: Binders<T>) -> Self {
|
||||
let param_kinds = b
|
||||
.binders
|
||||
@ -290,7 +290,7 @@ impl<T: HasInterner<Interner = Interner> + Fold<Interner>> TyBuilder<Binders<T>>
|
||||
TyBuilder::new(b, param_kinds)
|
||||
}
|
||||
|
||||
pub fn build(self) -> <T as Fold<Interner>>::Result {
|
||||
pub fn build(self) -> T {
|
||||
let (b, subst) = self.build_internal();
|
||||
b.substitute(Interner, &subst)
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
use std::{fmt, mem, sync::Arc};
|
||||
|
||||
use chalk_ir::{
|
||||
cast::Cast, fold::Fold, interner::HasInterner, zip::Zip, CanonicalVarKind, FloatTy, IntTy,
|
||||
NoSolution, TyVariableKind, UniverseIndex,
|
||||
cast::Cast, fold::TypeFoldable, interner::HasInterner, zip::Zip, CanonicalVarKind, FloatTy,
|
||||
IntTy, NoSolution, TyVariableKind, UniverseIndex,
|
||||
};
|
||||
use chalk_solve::infer::ParameterEnaVariableExt;
|
||||
use ena::unify::UnifyKey;
|
||||
@ -20,12 +20,12 @@ use crate::{
|
||||
};
|
||||
|
||||
impl<'a> InferenceContext<'a> {
|
||||
pub(super) fn canonicalize<T: Fold<Interner> + HasInterner<Interner = Interner>>(
|
||||
pub(super) fn canonicalize<T: TypeFoldable<Interner> + HasInterner<Interner = Interner>>(
|
||||
&mut self,
|
||||
t: T,
|
||||
) -> Canonicalized<T::Result>
|
||||
) -> Canonicalized<T>
|
||||
where
|
||||
T::Result: HasInterner<Interner = Interner>,
|
||||
T: HasInterner<Interner = Interner>,
|
||||
{
|
||||
self.table.canonicalize(t)
|
||||
}
|
||||
@ -200,12 +200,12 @@ impl<'a> InferenceTable<'a> {
|
||||
.intern(Interner)
|
||||
}
|
||||
|
||||
pub(crate) fn canonicalize<T: Fold<Interner> + HasInterner<Interner = Interner>>(
|
||||
pub(crate) fn canonicalize<T: TypeFoldable<Interner> + HasInterner<Interner = Interner>>(
|
||||
&mut self,
|
||||
t: T,
|
||||
) -> Canonicalized<T::Result>
|
||||
) -> Canonicalized<T>
|
||||
where
|
||||
T::Result: HasInterner<Interner = Interner>,
|
||||
T: HasInterner<Interner = Interner>,
|
||||
{
|
||||
// try to resolve obligations before canonicalizing, since this might
|
||||
// result in new knowledge about variables
|
||||
@ -292,9 +292,9 @@ impl<'a> InferenceTable<'a> {
|
||||
&mut self,
|
||||
t: T,
|
||||
fallback: &dyn Fn(InferenceVar, VariableKind, GenericArg, DebruijnIndex) -> GenericArg,
|
||||
) -> T::Result
|
||||
) -> T
|
||||
where
|
||||
T: HasInterner<Interner = Interner> + Fold<Interner>,
|
||||
T: HasInterner<Interner = Interner> + TypeFoldable<Interner>,
|
||||
{
|
||||
self.resolve_with_fallback_inner(&mut Vec::new(), t, &fallback)
|
||||
}
|
||||
@ -310,9 +310,9 @@ impl<'a> InferenceTable<'a> {
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn instantiate_canonical<T>(&mut self, canonical: Canonical<T>) -> T::Result
|
||||
pub(crate) fn instantiate_canonical<T>(&mut self, canonical: Canonical<T>) -> T
|
||||
where
|
||||
T: HasInterner<Interner = Interner> + Fold<Interner> + std::fmt::Debug,
|
||||
T: HasInterner<Interner = Interner> + TypeFoldable<Interner> + std::fmt::Debug,
|
||||
{
|
||||
let subst = self.fresh_subst(canonical.binders.as_slice(Interner));
|
||||
subst.apply(canonical.value, Interner)
|
||||
@ -323,9 +323,9 @@ impl<'a> InferenceTable<'a> {
|
||||
var_stack: &mut Vec<InferenceVar>,
|
||||
t: T,
|
||||
fallback: &dyn Fn(InferenceVar, VariableKind, GenericArg, DebruijnIndex) -> GenericArg,
|
||||
) -> T::Result
|
||||
) -> T
|
||||
where
|
||||
T: HasInterner<Interner = Interner> + Fold<Interner>,
|
||||
T: HasInterner<Interner = Interner> + TypeFoldable<Interner>,
|
||||
{
|
||||
t.fold_with(
|
||||
&mut resolve::Resolver { table: self, var_stack, fallback },
|
||||
@ -334,9 +334,9 @@ impl<'a> InferenceTable<'a> {
|
||||
.expect("fold failed unexpectedly")
|
||||
}
|
||||
|
||||
pub(crate) fn resolve_completely<T>(&mut self, t: T) -> T::Result
|
||||
pub(crate) fn resolve_completely<T>(&mut self, t: T) -> T
|
||||
where
|
||||
T: HasInterner<Interner = Interner> + Fold<Interner>,
|
||||
T: HasInterner<Interner = Interner> + TypeFoldable<Interner>,
|
||||
{
|
||||
self.resolve_with_fallback(t, &|_, _, d, _| d)
|
||||
}
|
||||
@ -447,19 +447,19 @@ impl<'a> InferenceTable<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn fudge_inference<T: Fold<Interner>>(
|
||||
pub(crate) fn fudge_inference<T: TypeFoldable<Interner>>(
|
||||
&mut self,
|
||||
f: impl FnOnce(&mut Self) -> T,
|
||||
) -> T::Result {
|
||||
use chalk_ir::fold::Folder;
|
||||
) -> T {
|
||||
use chalk_ir::fold::TypeFolder;
|
||||
struct VarFudger<'a, 'b> {
|
||||
table: &'a mut InferenceTable<'b>,
|
||||
highest_known_var: InferenceVar,
|
||||
}
|
||||
impl<'a, 'b> Folder<Interner> for VarFudger<'a, 'b> {
|
||||
impl<'a, 'b> TypeFolder<Interner> for VarFudger<'a, 'b> {
|
||||
type Error = NoSolution;
|
||||
|
||||
fn as_dyn(&mut self) -> &mut dyn Folder<Interner, Error = Self::Error> {
|
||||
fn as_dyn(&mut self) -> &mut dyn TypeFolder<Interner, Error = Self::Error> {
|
||||
self
|
||||
}
|
||||
|
||||
@ -635,7 +635,7 @@ mod resolve {
|
||||
};
|
||||
use chalk_ir::{
|
||||
cast::Cast,
|
||||
fold::{Fold, Folder},
|
||||
fold::{TypeFoldable, TypeFolder},
|
||||
Fallible, NoSolution,
|
||||
};
|
||||
use hir_def::type_ref::ConstScalar;
|
||||
@ -645,13 +645,13 @@ mod resolve {
|
||||
pub(super) var_stack: &'a mut Vec<InferenceVar>,
|
||||
pub(super) fallback: F,
|
||||
}
|
||||
impl<'a, 'b, 'i, F> Folder<Interner> for Resolver<'a, 'b, F>
|
||||
impl<'a, 'b, 'i, F> TypeFolder<Interner> for Resolver<'a, 'b, F>
|
||||
where
|
||||
F: Fn(InferenceVar, VariableKind, GenericArg, DebruijnIndex) -> GenericArg + 'i,
|
||||
{
|
||||
type Error = NoSolution;
|
||||
|
||||
fn as_dyn(&mut self) -> &mut dyn Folder<Interner, Error = Self::Error> {
|
||||
fn as_dyn(&mut self) -> &mut dyn TypeFolder<Interner, Error = Self::Error> {
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ mod test_db;
|
||||
use std::sync::Arc;
|
||||
|
||||
use chalk_ir::{
|
||||
fold::{Fold, Shift},
|
||||
fold::{Shift, TypeFoldable},
|
||||
interner::HasInterner,
|
||||
NoSolution,
|
||||
};
|
||||
@ -136,7 +136,7 @@ pub fn param_idx(db: &dyn HirDatabase, id: TypeOrConstParamId) -> Option<usize>
|
||||
|
||||
pub(crate) fn wrap_empty_binders<T>(value: T) -> Binders<T>
|
||||
where
|
||||
T: Fold<Interner, Result = T> + HasInterner<Interner = Interner>,
|
||||
T: TypeFoldable<Interner> + HasInterner<Interner = Interner>,
|
||||
{
|
||||
Binders::empty(Interner, value.shifted_in_from(Interner, DebruijnIndex::ONE))
|
||||
}
|
||||
@ -264,14 +264,12 @@ impl CallableSig {
|
||||
}
|
||||
}
|
||||
|
||||
impl Fold<Interner> for CallableSig {
|
||||
type Result = CallableSig;
|
||||
|
||||
impl TypeFoldable<Interner> for CallableSig {
|
||||
fn fold_with<E>(
|
||||
self,
|
||||
folder: &mut dyn chalk_ir::fold::Folder<Interner, Error = E>,
|
||||
folder: &mut dyn chalk_ir::fold::TypeFolder<Interner, Error = E>,
|
||||
outer_binder: DebruijnIndex,
|
||||
) -> Result<Self::Result, E> {
|
||||
) -> Result<Self, E> {
|
||||
let vec = self.params_and_return.to_vec();
|
||||
let folded = vec.fold_with(folder, outer_binder)?;
|
||||
Ok(CallableSig { params_and_return: folded.into(), is_varargs: self.is_varargs })
|
||||
@ -300,22 +298,22 @@ pub fn static_lifetime() -> Lifetime {
|
||||
LifetimeData::Static.intern(Interner)
|
||||
}
|
||||
|
||||
pub(crate) fn fold_free_vars<T: HasInterner<Interner = Interner> + Fold<Interner>>(
|
||||
pub(crate) fn fold_free_vars<T: HasInterner<Interner = Interner> + TypeFoldable<Interner>>(
|
||||
t: T,
|
||||
for_ty: impl FnMut(BoundVar, DebruijnIndex) -> Ty,
|
||||
for_const: impl FnMut(Ty, BoundVar, DebruijnIndex) -> Const,
|
||||
) -> T::Result {
|
||||
use chalk_ir::{fold::Folder, Fallible};
|
||||
) -> T {
|
||||
use chalk_ir::{fold::TypeFolder, Fallible};
|
||||
struct FreeVarFolder<F1, F2>(F1, F2);
|
||||
impl<
|
||||
'i,
|
||||
F1: FnMut(BoundVar, DebruijnIndex) -> Ty + 'i,
|
||||
F2: FnMut(Ty, BoundVar, DebruijnIndex) -> Const + 'i,
|
||||
> Folder<Interner> for FreeVarFolder<F1, F2>
|
||||
> TypeFolder<Interner> for FreeVarFolder<F1, F2>
|
||||
{
|
||||
type Error = NoSolution;
|
||||
|
||||
fn as_dyn(&mut self) -> &mut dyn Folder<Interner, Error = Self::Error> {
|
||||
fn as_dyn(&mut self) -> &mut dyn TypeFolder<Interner, Error = Self::Error> {
|
||||
self
|
||||
}
|
||||
|
||||
@ -344,11 +342,11 @@ pub(crate) fn fold_free_vars<T: HasInterner<Interner = Interner> + Fold<Interner
|
||||
.expect("fold failed unexpectedly")
|
||||
}
|
||||
|
||||
pub(crate) fn fold_tys<T: HasInterner<Interner = Interner> + Fold<Interner>>(
|
||||
pub(crate) fn fold_tys<T: HasInterner<Interner = Interner> + TypeFoldable<Interner>>(
|
||||
t: T,
|
||||
mut for_ty: impl FnMut(Ty, DebruijnIndex) -> Ty,
|
||||
binders: DebruijnIndex,
|
||||
) -> T::Result {
|
||||
) -> T {
|
||||
fold_tys_and_consts(
|
||||
t,
|
||||
|x, d| match x {
|
||||
@ -359,22 +357,22 @@ pub(crate) fn fold_tys<T: HasInterner<Interner = Interner> + Fold<Interner>>(
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn fold_tys_and_consts<T: HasInterner<Interner = Interner> + Fold<Interner>>(
|
||||
pub(crate) fn fold_tys_and_consts<T: HasInterner<Interner = Interner> + TypeFoldable<Interner>>(
|
||||
t: T,
|
||||
f: impl FnMut(Either<Ty, Const>, DebruijnIndex) -> Either<Ty, Const>,
|
||||
binders: DebruijnIndex,
|
||||
) -> T::Result {
|
||||
) -> T {
|
||||
use chalk_ir::{
|
||||
fold::{Folder, SuperFold},
|
||||
fold::{TypeFolder, TypeSuperFoldable},
|
||||
Fallible,
|
||||
};
|
||||
struct TyFolder<F>(F);
|
||||
impl<'i, F: FnMut(Either<Ty, Const>, DebruijnIndex) -> Either<Ty, Const> + 'i> Folder<Interner>
|
||||
for TyFolder<F>
|
||||
impl<'i, F: FnMut(Either<Ty, Const>, DebruijnIndex) -> Either<Ty, Const> + 'i>
|
||||
TypeFolder<Interner> for TyFolder<F>
|
||||
{
|
||||
type Error = NoSolution;
|
||||
|
||||
fn as_dyn(&mut self) -> &mut dyn Folder<Interner, Error = Self::Error> {
|
||||
fn as_dyn(&mut self) -> &mut dyn TypeFolder<Interner, Error = Self::Error> {
|
||||
self
|
||||
}
|
||||
|
||||
@ -397,22 +395,22 @@ pub(crate) fn fold_tys_and_consts<T: HasInterner<Interner = Interner> + Fold<Int
|
||||
/// 'Canonicalizes' the `t` by replacing any errors with new variables. Also
|
||||
/// ensures there are no unbound variables or inference variables anywhere in
|
||||
/// the `t`.
|
||||
pub fn replace_errors_with_variables<T>(t: &T) -> Canonical<T::Result>
|
||||
pub fn replace_errors_with_variables<T>(t: &T) -> Canonical<T>
|
||||
where
|
||||
T: HasInterner<Interner = Interner> + Fold<Interner> + Clone,
|
||||
T::Result: HasInterner<Interner = Interner>,
|
||||
T: HasInterner<Interner = Interner> + TypeFoldable<Interner> + Clone,
|
||||
T: HasInterner<Interner = Interner>,
|
||||
{
|
||||
use chalk_ir::{
|
||||
fold::{Folder, SuperFold},
|
||||
fold::{TypeFolder, TypeSuperFoldable},
|
||||
Fallible,
|
||||
};
|
||||
struct ErrorReplacer {
|
||||
vars: usize,
|
||||
}
|
||||
impl Folder<Interner> for ErrorReplacer {
|
||||
impl TypeFolder<Interner> for ErrorReplacer {
|
||||
type Error = NoSolution;
|
||||
|
||||
fn as_dyn(&mut self) -> &mut dyn Folder<Interner, Error = Self::Error> {
|
||||
fn as_dyn(&mut self) -> &mut dyn TypeFolder<Interner, Error = Self::Error> {
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,9 @@ use std::{
|
||||
};
|
||||
|
||||
use base_db::CrateId;
|
||||
use chalk_ir::{cast::Cast, fold::Fold, fold::Shift, interner::HasInterner, Mutability, Safety};
|
||||
use chalk_ir::{
|
||||
cast::Cast, fold::Shift, fold::TypeFoldable, interner::HasInterner, Mutability, Safety,
|
||||
};
|
||||
|
||||
use hir_def::{
|
||||
adt::StructKind,
|
||||
@ -1751,10 +1753,10 @@ pub(crate) fn const_or_path_to_chalk(
|
||||
|
||||
/// This replaces any 'free' Bound vars in `s` (i.e. those with indices past
|
||||
/// num_vars_to_keep) by `TyKind::Unknown`.
|
||||
fn fallback_bound_vars<T: Fold<Interner> + HasInterner<Interner = Interner>>(
|
||||
fn fallback_bound_vars<T: TypeFoldable<Interner> + HasInterner<Interner = Interner>>(
|
||||
s: T,
|
||||
num_vars_to_keep: usize,
|
||||
) -> T::Result {
|
||||
) -> T {
|
||||
crate::fold_free_vars(
|
||||
s,
|
||||
|bound, binders| {
|
||||
|
Loading…
Reference in New Issue
Block a user