Auto merge of #95233 - compiler-errors:chalk-up, r=jackh726
Upgrade chalk to `0.80.0` r? `@jackh726`
This commit is contained in:
commit
600a80dedf
4 changed files with 49 additions and 22 deletions
16
Cargo.lock
16
Cargo.lock
|
@ -515,9 +515,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||
|
||||
[[package]]
|
||||
name = "chalk-derive"
|
||||
version = "0.76.0"
|
||||
version = "0.80.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "58c24b8052ea1e3adbb6f9ab7ba5fcc18b9d12591c042de4c833f709ce81e0e0"
|
||||
checksum = "d0001adf0cf12361e08b65e1898ea138f8f77d8f5177cbf29b6b3b3532252bd6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -527,9 +527,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "chalk-engine"
|
||||
version = "0.76.0"
|
||||
version = "0.80.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eca186b6ea9af798312f4b568fd094c82e7946ac08be5dc5fea22decc6d2ed8"
|
||||
checksum = "c44ee96f2d67cb5193d1503f185db1abad9933a1c6e6b4169c176f90baecd393"
|
||||
dependencies = [
|
||||
"chalk-derive",
|
||||
"chalk-ir",
|
||||
|
@ -540,9 +540,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "chalk-ir"
|
||||
version = "0.76.0"
|
||||
version = "0.80.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3cad5c3f1edd4b4a2c9bda24ae558ceb4f88336f88f944c2e35d0bfeb13c818"
|
||||
checksum = "92d8a95548f23618fda86426e4304e563ec2bb7ba0216139f0748d63c107b5f1"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"chalk-derive",
|
||||
|
@ -551,9 +551,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "chalk-solve"
|
||||
version = "0.76.0"
|
||||
version = "0.80.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94533188d3452bc72cbd5618d166f45fc7646b674ad3fe9667d557bc25236dee"
|
||||
checksum = "f37f492dacfafe2e21319b80827da2779932909bb392f0cc86b2bd5c07c1b4e1"
|
||||
dependencies = [
|
||||
"chalk-derive",
|
||||
"chalk-ir",
|
||||
|
|
|
@ -29,7 +29,7 @@ rustc_index = { path = "../rustc_index" }
|
|||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
chalk-ir = "0.76.0"
|
||||
chalk-ir = "0.80.0"
|
||||
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
|
||||
rustc_session = { path = "../rustc_session" }
|
||||
rustc_type_ir = { path = "../rustc_type_ir" }
|
||||
|
|
|
@ -12,9 +12,9 @@ rustc_hir = { path = "../rustc_hir" }
|
|||
rustc_index = { path = "../rustc_index" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_span = { path = "../rustc_span" }
|
||||
chalk-ir = "0.76.0"
|
||||
chalk-engine = "0.76.0"
|
||||
chalk-solve = "0.76.0"
|
||||
chalk-ir = "0.80.0"
|
||||
chalk-engine = "0.80.0"
|
||||
chalk-solve = "0.80.0"
|
||||
smallvec = { version = "1.6.1", features = ["union", "may_dangle"] }
|
||||
rustc_infer = { path = "../rustc_infer" }
|
||||
rustc_trait_selection = { path = "../rustc_trait_selection" }
|
||||
|
|
|
@ -100,6 +100,8 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
|
|||
&self,
|
||||
trait_id: chalk_ir::TraitId<RustInterner<'tcx>>,
|
||||
) -> Arc<chalk_solve::rust_ir::TraitDatum<RustInterner<'tcx>>> {
|
||||
use chalk_solve::rust_ir::WellKnownTrait::*;
|
||||
|
||||
let def_id = trait_id.0;
|
||||
let trait_def = self.interner.tcx.trait_def(def_id);
|
||||
|
||||
|
@ -119,25 +121,27 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
|
|||
|
||||
let lang_items = self.interner.tcx.lang_items();
|
||||
let well_known = if lang_items.sized_trait() == Some(def_id) {
|
||||
Some(chalk_solve::rust_ir::WellKnownTrait::Sized)
|
||||
Some(Sized)
|
||||
} else if lang_items.copy_trait() == Some(def_id) {
|
||||
Some(chalk_solve::rust_ir::WellKnownTrait::Copy)
|
||||
Some(Copy)
|
||||
} else if lang_items.clone_trait() == Some(def_id) {
|
||||
Some(chalk_solve::rust_ir::WellKnownTrait::Clone)
|
||||
Some(Clone)
|
||||
} else if lang_items.drop_trait() == Some(def_id) {
|
||||
Some(chalk_solve::rust_ir::WellKnownTrait::Drop)
|
||||
Some(Drop)
|
||||
} else if lang_items.fn_trait() == Some(def_id) {
|
||||
Some(chalk_solve::rust_ir::WellKnownTrait::Fn)
|
||||
Some(Fn)
|
||||
} else if lang_items.fn_once_trait() == Some(def_id) {
|
||||
Some(chalk_solve::rust_ir::WellKnownTrait::FnOnce)
|
||||
Some(FnOnce)
|
||||
} else if lang_items.fn_mut_trait() == Some(def_id) {
|
||||
Some(chalk_solve::rust_ir::WellKnownTrait::FnMut)
|
||||
Some(FnMut)
|
||||
} else if lang_items.unsize_trait() == Some(def_id) {
|
||||
Some(chalk_solve::rust_ir::WellKnownTrait::Unsize)
|
||||
Some(Unsize)
|
||||
} else if lang_items.unpin_trait() == Some(def_id) {
|
||||
Some(chalk_solve::rust_ir::WellKnownTrait::Unpin)
|
||||
Some(Unpin)
|
||||
} else if lang_items.coerce_unsized_trait() == Some(def_id) {
|
||||
Some(chalk_solve::rust_ir::WellKnownTrait::CoerceUnsized)
|
||||
Some(CoerceUnsized)
|
||||
} else if lang_items.dispatch_from_dyn_trait() == Some(def_id) {
|
||||
Some(DispatchFromDyn)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -232,6 +236,28 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
|
|||
})
|
||||
}
|
||||
|
||||
fn adt_size_align(
|
||||
&self,
|
||||
adt_id: chalk_ir::AdtId<RustInterner<'tcx>>,
|
||||
) -> Arc<chalk_solve::rust_ir::AdtSizeAlign> {
|
||||
let tcx = self.interner.tcx;
|
||||
let did = adt_id.0.did();
|
||||
|
||||
// Grab the ADT and the param we might need to calculate its layout
|
||||
let param_env = tcx.param_env(did);
|
||||
let adt_ty = tcx.type_of(did);
|
||||
|
||||
// The ADT is a 1-zst if it's a ZST and its alignment is 1.
|
||||
// Mark the ADT as _not_ a 1-zst if there was a layout error.
|
||||
let one_zst = if let Ok(layout) = tcx.layout_of(param_env.and(adt_ty)) {
|
||||
layout.is_zst() && layout.align.abi.bytes() == 1
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
Arc::new(chalk_solve::rust_ir::AdtSizeAlign::from_one_zst(one_zst))
|
||||
}
|
||||
|
||||
fn fn_def_datum(
|
||||
&self,
|
||||
fn_def_id: chalk_ir::FnDefId<RustInterner<'tcx>>,
|
||||
|
@ -540,6 +566,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
|
|||
Unpin => lang_items.unpin_trait(),
|
||||
CoerceUnsized => lang_items.coerce_unsized_trait(),
|
||||
DiscriminantKind => lang_items.discriminant_kind_trait(),
|
||||
DispatchFromDyn => lang_items.dispatch_from_dyn_trait(),
|
||||
};
|
||||
def_id.map(chalk_ir::TraitId)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue