Stream: t-compiler

Topic: ICE for recursive type w/ infinite size #61323


nikomatsakis (Jun 06 2019 at 14:25, on Zulip):

Hey @davidtwco, @simulacrum -- to be honest I've not even looked at the bug yet :)

simulacrum (Jun 06 2019 at 14:26, on Zulip):

If it helps I can try to dig in after compiler meeting and see if I can make any progress and report back

nikomatsakis (Jun 06 2019 at 14:39, on Zulip):

OK I at least clicked on it now. I'm not an expert in this code but I am "familiar with the concepts" :)

simulacrum (Jun 06 2019 at 17:18, on Zulip):

@nikomatsakis When do you think you'll have some time for me to run a few things past you?

simulacrum (Jun 06 2019 at 17:19, on Zulip):
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(TraitSelect(ad559170a0bb6af-f35452a8800813b7)) --- state of dependency adt_sized_constraint(issue_61323[317d]::C[0]) is unknown, trying to mark it green
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::C[0])) - BEGIN
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::C[0])) --- found dependency adt_def(issue_61323[317d]::C[0]) to be immediately green
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::C[0])) - END - dependency type_of(issue_61323[317d]::C[0]::a[0]) was immediately red
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(TraitSelect(ad559170a0bb6af-f35452a8800813b7)) --- trying to force dependency adt_sized_constraint(issue_61323[317d]::C[0])
DEBUG 2019-06-06T16:29:15Z: rustc::ty: evaluating adt_sized_constraint for DefId(0:16 ~ issue_61323[317d]::C[0])
DEBUG 2019-06-06T16:29:15Z: rustc::ty::query::plumbing: ty::query::get_query<adt_def>(key=DefId(0:16 ~ issue_61323[317d]::C[0]), span=./issue-61323.rs:1:1: 1:1)
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(0:16 ~ issue_61323[317d]::C[0])
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print: default_print_def_path: def_id=DefId(0:16 ~ issue_61323[317d]::C[0]), substs=[]
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print: default_print_def_path: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("C"), disambiguator: 0 } }
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(0:0 ~ issue_61323[317d])
DEBUG 2019-06-06T16:29:15Z: rustc::ty: evaluating adt_sized_constraint for (2) C
DEBUG 2019-06-06T16:29:15Z: rustc::ty::query::plumbing: ty::query::get_query<type_of>(key=DefId(0:17 ~ issue_61323[317d]::C[0]::a[0]), span=./issue-61323.rs:1:1: 1:1)
DEBUG 2019-06-06T16:29:15Z: rustc::ty::query::plumbing: ty::query::get_query<adt_sized_constraint>(key=DefId(0:12 ~ issue_61323[317d]::A[0]), span=./issue-61323.rs:1:1: 1:1)
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::A[0])) - BEGIN
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::A[0])) --- found dependency adt_def(issue_61323[317d]::A[0]) to be immediately green
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::A[0])) --- found dependency type_of(issue_61323[317d]::A[0]::B[0]::0[0]) to be immediately green
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::A[0])) --- state of dependency adt_sized_constraint(issue_61323[317d]::C[0]) is unknown, trying to mark it green
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::C[0])) - BEGIN
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::C[0])) --- found dependency adt_def(issue_61323[317d]::C[0]) to be immediately green
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::C[0])) - END - dependency type_of(issue_61323[317d]::C[0]::a[0]) was immediately red
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::A[0])) --- trying to force dependency adt_sized_constraint(issue_61323[317d]::C[0])
DEBUG 2019-06-06T16:29:15Z: rustc::ty::query::plumbing: ty::query::get_query<def_span>(key=DefId(0:16 ~ issue_61323[317d]::C[0]), span=./issue-61323.rs:1:1: 1:1)
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print::pretty: def_path_str: def_id=DefId(0:16 ~ issue_61323[317d]::C[0]), ns=TypeNS
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(0:16 ~ issue_61323[317d]::C[0])
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print: default_print_def_path: def_id=DefId(0:16 ~ issue_61323[317d]::C[0]), substs=[]
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print: default_print_def_path: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("C"), disambiguator: 0 } }
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(0:0 ~ issue_61323[317d])
DEBUG 2019-06-06T16:29:15Z: rustc::ty::query::plumbing: ty::query::get_query<def_span>(key=DefId(0:12 ~ issue_61323[317d]::A[0]), span=./issue-61323.rs:1:1: 1:1)
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print::pretty: def_path_str: def_id=DefId(0:12 ~ issue_61323[317d]::A[0]), ns=TypeNS
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(0:12 ~ issue_61323[317d]::A[0])
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print: default_print_def_path: def_id=DefId(0:12 ~ issue_61323[317d]::A[0]), substs=[]
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print: default_print_def_path: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("A"), disambiguator: 0 } }
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(0:0 ~ issue_61323[317d])
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print::pretty: def_path_str: def_id=DefId(0:16 ~ issue_61323[317d]::C[0]), ns=TypeNS
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(0:16 ~ issue_61323[317d]::C[0])
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print: default_print_def_path: def_id=DefId(0:16 ~ issue_61323[317d]::C[0]), substs=[]
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print: default_print_def_path: key=DefKey { parent: Some(DefIndex(0)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("C"), disambiguator: 0 } }
DEBUG 2019-06-06T16:29:15Z: rustc::ty::print::pretty: try_print_visible_def_path: def_id=DefId(0:0 ~ issue_61323[317d])
DEBUG 2019-06-06T16:29:15Z: rustc::ty::fold: HasTypeFlagsVisitor: t=[type error] t.flags=HAS_TY_ERR self.flags=KEEP_IN_LOCAL_TCX
DEBUG 2019-06-06T16:29:15Z: rustc::dep_graph::graph: try_mark_previous_green(adt_sized_constraint(issue_61323[317d]::A[0])) --- forced to None
error: internal compiler error: src/librustc/dep_graph/graph.rs:725: try_mark_previous_green() - Forcing the DepNode should have set its color
simulacrum (Jun 06 2019 at 17:22, on Zulip):

