Closed
Description
pub struct Bar
where
for<'a> &'a mut Self:;
fn main() {}
results in overflow in the new solver when checking WF(Bar)
or `for<'a> WF(&'a mut Bar). The issue is as follows:
pub struct Bar
where
for<'a> &'a mut Bar:;
for<'a> WF(&'a mut Bar)
(attempt 0)WF(&'a.1 mut Bar)
outlives(Bar, 'a.1)
OK[Bar: 'a.1]
WF(Bar)
for<'a> WF(&'a mut Bar)
cycle OK[]
- RESULT: OK
[Bar: 'a.1]
for<'a> WF(&'a mut Bar)
(attempt 1)WF(&'a.1 mut Bar)
outlives(Bar, 'a.1)
OK[Bar: 'a.1]
WF(Bar)
for<'a> WF(&'a mut Bar)
cycle OK[Bar: 'a.2]
(create new universe)
- RESULT: OK
[Bar: 'a.1, Bar: 'a.2]
for<'a> WF(&'a mut Bar)
(attempt 2)WF(&'a.1 mut Bar)
outlives(Bar, 'a.1)
OK[Bar: 'a.1]
WF(Bar)
for<'a> WF(&'a mut Bar)
cycle OK[Bar: 'a.2, Bar: 'a.3]
(create new universe)
- RESULT: OK
[Bar: 'a.1, Bar: 'a.2, Bar: 'a.3]
starting with WF(BAR)
WF(Bar)
iteration 0for<'a> WF(&'a mut Bar)
WF(&'a.1 mut Bar)
outlives(Bar, 'a.1)
OK[Bar: 'a.1]
WF(Bar)
cycle OK[]
WF(Bar)
iteration 1for<'a> WF(&'a mut Bar)
WF(&'a.1 mut Bar)
outlives(Bar, 'a.1)
OK[Bar: 'a.1]
WF(Bar)
cycle OK[Bar: 'a.?]
a similar issue is:
struct Foo
where
Foo:,
for<'a> &'a ():;
WF(Foo)
iteration 0WF(Foo)
cycle OK[]
for<'a> WF(&'a ())
OK[(): 'a.1]
(new universe for unnameable placeholder)- result OK
[(): 'a.1]
WF(Foo)
iteration 1 (in new infcx)WF(Foo)
cycle OK[(): 'a.1]
(new universe for unnameable placeholder)for<'a> WF(&'a ())
OK[(): 'a.2]
(new universe for unnameable placeholder)- result OK
[(): 'a.1, (): 'a.2]
yikes (have to rerun again)
The long term plan to solve this is to eagerly deal with new placeholders in the solver, short term we probably want to somehow deduplicate new placeholder constraints when creating the query response we're going to ignore this because hopefully this pattern does not exist in user-code.