Skip to content

Commit

Permalink
Rollup merge of rust-lang#104378 - compiler-errors:chalk-up, r=jackh726
Browse files Browse the repository at this point in the history
Bump chalk to v0.87

1. Removes `ReEmpty` from chalk
2. Adds support for the `std::marker::Tuple` trait
  • Loading branch information
matthiaskrgr authored Nov 14, 2022
2 parents dc869fc + 36a1068 commit c389097
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 125 deletions.
16 changes: 8 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -502,9 +502,9 @@ dependencies = [

[[package]]
name = "chalk-derive"
version = "0.80.0"
version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0001adf0cf12361e08b65e1898ea138f8f77d8f5177cbf29b6b3b3532252bd6"
checksum = "d552b2fa341f5fc35c6b917b1d289d3c3a34d0b74e579390ea6192d6152a8cdb"
dependencies = [
"proc-macro2",
"quote",
Expand All @@ -514,9 +514,9 @@ dependencies = [

[[package]]
name = "chalk-engine"
version = "0.80.0"
version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c44ee96f2d67cb5193d1503f185db1abad9933a1c6e6b4169c176f90baecd393"
checksum = "7e54ac43048cb31c470d7b3e3acd409090ef4a5abddfe02455187aebc3d6879f"
dependencies = [
"chalk-derive",
"chalk-ir",
Expand All @@ -527,9 +527,9 @@ dependencies = [

[[package]]
name = "chalk-ir"
version = "0.80.0"
version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92d8a95548f23618fda86426e4304e563ec2bb7ba0216139f0748d63c107b5f1"
checksum = "43aa55deff4e7fbdb09fa014543372f2c95a06835ac487b9ce57b5099b950838"
dependencies = [
"bitflags",
"chalk-derive",
Expand All @@ -538,9 +538,9 @@ dependencies = [

[[package]]
name = "chalk-solve"
version = "0.80.0"
version = "0.87.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f37f492dacfafe2e21319b80827da2779932909bb392f0cc86b2bd5c07c1b4e1"
checksum = "61213deefc36ba265ad01c4d997e18bcddf7922862a4594a47ca4575afb3dab4"
dependencies = [
"chalk-derive",
"chalk-ir",
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ doctest = false

[dependencies]
bitflags = "1.2.1"
chalk-ir = "0.80.0"
chalk-ir = "0.87.0"
either = "1.5.0"
gsgdt = "0.1.2"
polonius-engine = "0.13.0"
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.80.0"
chalk-engine = "0.80.0"
chalk-solve = "0.80.0"
chalk-ir = "0.87.0"
chalk-engine = "0.87.0"
chalk-solve = "0.87.0"
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
rustc_infer = { path = "../rustc_infer" }
rustc_trait_selection = { path = "../rustc_trait_selection" }
3 changes: 3 additions & 0 deletions compiler/rustc_traits/src/chalk/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
Some(CoerceUnsized)
} else if lang_items.dispatch_from_dyn_trait() == Some(def_id) {
Some(DispatchFromDyn)
} else if lang_items.tuple_trait() == Some(def_id) {
Some(Tuple)
} else {
None
};
Expand Down Expand Up @@ -570,6 +572,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
CoerceUnsized => lang_items.coerce_unsized_trait(),
DiscriminantKind => lang_items.discriminant_kind_trait(),
DispatchFromDyn => lang_items.dispatch_from_dyn_trait(),
Tuple => lang_items.tuple_trait(),
};
def_id.map(chalk_ir::TraitId)
}
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_traits/src/chalk/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,6 @@ impl<'tcx> LowerInto<'tcx, Region<'tcx>> for &chalk_ir::Lifetime<RustInterner<'t
name: ty::BoundRegionKind::BrAnon(p.idx as u32, None),
}),
chalk_ir::LifetimeData::Static => return interner.tcx.lifetimes.re_static,
chalk_ir::LifetimeData::Empty(_) => {
bug!("Chalk should not have been passed an empty lifetime.")
}
chalk_ir::LifetimeData::Erased => return interner.tcx.lifetimes.re_erased,
chalk_ir::LifetimeData::Phantom(void, _) => match *void {},
};
Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/chalkify/closure.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// known-bug: unknown
// FIXME(chalk): Chalk needs support for the Tuple trait
// compile-flags: -Z chalk

fn main() -> () {
Expand All @@ -26,7 +24,7 @@ fn main() -> () {
let mut c = b;

c();
b(); // FIXME: reenable when this is fixed ~ ERROR
b(); //~ ERROR

// FIXME(chalk): this doesn't quite work
/*
Expand Down
88 changes: 15 additions & 73 deletions src/test/ui/chalkify/closure.stderr
Original file line number Diff line number Diff line change
@@ -1,80 +1,22 @@
error[E0277]: `()` is not a tuple
--> $DIR/closure.rs:7:5
|
LL | t();
| ^^^ the trait `Tuple` is not implemented for `()`
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | fn main() -> () where (): Tuple {
| +++++++++++++++

error[E0277]: `()` is not a tuple
--> $DIR/closure.rs:13:5
|
LL | b();
| ^^^ the trait `Tuple` is not implemented for `()`
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | fn main() -> () where (): Tuple {
| +++++++++++++++

error[E0277]: `()` is not a tuple
--> $DIR/closure.rs:17:5
|
LL | c();
| ^^^ the trait `Tuple` is not implemented for `()`
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | fn main() -> () where (): Tuple {
| +++++++++++++++

error[E0277]: `()` is not a tuple
--> $DIR/closure.rs:18:5
error[E0382]: borrow of moved value: `b`
--> $DIR/closure.rs:27:5
|
LL | let mut c = b;
| - value moved here
...
LL | b();
| ^^^ the trait `Tuple` is not implemented for `()`
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | fn main() -> () where (): Tuple {
| +++++++++++++++

error[E0277]: `()` is not a tuple
--> $DIR/closure.rs:24:5
|
LL | b();
| ^^^ the trait `Tuple` is not implemented for `()`
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | fn main() -> () where (): Tuple {
| +++++++++++++++

error[E0277]: `()` is not a tuple
--> $DIR/closure.rs:28:5
|
LL | c();
| ^^^ the trait `Tuple` is not implemented for `()`
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
|
LL | fn main() -> () where (): Tuple {
| +++++++++++++++

error[E0277]: `()` is not a tuple
--> $DIR/closure.rs:29:5
| ^ value borrowed here after move
|
LL | b(); // FIXME: reenable when this is fixed ~ ERROR
| ^^^ the trait `Tuple` is not implemented for `()`
note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment
--> $DIR/closure.rs:20:9
|
help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
LL | a = 1;
| ^
help: consider mutably borrowing `b`
|
LL | fn main() -> () where (): Tuple {
| +++++++++++++++
LL | let mut c = &mut b;
| ++++

error: aborting due to 7 previous errors
error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
For more information about this error, try `rustc --explain E0382`.
3 changes: 1 addition & 2 deletions src/test/ui/chalkify/trait-objects.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// known-bug: unknown
// FIXME(chalk): Chalk needs support for the Tuple trait
// check-pass
// compile-flags: -Z chalk

use std::fmt::Display;
Expand Down
32 changes: 0 additions & 32 deletions src/test/ui/chalkify/trait-objects.stderr

This file was deleted.

0 comments on commit c389097

Please sign in to comment.