Add a perma-unstable (for now: internal) attribute @statistics (done via 1278a29d1649403f7865dbbd37f1a515b665cf19) (or whatever) for declarations which outputs a report during compile time containing several possibly useful pieces of information about the declaration. It is unstable in the sense that is an error to use it without enabling it with @feature(…) declaration or an unstable command-line flag (for now: -Zinternals).
It's probably a good idea to make the level of verbosity adjustable and make certain information which require expensive computation opt-out by default. Also, the information are gathered through several passes. Should we output a report for each or gather it into one big one? The latter is better I guess but needs additional infrastructure.
Any Declaration
public or not
used/unused and/or amount of uses/references inside the crate
[very expensive] resulting from both: tightest scope of exposure (@(public SCOPE)) that makes the crate still compile
Value Declarations
whether it was inlined or not
if it was constant-folded/evaluated statically (use @static to force)
if it is recursive (direct, mutual, …) and if it could be tco
Data Declarations
[expensive, unless we regularly need to do do it for case analyses, too] inhabited/uninhabited/unkown inhabitation status(dependent types, duh!)
[expensive, maybe] number of inhabitants: ℕ ∪ {∞} ∪ {unknown}
number of true parameters (true = non-indices) and (type theoretic) indices + list of ~ (ordered + enumerated/Debruijn-indexed(to account for shadowing))
number+names of constructors + amount/names of specialized and/or existential, normal (+ relation with parameters and indices)
[expensive?] if all uses are static/erased + reason (zero-sized, constant-folding etc) or amount of static vs dynamic
amount of unboxed instances vs boxed
Constructor Declarations
meta: copy some stuff over from the data declarations section
Add a perma-unstable (for now: internal) attribute
@statistics
(done via 1278a29d1649403f7865dbbd37f1a515b665cf19) (or whatever) for declarations which outputs a report during compile time containing several possibly useful pieces of information about the declaration. It is unstable in the sense that is an error to use it without enabling it with@feature
(…) declaration or an unstable command-line flag (for now:-Zinternals
).It's probably a good idea to make the level of verbosity adjustable and make certain information which require expensive computation opt-out by default. Also, the information are gathered through several passes. Should we output a report for each or gather it into one big one? The latter is better I guess but needs additional infrastructure.
Any Declaration
@(public SCOPE)
) that makes the crate still compileValue Declarations
@static
to force)Data Declarations
Constructor Declarations