basically I'm trying to understand what exactly happens when we force a dep node

simulacrum (Jun 06 2019 at 17:23, on Zulip):

from what I can tell through all the macros for the adt_sized_constraint query we can in fact find it from the depnode (since it's sole key is a DefId)

simulacrum (Jun 06 2019 at 17:26, on Zulip):

and that seems to lead to an execution of the query to check whether it's green or not

simulacrum (Jun 06 2019 at 17:27, on Zulip):

in this case that execution appears to loop, which I guess makes sense -- but we don't detect that loop

simulacrum (Jun 06 2019 at 17:30, on Zulip):

I'm not actually sure why this loop doesn't always happen though, i.e., how we ever make it past this point

simulacrum (Jun 06 2019 at 17:30, on Zulip):

maybe adt_sized_constraint isn't called in the happy path?

simulacrum (Jun 06 2019 at 20:25, on Zulip):

Hm, okay, so I'm getting the impression that the problem is that the dep graph code has the "has errors" check here but it doesn't account for the fact that some queries, like adt_sized_info, don't emit errors but rather just return Error(...) of some sort and expect someone later on to actually emit the error

simulacrum (Jun 06 2019 at 20:29, on Zulip):

@nikomatsakis I'm not sure what to do about that (or whether my conclusion is even correct) so I'll call this blocked here and wait for you to have some time to chat for now

nikomatsakis (Jun 10 2019 at 20:04, on Zulip):

Hm, okay, so I'm getting the impression that the problem is that the dep graph code has the "has errors" check here but it doesn't account for the fact that some queries, like adt_sized_info, don't emit errors but rather just return Error(...) of some sort and expect someone later on to actually emit the error

hmm, that sounds plausible

simulacrum (Jun 10 2019 at 20:47, on Zulip):

I'm not sure what the best route to move forward would be -- it also feels loosely like maybe we can just remove the has_errors check and do a delay_bug! or something akin to that?

simulacrum (Jun 10 2019 at 20:48, on Zulip):

IIRC there is a way to say "we maybe encountered a bug but if something later on emits an error it is not actually a bug"

simulacrum (Jun 10 2019 at 20:48, on Zulip):

@nikomatsakis does that sound like a viable plan? I'm not sure why the differentiation between has_errors being fine vs. not otherwise

simulacrum (Jun 10 2019 at 20:48, on Zulip):

It's also possible I've incorrectly arrived at a conclusion :)

varkor (Jun 10 2019 at 20:50, on Zulip):

@simulacrum: delay_span_bug only crashes if normal errors have not been emitted

simulacrum (Jun 10 2019 at 20:51, on Zulip):

right, that's what we want I think vs. the bug! call on this line

nikomatsakis (Jun 10 2019 at 21:21, on Zulip):

@simulacrum that may be a viable plan, or maybe we can improve this logic altogether

nikomatsakis (Jun 10 2019 at 21:21, on Zulip):

I think I need to devote a bit of time to concentrate on it -- maybe tomorrow morning

simulacrum (Jun 10 2019 at 21:22, on Zulip):

okay -- I should be around tomorrow morning, let me know if you want to talk/chat sync

Last update: Nov 20 2019 at 01:10UTC