Skip to content

Commit 1b84f39

Browse files
committed
enable the overflow_universe test, which works now
1 parent f4b910f commit 1b84f39

File tree

1 file changed

+22
-10
lines changed

1 file changed

+22
-10
lines changed

src/solve/test/mod.rs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1944,30 +1944,42 @@ fn unselected_projection() {
19441944
}
19451945

19461946
#[test]
1947-
#[should_panic] // FIXME
19481947
fn overflow_universe() {
19491948
test! {
19501949
program {
19511950
struct Foo { }
19521951

19531952
trait Bar { }
19541953

1954+
// When asked to solve X: Bar, we will produce a
1955+
// requirement to solve !1: Bar. And then when asked to
1956+
// solve that, we'll produce a requirement to solve !2:
1957+
// Bar. And so forth.
19551958
forall<X> { X: Bar if forall<Y> { Y: Bar } }
19561959
}
19571960

19581961
goal {
19591962
Foo: Bar
19601963
} yields[SolverChoice::recursive()] {
1961-
// Currently the recursive solver overflows and panics on
1962-
// this example. Once the universe canonicalization work
1963-
// is completed, however, it should not.
1964-
""
1964+
// The internal universe canonicalization in the recursive
1965+
// solver means that when we are asked to solve (e.g.)
1966+
// `!2: Bar`, we rewrite that to `!1: Bar`, identifying a
1967+
// cycle.
1968+
"No possible solution"
19651969
} yields[SolverChoice::slg()] {
1966-
// The SLG solver currently runs forever; in this setup,
1967-
// it intentionally never gets a *chance* to run. With
1968-
// full universe canonicalization, though, it should not
1969-
// run forever.
1970-
""
1970+
// The SLG solver here *currently* works a bit by
1971+
// accident, as it does not yet do universe
1972+
// canonicalization internally. However, we wind up with a table
1973+
// for the goal
1974+
//
1975+
// forall<Y> { Y: Bar }
1976+
//
1977+
// and that table never produces any answers. But if we
1978+
// could induce a cycle !1: Bar to !2: Bar to !3: Bar etc,
1979+
// the SLG solver would loop forever. Ungreat.
1980+
"No possible solution"
19711981
}
19721982
}
1983+
1984+
panic!()
19731985
}

0 commit comments

Comments
 (0)