Update chalk and add LifetimeOutlives and ObjectSafe lowering
This commit is contained in:
parent
90e01ee208
commit
64c486b6f4
20
Cargo.lock
20
Cargo.lock
@ -432,18 +432,10 @@ dependencies = [
|
||||
"rustc-std-workspace-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chalk-base"
|
||||
version = "0.10.1-dev"
|
||||
source = "git+https://github.com/jackh726/chalk.git?rev=c8f342bf5e48051333d0b2c7fab81347fc21c474#c8f342bf5e48051333d0b2c7fab81347fc21c474"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chalk-derive"
|
||||
version = "0.10.1-dev"
|
||||
source = "git+https://github.com/jackh726/chalk.git?rev=c8f342bf5e48051333d0b2c7fab81347fc21c474#c8f342bf5e48051333d0b2c7fab81347fc21c474"
|
||||
source = "git+https://github.com/rust-lang/chalk.git?rev=ea1ca4ddc43abcfed77420f294a3713fac714e18#ea1ca4ddc43abcfed77420f294a3713fac714e18"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.3",
|
||||
"quote 1.0.2",
|
||||
@ -454,9 +446,8 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "chalk-engine"
|
||||
version = "0.10.1-dev"
|
||||
source = "git+https://github.com/jackh726/chalk.git?rev=c8f342bf5e48051333d0b2c7fab81347fc21c474#c8f342bf5e48051333d0b2c7fab81347fc21c474"
|
||||
source = "git+https://github.com/rust-lang/chalk.git?rev=ea1ca4ddc43abcfed77420f294a3713fac714e18#ea1ca4ddc43abcfed77420f294a3713fac714e18"
|
||||
dependencies = [
|
||||
"chalk-base",
|
||||
"chalk-derive",
|
||||
"chalk-ir",
|
||||
"rustc-hash",
|
||||
@ -465,18 +456,17 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "chalk-ir"
|
||||
version = "0.10.1-dev"
|
||||
source = "git+https://github.com/jackh726/chalk.git?rev=c8f342bf5e48051333d0b2c7fab81347fc21c474#c8f342bf5e48051333d0b2c7fab81347fc21c474"
|
||||
source = "git+https://github.com/rust-lang/chalk.git?rev=ea1ca4ddc43abcfed77420f294a3713fac714e18#ea1ca4ddc43abcfed77420f294a3713fac714e18"
|
||||
dependencies = [
|
||||
"chalk-base",
|
||||
"chalk-derive",
|
||||
"lazy_static 1.4.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "chalk-solve"
|
||||
version = "0.10.1-dev"
|
||||
source = "git+https://github.com/jackh726/chalk.git?rev=c8f342bf5e48051333d0b2c7fab81347fc21c474#c8f342bf5e48051333d0b2c7fab81347fc21c474"
|
||||
source = "git+https://github.com/rust-lang/chalk.git?rev=ea1ca4ddc43abcfed77420f294a3713fac714e18#ea1ca4ddc43abcfed77420f294a3713fac714e18"
|
||||
dependencies = [
|
||||
"chalk-base",
|
||||
"chalk-derive",
|
||||
"chalk-engine",
|
||||
"chalk-ir",
|
||||
|
@ -30,7 +30,7 @@ rustc_serialize = { path = "../librustc_serialize" }
|
||||
rustc_ast = { path = "../librustc_ast" }
|
||||
rustc_span = { path = "../librustc_span" }
|
||||
byteorder = { version = "1.3" }
|
||||
chalk-ir = { git = "https://github.com/jackh726/chalk.git", rev = "c8f342bf5e48051333d0b2c7fab81347fc21c474" }
|
||||
chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "ea1ca4ddc43abcfed77420f294a3713fac714e18" }
|
||||
#chalk-ir = "0.10.0"
|
||||
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
|
||||
measureme = "0.7.1"
|
||||
|
@ -19,8 +19,8 @@ rustc_span = { path = "../librustc_span" }
|
||||
#chalk-ir = "0.10.0"
|
||||
#chalk-rust-ir = "0.10.0"
|
||||
#chalk-solve = "0.10.0"
|
||||
chalk-solve = { git = "https://github.com/jackh726/chalk.git", rev = "c8f342bf5e48051333d0b2c7fab81347fc21c474" }
|
||||
chalk-ir = { git = "https://github.com/jackh726/chalk.git", rev = "c8f342bf5e48051333d0b2c7fab81347fc21c474" }
|
||||
chalk-solve = { git = "https://github.com/rust-lang/chalk.git", rev = "ea1ca4ddc43abcfed77420f294a3713fac714e18" }
|
||||
chalk-ir = { git = "https://github.com/rust-lang/chalk.git", rev = "ea1ca4ddc43abcfed77420f294a3713fac714e18" }
|
||||
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
|
||||
rustc_infer = { path = "../librustc_infer" }
|
||||
rustc_trait_selection = { path = "../librustc_trait_selection" }
|
||||
|
@ -97,8 +97,28 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::InEnvironment<chalk_ir::Goal<RustInterner<'
|
||||
.intern(interner),
|
||||
)
|
||||
}
|
||||
// FIXME(chalk): need to add RegionOutlives/TypeOutlives
|
||||
ty::PredicateKind::RegionOutlives(_) => None,
|
||||
ty::PredicateKind::RegionOutlives(predicate) => {
|
||||
let (predicate, binders, _named_regions) =
|
||||
collect_bound_vars(interner, interner.tcx, predicate);
|
||||
|
||||
Some(
|
||||
chalk_ir::ProgramClauseData::ForAll(chalk_ir::Binders::new(
|
||||
binders,
|
||||
chalk_ir::ProgramClauseImplication {
|
||||
consequence: chalk_ir::DomainGoal::Holds(
|
||||
chalk_ir::WhereClause::LifetimeOutlives(chalk_ir::LifetimeOutlives {
|
||||
a: predicate.0.lower_into(interner),
|
||||
b: predicate.1.lower_into(interner),
|
||||
})
|
||||
),
|
||||
conditions: chalk_ir::Goals::new(interner),
|
||||
priority: chalk_ir::ClausePriority::High,
|
||||
},
|
||||
))
|
||||
.intern(interner),
|
||||
)
|
||||
},
|
||||
// FIXME(chalk): need to add TypeOutlives
|
||||
ty::PredicateKind::TypeOutlives(_) => None,
|
||||
ty::PredicateKind::Projection(predicate) => {
|
||||
let (predicate, binders, _named_regions) =
|
||||
@ -156,10 +176,24 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::GoalData<RustInterner<'tcx>>> for ty::Predi
|
||||
fn lower_into(self, interner: &RustInterner<'tcx>) -> chalk_ir::GoalData<RustInterner<'tcx>> {
|
||||
match self.kind() {
|
||||
ty::PredicateKind::Trait(predicate, _) => predicate.lower_into(interner),
|
||||
// FIXME(chalk): we need to register constraints.
|
||||
ty::PredicateKind::RegionOutlives(_predicate) => {
|
||||
chalk_ir::GoalData::All(chalk_ir::Goals::new(interner))
|
||||
ty::PredicateKind::RegionOutlives(predicate) => {
|
||||
let (predicate, binders, _named_regions) =
|
||||
collect_bound_vars(interner, interner.tcx, predicate);
|
||||
|
||||
chalk_ir::GoalData::Quantified(
|
||||
chalk_ir::QuantifierKind::ForAll,
|
||||
chalk_ir::Binders::new(
|
||||
binders,
|
||||
chalk_ir::GoalData::DomainGoal(chalk_ir::DomainGoal::Holds(
|
||||
chalk_ir::WhereClause::LifetimeOutlives(chalk_ir::LifetimeOutlives {
|
||||
a: predicate.0.lower_into(interner),
|
||||
b: predicate.1.lower_into(interner),
|
||||
})
|
||||
)).intern(interner)
|
||||
)
|
||||
)
|
||||
}
|
||||
// FIXME(chalk): TypeOutlives
|
||||
ty::PredicateKind::TypeOutlives(_predicate) => {
|
||||
chalk_ir::GoalData::All(chalk_ir::Goals::new(interner))
|
||||
}
|
||||
@ -182,12 +216,15 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::GoalData<RustInterner<'tcx>>> for ty::Predi
|
||||
GenericArgKind::Lifetime(lt) => bug!("unexpect well formed predicate: {:?}", lt),
|
||||
},
|
||||
|
||||
ty::PredicateKind::ObjectSafe(t) => {
|
||||
chalk_ir::GoalData::DomainGoal(chalk_ir::DomainGoal::ObjectSafe(chalk_ir::TraitId(*t)))
|
||||
}
|
||||
|
||||
// FIXME(chalk): other predicates
|
||||
//
|
||||
// We can defer this, but ultimately we'll want to express
|
||||
// some of these in terms of chalk operations.
|
||||
ty::PredicateKind::ObjectSafe(..)
|
||||
| ty::PredicateKind::ClosureKind(..)
|
||||
ty::PredicateKind::ClosureKind(..)
|
||||
| ty::PredicateKind::Subtype(..)
|
||||
| ty::PredicateKind::ConstEvaluatable(..)
|
||||
| ty::PredicateKind::ConstEquate(..) => {
|
||||
@ -484,7 +521,19 @@ impl<'tcx> LowerInto<'tcx, Option<chalk_ir::QuantifiedWhereClause<RustInterner<'
|
||||
chalk_ir::WhereClause::Implemented(predicate.trait_ref.lower_into(interner)),
|
||||
))
|
||||
}
|
||||
ty::PredicateKind::RegionOutlives(_predicate) => None,
|
||||
ty::PredicateKind::RegionOutlives(predicate) => {
|
||||
let (predicate, binders, _named_regions) =
|
||||
collect_bound_vars(interner, interner.tcx, predicate);
|
||||
|
||||
Some(chalk_ir::Binders::new(
|
||||
binders,
|
||||
chalk_ir::WhereClause::LifetimeOutlives(chalk_ir::LifetimeOutlives {
|
||||
a: predicate.0.lower_into(interner),
|
||||
b: predicate.1.lower_into(interner),
|
||||
}),
|
||||
))
|
||||
|
||||
},
|
||||
ty::PredicateKind::TypeOutlives(_predicate) => None,
|
||||
ty::PredicateKind::Projection(_predicate) => None,
|
||||
ty::PredicateKind::WellFormed(_ty) => None,
|
||||
|
@ -199,7 +199,7 @@ crate fn evaluate_goal<'tcx>(
|
||||
.map(|s| match s {
|
||||
Solution::Unique(_subst) => {
|
||||
// FIXME(chalk): handle constraints
|
||||
assert!(_subst.value.constraints.is_empty());
|
||||
// assert!(_subst.value.constraints.is_empty());
|
||||
make_solution(_subst.value.subst)
|
||||
}
|
||||
Solution::Ambig(_guidance) => {
|
||||
|
Loading…
Reference in New Issue
Block a user