Stream: t-compiler/const-eval

Topic: anon_const_instance_printing


oli (Oct 17 2018 at 15:33, on Zulip):

but I haven't checked

but not all AnonConst might be array lengths?

oli (Oct 17 2018 at 15:33, on Zulip):

right, so we basically need to keep the None arm, check the parent, and decide on that what to print

oli (Oct 17 2018 at 15:34, on Zulip):

if the parent is an array type, print LEN, if it's an enum variant, print DISCRIMINANT, ...

oli (Oct 17 2018 at 15:34, on Zulip):

there aren't that many AnonConst in the rustc::hir datastructures

RalfJ (Oct 17 2018 at 16:04, on Zulip):

the case where get_opt_name returns None is the one we are already in

RalfJ (Oct 17 2018 at 16:05, on Zulip):

but before this even decides how to print the current thing, it prints the parent

RalfJ (Oct 17 2018 at 16:05, on Zulip):

and that's what fails for the array length

RalfJ (Oct 17 2018 at 16:06, on Zulip):

that's here: https://github.com/rust-lang/rust/blob/9d7f0da367bae7587ed0ef69bd4384392099fc9e/src/librustc/util/ppaux.rs#L264

RalfJ (Oct 17 2018 at 16:07, on Zulip):

as_interned_str seems like a good place to put the {{LEN}} in but for that we have to first print the parent

RalfJ (Oct 17 2018 at 16:08, on Zulip):

so I dont think I understand what you are suggesting

oli (Oct 17 2018 at 16:24, on Zulip):

Oh... I misunderstood that. Printing an array type does not make sense here I think, we'd need to skip two Items I suppose

oli (Oct 17 2018 at 16:24, on Zulip):

maybe... I have to leave, I'll investigate tomorrow

RalfJ (Oct 18 2018 at 20:13, on Zulip):

@Oli any news?

oli (Oct 18 2018 at 20:15, on Zulip):

nope, forgot about this, sorry

RalfJ (Oct 18 2018 at 20:15, on Zulip):

kk

oli (Oct 19 2018 at 10:46, on Zulip):

https://github.com/rust-lang/rust/pull/55199 fixed

oli (Oct 19 2018 at 10:47, on Zulip):

it's untestable without RUST_LOG sadly

oli (Oct 19 2018 at 10:47, on Zulip):

so I don't think I can add regression tests

pnkfelix (Oct 19 2018 at 10:58, on Zulip):

Add an info! ? heh.

pnkfelix (Oct 19 2018 at 10:58, on Zulip):

or wait, what debug level is trace! at?

pnkfelix (Oct 19 2018 at 10:59, on Zulip):

that is, is it included in non-debug builds of rustc ?

pnkfelix (Oct 19 2018 at 10:59, on Zulip):

if so, you could resort to a run-make/ test (yikes!)

oli (Oct 19 2018 at 11:16, on Zulip):

oh, info would work, too, but yea, I don't want a run-make test :confused:

RalfJ (Oct 19 2018 at 11:19, on Zulip):

aren't there tests that link to librustc?

RalfJ (Oct 19 2018 at 11:19, on Zulip):

they could do a println("{:?}", some_instance)

oli (Oct 19 2018 at 11:20, on Zulip):

almost. then I'd still need to get an instance :confused:

RalfJ (Oct 19 2018 at 11:21, on Zulip):

hm yeah

Last update: Nov 15 2019 at 20:35UTC