Skip to content

Commit 9381e81

Browse files
committed
Auto merge of #69247 - CAD97:remove-chalk, r=nikomatsakis
Remove experimental chalk option As suggested by @nikomatsakis [here](#68807 (comment)). The current version of chalk used by the experimental `-Zchalk` flag is [v0.9.0, which is over a year old](https://crates.io/crates/chalk-engine). Since v0.9.0, chalk has seen [a lot of further development](rust-lang/chalk@41dfe13...master), and the intent is to eventually upgrade rustc to use a more recent chalk. However, it will take a decent chunk of effort to upgrade the current experimental chalk support, and it is currently [blocking at least some PRs](#68807) due to chalk:0.9.0's use of unstable features. So for the interim until the next chalk release and experimental rustc integration, we remove the chalk-specific code from rustc.
2 parents 97b3d81 + b3777c9 commit 9381e81

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+20
-2860
lines changed

Diff for: Cargo.lock

-21
Original file line numberDiff line numberDiff line change
@@ -419,25 +419,6 @@ dependencies = [
419419
"rustc-std-workspace-core",
420420
]
421421

422-
[[package]]
423-
name = "chalk-engine"
424-
version = "0.9.0"
425-
source = "registry+https://github.com/rust-lang/crates.io-index"
426-
checksum = "17ec698a6f053a23bfbe646d9f2fde4b02abc19125595270a99e6f44ae0bdd1a"
427-
dependencies = [
428-
"chalk-macros",
429-
"rustc-hash",
430-
]
431-
432-
[[package]]
433-
name = "chalk-macros"
434-
version = "0.1.0"
435-
source = "registry+https://github.com/rust-lang/crates.io-index"
436-
checksum = "295635afd6853aa9f20baeb7f0204862440c0fe994c5a253d5f479dac41d047e"
437-
dependencies = [
438-
"lazy_static 0.2.11",
439-
]
440-
441422
[[package]]
442423
name = "chrono"
443424
version = "0.4.6"
@@ -3110,7 +3091,6 @@ dependencies = [
31103091
"backtrace",
31113092
"bitflags",
31123093
"byteorder",
3113-
"chalk-engine",
31143094
"jobserver",
31153095
"log",
31163096
"measureme",
@@ -4144,7 +4124,6 @@ checksum = "b725dadae9fabc488df69a287f5a99c5eaf5d10853842a8a3dfac52476f544ee"
41444124
name = "rustc_traits"
41454125
version = "0.0.0"
41464126
dependencies = [
4147-
"chalk-engine",
41484127
"log",
41494128
"rustc",
41504129
"rustc_ast",

Diff for: src/librustc/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ rustc_span = { path = "../librustc_span" }
3333
backtrace = "0.3.40"
3434
parking_lot = "0.9"
3535
byteorder = { version = "1.3" }
36-
chalk-engine = { version = "0.9.0", default-features=false }
3736
smallvec = { version = "1.0", features = ["union", "may_dangle"] }
3837
measureme = "0.7.1"
3938
rustc_session = { path = "../librustc_session" }

Diff for: src/librustc/query/mod.rs

-10
Original file line numberDiff line numberDiff line change
@@ -1130,16 +1130,6 @@ rustc_queries! {
11301130
desc { "evaluating trait selection obligation `{}`", goal.value.value }
11311131
}
11321132

1133-
query evaluate_goal(
1134-
goal: traits::ChalkCanonicalGoal<'tcx>
1135-
) -> Result<
1136-
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
1137-
NoSolution
1138-
> {
1139-
no_force
1140-
desc { "evaluating trait selection obligation `{}`", goal.value.goal }
1141-
}
1142-
11431133
/// Do not call this query directly: part of the `Eq` type-op
11441134
query type_op_ascribe_user_type(
11451135
goal: CanonicalTypeOpAscribeUserTypeGoal<'tcx>

Diff for: src/librustc/traits/mod.rs

-43
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ pub mod select;
77
pub mod specialization_graph;
88
mod structural_impls;
99

10-
use crate::infer::canonical::Canonical;
1110
use crate::mir::interpret::ErrorHandled;
12-
use crate::ty::fold::{TypeFolder, TypeVisitor};
1311
use crate::ty::subst::SubstsRef;
1412
use crate::ty::{self, AdtKind, List, Ty, TyCtxt};
1513

@@ -25,8 +23,6 @@ use std::rc::Rc;
2523

2624
pub use self::select::{EvaluationCache, EvaluationResult, OverflowError, SelectionCache};
2725

28-
pub type ChalkCanonicalGoal<'tcx> = Canonical<'tcx, InEnvironment<'tcx, ty::Predicate<'tcx>>>;
29-
3026
pub use self::ObligationCauseCode::*;
3127
pub use self::SelectionError::*;
3228
pub use self::Vtable::*;
@@ -715,45 +711,6 @@ pub struct VtableTraitAliasData<'tcx, N> {
715711
pub nested: Vec<N>,
716712
}
717713

718-
pub trait ExClauseFold<'tcx>
719-
where
720-
Self: chalk_engine::context::Context + Clone,
721-
{
722-
fn fold_ex_clause_with<F: TypeFolder<'tcx>>(
723-
ex_clause: &chalk_engine::ExClause<Self>,
724-
folder: &mut F,
725-
) -> chalk_engine::ExClause<Self>;
726-
727-
fn visit_ex_clause_with<V: TypeVisitor<'tcx>>(
728-
ex_clause: &chalk_engine::ExClause<Self>,
729-
visitor: &mut V,
730-
) -> bool;
731-
}
732-
733-
pub trait ChalkContextLift<'tcx>
734-
where
735-
Self: chalk_engine::context::Context + Clone,
736-
{
737-
type LiftedExClause: Debug + 'tcx;
738-
type LiftedDelayedLiteral: Debug + 'tcx;
739-
type LiftedLiteral: Debug + 'tcx;
740-
741-
fn lift_ex_clause_to_tcx(
742-
ex_clause: &chalk_engine::ExClause<Self>,
743-
tcx: TyCtxt<'tcx>,
744-
) -> Option<Self::LiftedExClause>;
745-
746-
fn lift_delayed_literal_to_tcx(
747-
ex_clause: &chalk_engine::DelayedLiteral<Self>,
748-
tcx: TyCtxt<'tcx>,
749-
) -> Option<Self::LiftedDelayedLiteral>;
750-
751-
fn lift_literal_to_tcx(
752-
ex_clause: &chalk_engine::Literal<Self>,
753-
tcx: TyCtxt<'tcx>,
754-
) -> Option<Self::LiftedLiteral>;
755-
}
756-
757714
#[derive(Clone, Debug, PartialEq, Eq, Hash, HashStable)]
758715
pub enum ObjectSafetyViolation {
759716
/// `Self: Sized` declared on the trait.

Diff for: src/librustc/traits/structural_impls.rs

-72
Original file line numberDiff line numberDiff line change
@@ -595,42 +595,6 @@ impl<'a, 'tcx, G: Lift<'tcx>> Lift<'tcx> for traits::InEnvironment<'a, G> {
595595
}
596596
}
597597

