Stream: t-compiler/const-eval

Topic: Which kind of operands functions are?

Christian Poveda (Mar 15 2019 at 00:59, on Zulip):

I'm trying to follow the execution of a function from a call terminator on MIR ( and I wanted to know which kind of operands ( functions are

Christian Poveda (Mar 15 2019 at 01:22, on Zulip):

I assume functions declared with fn () {...} are just constants?

Matthew Jasper (Mar 15 2019 at 07:29, on Zulip):


Christian Poveda (Mar 15 2019 at 14:38, on Zulip):

On which stage rustc stores functions to be called later?

Wesley Wiser (Mar 15 2019 at 14:39, on Zulip):

What do you mean by "stores functions"?

Christian Poveda (Mar 15 2019 at 14:47, on Zulip):

Well right now I understand that in order to evaluate a function, const-eval adds a new frame to the stack with a reference to the MIR of the function. Where are the representations of functions stored to be retrieved?

Wesley Wiser (Mar 15 2019 at 15:07, on Zulip):

The MIR for the function is stored in a side table in the TyCtxt which is accessed by DefId. The query you're probably most interested in is tcx.mir_const()

oli (Mar 15 2019 at 15:32, on Zulip):

Const eval actually uses the optimized_mir query. mir_const is only for const qualification

Wesley Wiser (Mar 15 2019 at 15:42, on Zulip):

Oops. Thanks @oli

Christian Poveda (Mar 16 2019 at 18:11, on Zulip):

Ok now I've got weekend reading material, thank you :D

Last update: Apr 03 2020 at 17:50UTC