mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Chalk upgrade
This commit is contained in:
parent
5dcaf108c2
commit
050601ef7b
3 changed files with 53 additions and 34 deletions
24
Cargo.lock
generated
24
Cargo.lock
generated
|
@ -113,8 +113,8 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chalk-derive"
|
name = "chalk-derive"
|
||||||
version = "0.1.0"
|
version = "0.10.1-dev"
|
||||||
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
|
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -124,8 +124,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chalk-engine"
|
name = "chalk-engine"
|
||||||
version = "0.9.0"
|
version = "0.10.1-dev"
|
||||||
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
|
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chalk-macros",
|
"chalk-macros",
|
||||||
"rustc-hash",
|
"rustc-hash",
|
||||||
|
@ -133,8 +133,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chalk-ir"
|
name = "chalk-ir"
|
||||||
version = "0.1.0"
|
version = "0.10.1-dev"
|
||||||
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
|
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chalk-derive",
|
"chalk-derive",
|
||||||
"chalk-engine",
|
"chalk-engine",
|
||||||
|
@ -143,16 +143,16 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chalk-macros"
|
name = "chalk-macros"
|
||||||
version = "0.1.1"
|
version = "0.10.1-dev"
|
||||||
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
|
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chalk-rust-ir"
|
name = "chalk-rust-ir"
|
||||||
version = "0.1.0"
|
version = "0.10.1-dev"
|
||||||
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
|
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chalk-derive",
|
"chalk-derive",
|
||||||
"chalk-engine",
|
"chalk-engine",
|
||||||
|
@ -162,8 +162,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chalk-solve"
|
name = "chalk-solve"
|
||||||
version = "0.1.0"
|
version = "0.10.1-dev"
|
||||||
source = "git+https://github.com/rust-lang/chalk.git?rev=2c072cc830d04af5f10b390e6643327f85108282#2c072cc830d04af5f10b390e6643327f85108282"
|
source = "git+https://github.com/rust-lang/chalk.git?rev=3e9c2503ae9c5277c2acb74624dc267876dd89b3#3e9c2503ae9c5277c2acb74624dc267876dd89b3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chalk-derive",
|
"chalk-derive",
|
||||||
"chalk-engine",
|
"chalk-engine",
|
||||||
|
|
|
@ -27,9 +27,9 @@ test_utils = { path = "../test_utils" }
|
||||||
|
|
||||||
scoped-tls = "1"
|
scoped-tls = "1"
|
||||||
|
|
||||||
chalk-solve = { 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 = "2c072cc830d04af5f10b390e6643327f85108282" }
|
chalk-rust-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "3e9c2503ae9c5277c2acb74624dc267876dd89b3" }
|
||||||
chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "2c072cc830d04af5f10b390e6643327f85108282" }
|
chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "3e9c2503ae9c5277c2acb74624dc267876dd89b3" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
insta = "0.16.0"
|
insta = "0.16.0"
|
||||||
|
|
|
@ -182,7 +182,10 @@ impl chalk_ir::interner::Interner for Interner {
|
||||||
Arc::new(goal)
|
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()
|
data.into_iter().collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,10 +225,10 @@ impl chalk_ir::interner::Interner for Interner {
|
||||||
clause
|
clause
|
||||||
}
|
}
|
||||||
|
|
||||||
fn intern_program_clauses(
|
fn intern_program_clauses<E>(
|
||||||
&self,
|
&self,
|
||||||
data: impl IntoIterator<Item = chalk_ir::ProgramClause<Self>>,
|
data: impl IntoIterator<Item = Result<chalk_ir::ProgramClause<Self>, E>>,
|
||||||
) -> Arc<[chalk_ir::ProgramClause<Self>]> {
|
) -> Result<Arc<[chalk_ir::ProgramClause<Self>]>, E> {
|
||||||
data.into_iter().collect()
|
data.into_iter().collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,10 +239,10 @@ impl chalk_ir::interner::Interner for Interner {
|
||||||
&clauses
|
&clauses
|
||||||
}
|
}
|
||||||
|
|
||||||
fn intern_quantified_where_clauses(
|
fn intern_quantified_where_clauses<E>(
|
||||||
&self,
|
&self,
|
||||||
data: impl IntoIterator<Item = chalk_ir::QuantifiedWhereClause<Self>>,
|
data: impl IntoIterator<Item = Result<chalk_ir::QuantifiedWhereClause<Self>, E>>,
|
||||||
) -> Self::InternedQuantifiedWhereClauses {
|
) -> Result<Self::InternedQuantifiedWhereClauses, E> {
|
||||||
data.into_iter().collect()
|
data.into_iter().collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,10 +253,10 @@ impl chalk_ir::interner::Interner for Interner {
|
||||||
clauses
|
clauses
|
||||||
}
|
}
|
||||||
|
|
||||||
fn intern_parameter_kinds(
|
fn intern_parameter_kinds<E>(
|
||||||
&self,
|
&self,
|
||||||
data: impl IntoIterator<Item = chalk_ir::ParameterKind<()>>,
|
data: impl IntoIterator<Item = Result<chalk_ir::ParameterKind<()>, E>>,
|
||||||
) -> Self::InternedParameterKinds {
|
) -> Result<Self::InternedParameterKinds, E> {
|
||||||
data.into_iter().collect()
|
data.into_iter().collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,10 +267,10 @@ impl chalk_ir::interner::Interner for Interner {
|
||||||
¶meter_kinds
|
¶meter_kinds
|
||||||
}
|
}
|
||||||
|
|
||||||
fn intern_canonical_var_kinds(
|
fn intern_canonical_var_kinds<E>(
|
||||||
&self,
|
&self,
|
||||||
data: impl IntoIterator<Item = chalk_ir::ParameterKind<UniverseIndex>>,
|
data: impl IntoIterator<Item = Result<chalk_ir::ParameterKind<UniverseIndex>, E>>,
|
||||||
) -> Self::InternedCanonicalVarKinds {
|
) -> Result<Self::InternedCanonicalVarKinds, E> {
|
||||||
data.into_iter().collect()
|
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::Struct(struct_id) => db.lookup_intern_type_ctor(struct_id.into()),
|
||||||
TypeName::AssociatedType(type_id) => TypeCtor::AssociatedType(from_chalk(db, type_id)),
|
TypeName::AssociatedType(type_id) => TypeCtor::AssociatedType(from_chalk(db, type_id)),
|
||||||
TypeName::OpaqueType(_) => unreachable!(),
|
TypeName::OpaqueType(_) => unreachable!(),
|
||||||
|
|
||||||
|
TypeName::Scalar(_) => unreachable!(),
|
||||||
|
TypeName::Tuple(_) => unreachable!(),
|
||||||
|
TypeName::Raw(_) => unreachable!(),
|
||||||
|
TypeName::Slice => unreachable!(),
|
||||||
|
TypeName::Ref(_) => unreachable!(),
|
||||||
|
TypeName::Str => unreachable!(),
|
||||||
|
|
||||||
TypeName::Error => {
|
TypeName::Error => {
|
||||||
// this should not be reached, since we don't represent TypeName::Error with TypeCtor
|
// this should not be reached, since we don't represent TypeName::Error with TypeCtor
|
||||||
unreachable!()
|
unreachable!()
|
||||||
|
@ -862,12 +873,6 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
|
||||||
// We don't do coherence checking (yet)
|
// We don't do coherence checking (yet)
|
||||||
unimplemented!()
|
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 {
|
fn interner(&self) -> &Interner {
|
||||||
&Interner
|
&Interner
|
||||||
}
|
}
|
||||||
|
@ -892,6 +897,20 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
|
||||||
) -> Arc<chalk_rust_ir::OpaqueTyDatum<Interner>> {
|
) -> Arc<chalk_rust_ir::OpaqueTyDatum<Interner>> {
|
||||||
unimplemented!()
|
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(
|
pub(crate) fn program_clauses_for_chalk_env_query(
|
||||||
|
|
Loading…
Reference in a new issue