598-
impl<'tcx, C> Lift<'tcx> for chalk_engine::ExClause<C>
599-
where
600-
C: chalk_engine::context::Context + Clone,
601-
C: traits::ChalkContextLift<'tcx>,
602-
{
603-
type Lifted = C::LiftedExClause;
604-
605-
fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
606-
<C as traits::ChalkContextLift>::lift_ex_clause_to_tcx(self, tcx)
607-
}
608-
}
609-
610-
impl<'tcx, C> Lift<'tcx> for chalk_engine::DelayedLiteral<C>
611-
where
612-
C: chalk_engine::context::Context + Clone,
613-
C: traits::ChalkContextLift<'tcx>,
614-
{
615-
type Lifted = C::LiftedDelayedLiteral;
616-
617-
fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
618-
<C as traits::ChalkContextLift>::lift_delayed_literal_to_tcx(self, tcx)
619-
}
620-
}
621-
622-
impl<'tcx, C> Lift<'tcx> for chalk_engine::Literal<C>
623-
where
624-
C: chalk_engine::context::Context + Clone,
625-
C: traits::ChalkContextLift<'tcx>,
626-
{
627-
type Lifted = C::LiftedLiteral;
628-
629-
fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
630-
<C as traits::ChalkContextLift>::lift_literal_to_tcx(self, tcx)
631-
}
632-
}
633-
634598
///////////////////////////////////////////////////////////////////////////
635599
// TypeFoldable implementations.
636600

