Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Chalk to 0.14 #73681

Merged
merged 1 commit into from
Jun 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 41 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,9 @@ dependencies = [

[[package]]
name = "chalk-derive"
version = "0.11.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b9bd01eab87277d973183a1d2e56bace1c11f8242c52c20636fb7dddf343ac9"
checksum = "d463e01905d607e181de72e8608721d3269f29176c9a14ce037011316ae7131d"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
Expand All @@ -446,30 +446,31 @@ dependencies = [

[[package]]
name = "chalk-engine"
version = "0.11.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c7a637c3d17ed555aef16e16952a5d1e127bd55178cc30be22afeb92da90c7d"
checksum = "efaf428f5398d36284f79690cf988762b7c091249f50a6c11db613a46c057000"
dependencies = [
"chalk-derive",
"chalk-ir",
"rustc-hash",
"tracing",
]

[[package]]
name = "chalk-ir"
version = "0.11.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "595e5735ded16c3f3dc348f7b15bbb2521a0080b1863cac38ad5271589944670"
checksum = "fd3fdc1e9f68498ffe80f4a23b0b95f1ca6fb21d5a4c9b0c085fab3ca712bdbe"
dependencies = [
"chalk-derive",
"lazy_static",
]

[[package]]
name = "chalk-solve"
version = "0.11.0"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d9d938139db425867a30cc0cfec0269406d8238d0571d829041eaa7a8455d11"
checksum = "5b9fd4102807b7ebe8fb034fa0f488c5656e1966d3261b558b81a08d519cdb29"
dependencies = [
"chalk-derive",
"chalk-engine",
Expand All @@ -478,6 +479,7 @@ dependencies = [
"itertools 0.9.0",
"petgraph",
"rustc-hash",
"tracing",
]

[[package]]
Expand Down Expand Up @@ -5332,6 +5334,37 @@ dependencies = [
"syn 0.15.35",
]

[[package]]
name = "tracing"
version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a41f40ed0e162c911ac6fcb53ecdc8134c46905fdbbae8c50add462a538b495f"
dependencies = [
"cfg-if",
"tracing-attributes",
"tracing-core",
]

[[package]]
name = "tracing-attributes"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99bbad0de3fd923c9c3232ead88510b783e5a4d16a6154adffa3d53308de984c"
dependencies = [
"proc-macro2 1.0.3",
"quote 1.0.2",
"syn 1.0.11",
]

[[package]]
name = "tracing-core"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0aa83a9a47081cd522c09c81b31aec2c9273424976f922ad61c053b58350b715"
dependencies = [
"lazy_static",
]

[[package]]
name = "try-lock"
version = "0.2.2"
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_middle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "0.11.0"
chalk-ir = "0.14.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
measureme = "0.7.1"
rustc_session = { path = "../librustc_session" }
2 changes: 2 additions & 0 deletions src/librustc_middle/traits/chalk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use rustc_middle::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt};

use rustc_hir::def_id::DefId;
use rustc_target::spec::abi::Abi;

use smallvec::SmallVec;

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

fn debug_program_clause_implication(
pci: &chalk_ir::ProgramClauseImplication<Self>,
Expand Down
15 changes: 8 additions & 7 deletions src/librustc_trait_selection/traits/chalk_fulfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ use crate::traits::{
ChalkEnvironmentAndGoal, ChalkEnvironmentClause, FulfillmentError, FulfillmentErrorCode,
ObligationCause, PredicateObligation, SelectionError, TraitEngine,
};
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::fx::FxIndexSet;
use rustc_hir::def_id::DefId;
use rustc_middle::ty::{self, Ty, TyCtxt};

pub struct FulfillmentContext<'tcx> {
obligations: FxHashSet<PredicateObligation<'tcx>>,
obligations: FxIndexSet<PredicateObligation<'tcx>>,
}

impl FulfillmentContext<'tcx> {
crate fn new() -> Self {
FulfillmentContext { obligations: FxHashSet::default() }
FulfillmentContext { obligations: FxIndexSet::default() }
}
}

Expand Down Expand Up @@ -79,7 +79,7 @@ fn environment<'tcx>(
};

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

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

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

loop {
making_progress = false;

// We iterate over all obligations, and record if we are able
// to unambiguously prove at least one obligation.
for obligation in self.obligations.drain() {
for obligation in self.obligations.drain(..) {
let goal_in_environment = in_environment(infcx, &obligation);
let mut orig_values = OriginalQueryValues::default();
let canonical_goal =
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ rustc_hir = { path = "../librustc_hir" }
rustc_index = { path = "../librustc_index" }
rustc_ast = { path = "../librustc_ast" }
rustc_span = { path = "../librustc_span" }
chalk-ir = "0.11.0"
chalk-solve = "0.11.0"
chalk-ir = "0.14.0"
chalk-solve = "0.14.0"
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
rustc_infer = { path = "../librustc_infer" }
rustc_trait_selection = { path = "../librustc_trait_selection" }
Loading