Skip to content

Commit 1755e3b

Browse files
authored
Rollup merge of #73681 - jackh726:chalk-0.14, r=nikomatsakis
Update Chalk to 0.14 Not a ton here. Notable changes: - Update to `0.14.0` - New dependency on `tracing`, in `librustc_traits` only - `FnAbi` from Chalk is `rustc_target::spec::abi::Abi` - `Dynamic` actually lowers region - Actually lower closures, with some tests. This doesn't 100% work, but can't confirm that's *only* because of closure lowering. - Use `FxIndexSet` instead of `FxHashSet` in `chalk_fulfill`, which seems to have fixed the non-deterministic test error ordering. Guess we'll see on CI - Actually implement `opaque_ty_data`, though I don't think this is sufficient for tests for them (I haven't added any) - Uncomment some of the chalk tests that now work r? @nikomatsakis
2 parents 3d7521d + ecb8b9f commit 1755e3b

File tree

15 files changed

+311
-107
lines changed

15 files changed

+311
-107
lines changed

Cargo.lock

+41-8
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,9 @@ dependencies = [
434434

435435
[[package]]
436436
name = "chalk-derive"
437-
version = "0.11.0"
437+
version = "0.14.0"
438438
source = "registry+https://github.com/rust-lang/crates.io-index"
439-
checksum = "5b9bd01eab87277d973183a1d2e56bace1c11f8242c52c20636fb7dddf343ac9"
439+
checksum = "d463e01905d607e181de72e8608721d3269f29176c9a14ce037011316ae7131d"
440440
dependencies = [
441441
"proc-macro2 1.0.3",
442442
"quote 1.0.2",
@@ -446,30 +446,31 @@ dependencies = [
446446

447447
[[package]]
448448
name = "chalk-engine"
449-
version = "0.11.0"
449+
version = "0.14.0"
450450
source = "registry+https://github.com/rust-lang/crates.io-index"
451-
checksum = "6c7a637c3d17ed555aef16e16952a5d1e127bd55178cc30be22afeb92da90c7d"
451+
checksum = "efaf428f5398d36284f79690cf988762b7c091249f50a6c11db613a46c057000"
452452
dependencies = [
453453
"chalk-derive",
454454
"chalk-ir",
455455
"rustc-hash",
456+
"tracing",
456457
]
457458

458459
[[package]]
459460
name = "chalk-ir"
460-
version = "0.11.0"
461+
version = "0.14.0"
461462
source = "registry+https://github.com/rust-lang/crates.io-index"
462-
checksum = "595e5735ded16c3f3dc348f7b15bbb2521a0080b1863cac38ad5271589944670"
463+
checksum = "fd3fdc1e9f68498ffe80f4a23b0b95f1ca6fb21d5a4c9b0c085fab3ca712bdbe"
463464
dependencies = [
464465
"chalk-derive",
465466
"lazy_static",
466467
]
467468

468469
[[package]]
469470
name = "chalk-solve"
470-
version = "0.11.0"
471+
version = "0.14.0"
471472
source = "registry+https://github.com/rust-lang/crates.io-index"
472-
checksum = "5d9d938139db425867a30cc0cfec0269406d8238d0571d829041eaa7a8455d11"
473+
checksum = "5b9fd4102807b7ebe8fb034fa0f488c5656e1966d3261b558b81a08d519cdb29"
473474
dependencies = [
474475
"chalk-derive",
475476
"chalk-engine",
@@ -478,6 +479,7 @@ dependencies = [
478479
"itertools 0.9.0",
479480
"petgraph",
480481
"rustc-hash",
482+
"tracing",
481483
]
482484

483485
[[package]]
@@ -5332,6 +5334,37 @@ dependencies = [
53325334
"syn 0.15.35",
53335335
]
53345336

5337+
[[package]]
5338+
name = "tracing"
5339+
version = "0.1.15"
5340+
source = "registry+https://github.com/rust-lang/crates.io-index"
5341+
checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f"
5342+
dependencies = [
5343+
"cfg-if",
5344+
"tracing-attributes",
5345+
"tracing-core",
5346+
]
5347+
5348+
[[package]]
5349+
name = "tracing-attributes"
5350+
version = "0.1.8"
5351+
source = "registry+https://github.com/rust-lang/crates.io-index"
5352+
checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c"
5353+
dependencies = [
5354+
"proc-macro2 1.0.3",
5355+
"quote 1.0.2",
5356+
"syn 1.0.11",
5357+
]
5358+
5359+
[[package]]
5360+
name = "tracing-core"
5361+
version = "0.1.10"
5362+
source = "registry+https://github.com/rust-lang/crates.io-index"
5363+
checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715"
5364+
dependencies = [
5365+
"lazy_static",
5366+
]
5367+
53355368
[[package]]
53365369
name = "try-lock"
53375370
version = "0.2.2"

src/librustc_middle/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ rustc_serialize = { path = "../librustc_serialize" }
3030
rustc_ast = { path = "../librustc_ast" }
3131
rustc_span = { path = "../librustc_span" }
3232
byteorder = { version = "1.3" }
33-
chalk-ir = "0.11.0"
33+
chalk-ir = "0.14.0"
3434
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
3535
measureme = "0.7.1"
3636
rustc_session = { path = "../librustc_session" }

src/librustc_middle/traits/chalk.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
1010
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt};
1111

1212
use rustc_hir::def_id::DefId;
13+
use rustc_target::spec::abi::Abi;
1314

1415
use smallvec::SmallVec;
1516

@@ -77,6 +78,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
7778
type DefId = DefId;
7879
type InternedAdtId = &'tcx AdtDef;
7980
type Identifier = ();
81+
type FnAbi = Abi;
8082

8183
fn debug_program_clause_implication(
8284
pci: &chalk_ir::ProgramClauseImplication<Self>,

src/librustc_trait_selection/traits/chalk_fulfill.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ use crate::traits::{
77
ChalkEnvironmentAndGoal, ChalkEnvironmentClause, FulfillmentError, FulfillmentErrorCode,
88
ObligationCause, PredicateObligation, SelectionError, TraitEngine,
99
};
10-
use rustc_data_structures::fx::FxHashSet;
10+
use rustc_data_structures::fx::FxIndexSet;
1111
use rustc_hir::def_id::DefId;
1212
use rustc_middle::ty::{self, Ty, TyCtxt};
1313

1414
pub struct FulfillmentContext<'tcx> {
15-
obligations: FxHashSet<PredicateObligation<'tcx>>,
15+
obligations: FxIndexSet<PredicateObligation<'tcx>>,
1616
}
1717

1818
impl FulfillmentContext<'tcx> {
1919
crate fn new() -> Self {
20-
FulfillmentContext { obligations: FxHashSet::default() }
20+
FulfillmentContext { obligations: FxIndexSet::default() }
2121
}
2222
}
2323

@@ -79,7 +79,7 @@ fn environment<'tcx>(
7979
};
8080

8181
// FIXME(eddyb) isn't the unordered nature of this a hazard?
82-
let mut inputs = FxHashSet::default();
82+
let mut inputs = FxIndexSet::default();
8383

8484
match node_kind {
8585
// In a trait impl, we assume that the header trait ref and all its
@@ -140,7 +140,8 @@ fn in_environment(
140140
None if obligation.param_env.caller_bounds.is_empty() => ty::List::empty(),
141141
// FIXME(chalk): this is hit in ui/where-clauses/where-clause-constraints-are-local-for-trait-impl
142142
// and ui/generics/generic-static-methods
143-
_ => bug!("non-empty `ParamEnv` with no def-id"),
143+
//_ => bug!("non-empty `ParamEnv` with no def-id"),
144+
_ => ty::List::empty(),
144145
};
145146

146147
ChalkEnvironmentAndGoal { environment, goal: obligation.predicate }
@@ -195,15 +196,15 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
195196
infcx: &InferCtxt<'_, 'tcx>,
196197
) -> Result<(), Vec<FulfillmentError<'tcx>>> {
197198
let mut errors = Vec::new();
198-
let mut next_round = FxHashSet::default();
199+
let mut next_round = FxIndexSet::default();
199200
let mut making_progress;
200201

201202
loop {
202203
making_progress = false;
203204

204205
// We iterate over all obligations, and record if we are able
205206
// to unambiguously prove at least one obligation.
206-
for obligation in self.obligations.drain() {
207+
for obligation in self.obligations.drain(..) {
207208
let goal_in_environment = in_environment(infcx, &obligation);
208209
let mut orig_values = OriginalQueryValues::default();
209210
let canonical_goal =

src/librustc_traits/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ rustc_hir = { path = "../librustc_hir" }
1616
rustc_index = { path = "../librustc_index" }
1717
rustc_ast = { path = "../librustc_ast" }
1818
rustc_span = { path = "../librustc_span" }
19-
chalk-ir = "0.11.0"
20-
chalk-solve = "0.11.0"
19+
chalk-ir = "0.14.0"
20+
chalk-solve = "0.14.0"
2121
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
2222
rustc_infer = { path = "../librustc_infer" }
2323
rustc_trait_selection = { path = "../librustc_trait_selection" }

0 commit comments

Comments
 (0)