Skip to content

Commit

Permalink
Auto merge of #113303 - compiler-errors:yeet-chalk, r=lcnr
Browse files Browse the repository at this point in the history
Remove chalk support from the compiler

Removes chalk (`-Ztrait-solver=chalk`) from the compiler and prunes any dead code resulting from this, mainly:
* Remove the chalk compatibility layer in `compiler/rustc_traits/src/chalk`
* Remove the chalk flag `-Ztrait-solver=chalk` and its `TraitEngine` implementation
* Remove `TypeWellFormedFromEnv` (and its many `bug!()` match arms)
* Remove the chalk migration mode from compiletest
* Remove the `chalkify` UI tests (do we want to keep any of these, but migrate them to `-Ztrait-solver=next`??)

Fulfills rust-lang/types-team#93.

r? `@jackh726`
  • Loading branch information
bors committed Jul 4, 2023
2 parents 52d8c49 + 0c73b41 commit cd68ead
Show file tree
Hide file tree
Showing 89 changed files with 35 additions and 3,864 deletions.
75 changes: 0 additions & 75 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -433,60 +433,6 @@ dependencies = [
"rustc-std-workspace-core",
]

[[package]]
name = "chalk-derive"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff5053a8a42dbff5279a82423946fc56dc1253b76cf211b2b3c14b3aad4e1281"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.8",
"synstructure 0.13.0",
]

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

[[package]]
name = "chalk-ir"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a56de2146a8ed0fcd54f4bd50db852f1de4eac9e1efe568494f106c21b77d2a"
dependencies = [
"bitflags 1.3.2",
"chalk-derive",
"lazy_static",
]

[[package]]
name = "chalk-solve"
version = "0.92.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b392e02b4c81ec76d3748da839fc70a5539b83d27c9030668463d34d5110b860"
dependencies = [
"chalk-derive",
"chalk-ir",
"ena",
"indexmap 1.9.3",
"itertools",
"petgraph",
"rustc-hash",
"tracing",
"tracing-subscriber",
"tracing-tree",
]

[[package]]
name = "chrono"
version = "0.4.26"
Expand Down Expand Up @@ -1168,12 +1114,6 @@ dependencies = [
"windows-sys 0.48.0",
]

[[package]]
name = "fixedbitset"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"

[[package]]
name = "flate2"
version = "1.0.26"
Expand Down Expand Up @@ -2466,16 +2406,6 @@ dependencies = [
"sha2",
]

[[package]]
name = "petgraph"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
dependencies = [
"fixedbitset",
"indexmap 1.9.3",
]

