Skip to content

Commit 6f5c3c9

Browse files
authored
Rollup merge of #106718 - lcnr:solver-cycles, r=compiler-errors
finish trait solver skeleton work ### 648d661b4e0fcf55f7082894f577377eb451db4b The previous implementation didn't remove provisional entries which depended on the current goal if we're forced to rerun in case the provisional result of that entry is different from the new result. For reference, see https://rust-lang.github.io/chalk/book/recursive/search_graph.html. We should also treat inductive cycles as overflow, not ordinary ambiguity. ### 219a5de2517cebfe20a2c3417bd302f7c12db70c 6a1912be539dd5a3b3c10be669787c4bf0c1868a These two commits move canonicalization to the start of the queries which simplifies a bunch of stuff. I originally intended to keep stuff canonicalized for a while because I expected us to add a additional caches the trait solver, either for candidate assembly or for projections. We ended up not adding (and expect to not need) any of them so this just ends up being easier to understand. ### d78d5ad0979e965afde6500bccfa119b47063506 adds a special `eq` for the solver which doesn't care about obligations or spans ### 18704e6a78b7703e1bbb3856f015cb76c0a07a06 implements https://rust-lang.zulipchat.com/#narrow/stream/364551-t-types.2Ftrait-system-refactor/topic/projection.20cache r? `@compiler-errors`
2 parents 548ae60 + 369f9aa commit 6f5c3c9

File tree

15 files changed

+916
-644
lines changed

15 files changed

+916
-644
lines changed

Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -4783,6 +4783,7 @@ dependencies = [
47834783
"rustc_middle",
47844784
"rustc_parse_format",
47854785
"rustc_query_system",
4786+
"rustc_serialize",
47864787
"rustc_session",
47874788
"rustc_span",
47884789
"rustc_target",

compiler/rustc_middle/src/infer/canonical.rs

+6
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,12 @@ TrivialTypeTraversalAndLiftImpls! {
339339
}
340340

341341
impl<'tcx> CanonicalVarValues<'tcx> {
342+
/// Creates dummy var values which should not be used in a
343+
/// canonical response.
344+
pub fn dummy() -> CanonicalVarValues<'tcx> {
345+
CanonicalVarValues { var_values: Default::default() }
346+
}
347+
342348
#[inline]
343349
pub fn len(&self) -> usize {
344350
self.var_values.len()

compiler/rustc_middle/src/ty/sty.rs

-11
Original file line numberDiff line numberDiff line change
@@ -1113,17 +1113,6 @@ impl<'tcx, T> Binder<'tcx, T> {
11131113
if self.0.has_escaping_bound_vars() { None } else { Some(self.skip_binder()) }
11141114
}
11151115

1116-
pub fn no_bound_vars_ignoring_escaping(self, tcx: TyCtxt<'tcx>) -> Option<T>
1117-
where
1118-
T: TypeFoldable<'tcx>,
1119-
{
1120-
if !self.0.has_escaping_bound_vars() {
1121-
Some(self.skip_binder())
1122-
} else {
1123-
self.0.try_fold_with(&mut SkipBindersAt { index: ty::INNERMOST, tcx }).ok()
1124-
}
1125-
}
1126-
11271116
/// Splits the contents into two things that share the same binder
11281117
/// level as the original, returning two distinct binders.
11291118
///

compiler/rustc_trait_selection/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ rustc_infer = { path = "../rustc_infer" }
1919
rustc_lint_defs = { path = "../rustc_lint_defs" }
2020
rustc_macros = { path = "../rustc_macros" }
2121
rustc_query_system = { path = "../rustc_query_system" }
22+
rustc_serialize = { path = "../rustc_serialize" }
2223
rustc_session = { path = "../rustc_session" }
2324
rustc_span = { path = "../rustc_span" }
2425
rustc_target = { path = "../rustc_target" }

compiler/rustc_trait_selection/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#![feature(never_type)]
2222
#![feature(result_option_inspect)]
2323
#![feature(type_alias_impl_trait)]
24+
#![feature(min_specialization)]
2425
#![recursion_limit = "512"] // For rustdoc
2526

2627
#[macro_use]

0 commit comments

Comments
 (0)