@@ -674,39 +638,3 @@ impl<'tcx> TypeFoldable<'tcx> for traits::Clauses<'tcx> {
674638
self.iter().any(|t| t.visit_with(visitor))
675639
}
676640
}
677-
678-
impl<'tcx, C> TypeFoldable<'tcx> for chalk_engine::ExClause<C>
679-
where
680-
C: traits::ExClauseFold<'tcx>,
681-
C::Substitution: Clone,
682-
C::RegionConstraint: Clone,
683-
{
684-
fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
685-
<C as traits::ExClauseFold>::fold_ex_clause_with(self, folder)
686-
}
687-
688-
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
689-
<C as traits::ExClauseFold>::visit_ex_clause_with(self, visitor)
690-
}
691-
}
692-
693-
EnumTypeFoldableImpl! {
694-
impl<'tcx, C> TypeFoldable<'tcx> for chalk_engine::DelayedLiteral<C> {
695-
(chalk_engine::DelayedLiteral::CannotProve)(a),
696-
(chalk_engine::DelayedLiteral::Negative)(a),
697-
(chalk_engine::DelayedLiteral::Positive)(a, b),
698-
} where
699-
C: chalk_engine::context::Context<CanonicalConstrainedSubst: TypeFoldable<'tcx>> + Clone,
700-
}
701-
702-
EnumTypeFoldableImpl! {
703-
impl<'tcx, C> TypeFoldable<'tcx> for chalk_engine::Literal<C> {
704-
(chalk_engine::Literal::Negative)(a),
705-
(chalk_engine::Literal::Positive)(a),
706-
} where
707-
C: chalk_engine::context::Context<GoalInEnvironment: Clone + TypeFoldable<'tcx>> + Clone,
708-
}
709-
710-
CloneTypeFoldableAndLiftImpls! {
711-
chalk_engine::TableIndex,
712-
}

Diff for: src/librustc_infer/infer/canonical/canonicalizer.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,8 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
357357
// `TyVar(vid)` is unresolved, track its universe index in the canonicalized
358358
// result.
359359
Err(mut ui) => {
360-
if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk {
361-
// FIXME: perf problem described in #55921.
362-
ui = ty::UniverseIndex::ROOT;
363-
}
360+
// FIXME: perf problem described in #55921.
361+
ui = ty::UniverseIndex::ROOT;
364362
self.canonicalize_ty_var(
365363
CanonicalVarInfo {
366364
kind: CanonicalVarKind::Ty(CanonicalTyVarKind::General(ui)),
@@ -447,10 +445,8 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Canonicalizer<'cx, 'tcx> {
447445
// `ConstVar(vid)` is unresolved, track its universe index in the
448446
// canonicalized result
449447
Err(mut ui) => {
450-
if !self.infcx.unwrap().tcx.sess.opts.debugging_opts.chalk {
451-
// FIXME: perf problem described in #55921.
452-
ui = ty::UniverseIndex::ROOT;
453-
}
448+
// FIXME: perf problem described in #55921.
449+
ui = ty::UniverseIndex::ROOT;
454450
return self.canonicalize_const_var(
455451
CanonicalVarInfo { kind: CanonicalVarKind::Const(ui) },
456452
ct,

0 commit comments

Comments
 (0)