[[package]]
name = "phf"
version = "0.10.1"
Expand Down Expand Up @@ -3675,7 +3605,6 @@ name = "rustc_middle"
version = "0.0.0"
dependencies = [
"bitflags 1.3.2",
"chalk-ir",
"derive_more",
"either",
"field-offset",
Expand Down Expand Up @@ -4102,9 +4031,6 @@ dependencies = [
name = "rustc_traits"
version = "0.0.0"
dependencies = [
"chalk-engine",
"chalk-ir",
"chalk-solve",
"rustc_ast",
"rustc_data_structures",
"rustc_hir",
Expand Down Expand Up @@ -5033,7 +4959,6 @@ dependencies = [
"thread_local",
"tracing",
"tracing-core",
"tracing-log",
]

[[package]]
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_hir_analysis/src/astconv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -983,8 +983,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
ty::ClauseKind::RegionOutlives(_)
| ty::ClauseKind::ConstArgHasType(..)
| ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_)
| ty::ClauseKind::TypeWellFormedFromEnv(_) => {
| ty::ClauseKind::ConstEvaluatable(_) => {
bug!()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ fn trait_predicate_kind<'tcx>(
| ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
| ty::PredicateKind::ConstEquate(..)
| ty::PredicateKind::Ambiguous
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => None,
| ty::PredicateKind::Ambiguous => None,
}
}
3 changes: 1 addition & 2 deletions compiler/rustc_hir_analysis/src/outlives/explicit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> {
| ty::ClauseKind::Projection(_)
| ty::ClauseKind::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_)
| ty::ClauseKind::TypeWellFormedFromEnv(_) => {}
| ty::ClauseKind::ConstEvaluatable(_) => {}
}
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// inference variable.
| ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Ambiguous
| ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => None,
=> None,
},
)
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,8 +847,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
| ty::ClauseKind::Projection(_)
| ty::ClauseKind::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_)
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
| ty::ClauseKind::ConstEvaluatable(_) => None,
}
});

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_infer/src/infer/outlives/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ pub fn explicit_outlives_bounds<'tcx>(
| ty::ClauseKind::Projection(_)
| ty::ClauseKind::ConstArgHasType(_, _)
| ty::ClauseKind::WellFormed(_)
| ty::ClauseKind::ConstEvaluatable(_)
| ty::ClauseKind::TypeWellFormedFromEnv(_) => None,
| ty::ClauseKind::ConstEvaluatable(_) => None,
})
}

Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_infer/src/traits/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,6 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
}),
);
}
ty::PredicateKind::Clause(ty::ClauseKind::TypeWellFormedFromEnv(..)) => {
// Nothing to elaborate
}
ty::PredicateKind::Ambiguous => {}
ty::PredicateKind::AliasRelate(..) => {
// No
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_interface/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ fn test_unstable_options_tracking_hash() {
tracked!(thir_unsafeck, true);
tracked!(tiny_const_eval_limit, true);
tracked!(tls_model, Some(TlsModel::GeneralDynamic));
tracked!(trait_solver, TraitSolver::Chalk);
tracked!(trait_solver, TraitSolver::NextCoherence);
tracked!(translate_remapped_path_to_local_path, false);
tracked!(trap_unreachable, Some(false));
tracked!(treat_err_as_bug, NonZeroUsize::new(1));
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_lint/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1606,8 +1606,7 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
// Ignore bounds that a user can't type
| ClauseKind::WellFormed(..)
// FIXME(generic_const_exprs): `ConstEvaluatable` can be written
| ClauseKind::ConstEvaluatable(..)
| ClauseKind::TypeWellFormedFromEnv(_) => continue,
| ClauseKind::ConstEvaluatable(..) => continue,
};
if predicate.is_global() {
cx.emit_spanned_lint(
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_middle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2021"

[dependencies]
bitflags = "1.2.1"
chalk-ir = "0.92.0"
derive_more = "0.99.17"
either = "1.5.0"
gsgdt = "0.1.2"
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_middle/src/query/erase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ tcx_lifetime! {
rustc_middle::mir::interpret::ConstValue,
rustc_middle::mir::interpret::GlobalId,
rustc_middle::mir::interpret::LitToConstInput,
rustc_middle::traits::ChalkEnvironmentAndGoal,
rustc_middle::traits::query::MethodAutoderefStepsResult,
rustc_middle::traits::query::type_op::AscribeUserType,
rustc_middle::traits::query::type_op::Eq,
Expand Down
13 changes: 2 additions & 11 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ use crate::traits::query::{
};
use crate::traits::specialization_graph;
use crate::traits::{
CanonicalChalkEnvironmentAndGoal, CodegenObligationError, EvaluationResult, ImplSource,
ObjectSafetyViolation, ObligationCause, OverflowError, WellFormedLoc,
CodegenObligationError, EvaluationResult, ImplSource, ObjectSafetyViolation, ObligationCause,
OverflowError, WellFormedLoc,
};
use crate::ty::fast_reject::SimplifiedType;
use crate::ty::layout::ValidityRequirement;
Expand Down Expand Up @@ -1971,15 +1971,6 @@ rustc_queries! {
desc { "evaluating trait selection obligation `{}`", goal.value.value }
}

query evaluate_goal(
goal: CanonicalChalkEnvironmentAndGoal<'tcx>
) -> Result<
&'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, ()>>,
NoSolution
> {
desc { "evaluating trait selection obligation `{}`", goal.value }
}

/// Do not call this query directly: part of the `Eq` type-op
query type_op_ascribe_user_type(
goal: CanonicalTypeOpAscribeUserTypeGoal<'tcx>
Expand Down
Loading

0 comments on commit cd68ead

Please sign in to comment.