Chalk upgrade

This commit is contained in:
Florian Diebold 2020-05-16 10:49:43 +02:00
parent 5dcaf108c2
commit 050601ef7b
3 changed files with 53 additions and 34 deletions

24
Cargo.lock generated
View file

@ -113,8 +113,8 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
name = "chalk-derive"
version = "0.1.0"
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
version = "0.10.1-dev"
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
dependencies = [
"proc-macro2",
"quote",
@ -124,8 +124,8 @@ dependencies = [
[[package]]
name = "chalk-engine"
version = "0.9.0"
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
version = "0.10.1-dev"
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
dependencies = [
"chalk-macros",
"rustc-hash",
@ -133,8 +133,8 @@ dependencies = [
[[package]]
name = "chalk-ir"
version = "0.1.0"
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
version = "0.10.1-dev"
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
dependencies = [
"chalk-derive",
"chalk-engine",
@ -143,16 +143,16 @@ dependencies = [
[[package]]
name = "chalk-macros"
version = "0.1.1"
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
version = "0.10.1-dev"
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
dependencies = [
"lazy_static",
]
[[package]]
name = "chalk-rust-ir"
version = "0.1.0"
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
version = "0.10.1-dev"
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
dependencies = [
"chalk-derive",
"chalk-engine",
@ -162,8 +162,8 @@ dependencies = [
[[package]]
name = "chalk-solve"
version = "0.1.0"
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
version = "0.10.1-dev"
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
dependencies = [
"chalk-derive",
"chalk-engine",

View file

@ -27,9 +27,9 @@ test_utils = { path = "../test_utils" }
scoped-tls = "1"
chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "2c072cc830d04af5f10b390e6643327f85108282" }
chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "2c072cc830d04af5f10b390e6643327f85108282" }
chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "2c072cc830d04af5f10b390e6643327f85108282" }
chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "3e9c2503ae9c5277c2acb74624dc267876dd89b3" }
chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "3e9c2503ae9c5277c2acb74624dc267876dd89b3" }
chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "3e9c2503ae9c5277c2acb74624dc267876dd89b3" }
[dev-dependencies]
insta = "0.16.0"

View file

@ -182,7 +182,10 @@ impl chalk_ir::interner::Interner for Interner {
Arc::new(goal)
}
fn intern_goals(&self, data: impl IntoIterator<Item = Goal<Self>>) -> Self::InternedGoals {
fn intern_goals<E>(
&self,
data: impl IntoIterator<Item = Result<Goal<Self>, E>>,
) -> Result<Self::InternedGoals, E> {
data.into_iter().collect()
}
@ -222,10 +225,10 @@ impl chalk_ir::interner::Interner for Interner {
clause
}
fn intern_program_clauses(
fn intern_program_clauses<E>(
&self,
data: impl IntoIterator<Item = chalk_ir::ProgramClause<Self>>,
) -> Arc<[chalk_ir::ProgramClause<Self>]> {
data: impl IntoIterator<Item = Result<chalk_ir::ProgramClause<Self>, E>>,
) -> Result<Arc<[chalk_ir::ProgramClause<Self>]>, E> {
data.into_iter().collect()
}
@ -236,10 +239,10 @@ impl chalk_ir::interner::Interner for Interner {
&clauses
}
fn intern_quantified_where_clauses(
fn intern_quantified_where_clauses<E>(
&self,
data: impl IntoIterator<Item = chalk_ir::QuantifiedWhereClause<Self>>,
) -> Self::InternedQuantifiedWhereClauses {
data: impl IntoIterator<Item = Result<chalk_ir::QuantifiedWhereClause<Self>, E>>,
) -> Result<Self::InternedQuantifiedWhereClauses, E> {
data.into_iter().collect()
}
@ -250,10 +253,10 @@ impl chalk_ir::interner::Interner for Interner {
clauses
}
fn intern_parameter_kinds(
fn intern_parameter_kinds<E>(
&self,
data: impl IntoIterator<Item = chalk_ir::ParameterKind<()>>,
) -> Self::InternedParameterKinds {
data: impl IntoIterator<Item = Result<chalk_ir::ParameterKind<()>, E>>,
) -> Result<Self::InternedParameterKinds, E> {
data.into_iter().collect()
}
@ -264,10 +267,10 @@ impl chalk_ir::interner::Interner for Interner {
&parameter_kinds
}
fn intern_canonical_var_kinds(
fn intern_canonical_var_kinds<E>(
&self,
data: impl IntoIterator<Item = chalk_ir::ParameterKind<UniverseIndex>>,
) -> Self::InternedCanonicalVarKinds {
data: impl IntoIterator<Item = Result<chalk_ir::ParameterKind<UniverseIndex>, E>>,
) -> Result<Self::InternedCanonicalVarKinds, E> {
data.into_iter().collect()
}
@ -460,6 +463,14 @@ impl ToChalk for TypeCtor {
TypeName::Struct(struct_id) => db.lookup_intern_type_ctor(struct_id.into()),
TypeName::AssociatedType(type_id) => TypeCtor::AssociatedType(from_chalk(db, type_id)),
TypeName::OpaqueType(_) => unreachable!(),
TypeName::Scalar(_) => unreachable!(),
TypeName::Tuple(_) => unreachable!(),
TypeName::Raw(_) => unreachable!(),
TypeName::Slice => unreachable!(),
TypeName::Ref(_) => unreachable!(),
TypeName::Str => unreachable!(),
TypeName::Error => {
// this should not be reached, since we don't represent TypeName::Error with TypeCtor
unreachable!()
@ -862,12 +873,6 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
// We don't do coherence checking (yet)
unimplemented!()
}
fn as_struct_id(&self, id: &TypeName<Interner>) -> Option<StructId> {
match id {
TypeName::Struct(struct_id) => Some(*struct_id),
_ => None,
}
}
fn interner(&self) -> &Interner {
&Interner
}
@ -892,6 +897,20 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
) -> Arc<chalk_rust_ir::OpaqueTyDatum<Interner>> {
unimplemented!()
}
fn force_impl_for(
&self,
_well_known: chalk_rust_ir::WellKnownTrait,
_ty: &chalk_ir::TyData<Interner>,
) -> Option<bool> {
// this method is mostly for rustc
None
}
fn is_object_safe(&self, _trait_id: chalk_ir::TraitId<Interner>) -> bool {
// FIXME: implement actual object safety
true
}
}
pub(crate) fn program_clauses_for_chalk_env_query(