Try   HackMD

Rustc Contributor Office Hours

Question/Topic Queue

How do I add an entry

pnkfelix: Put a title, prefixed by ##, and then on the next line, your name, colon, and a short prompt to start the conversation.

Bug Minimization

matt: are there any changes to compiler tooling since your blog post?

pnkfelix: Yep, e.g. -Z everybody-loops was removed.

Replaced every fn body with loop { }, has type !, and ! is subtype of every other type (at least informally).

matt: volunteering to write tool for loopifying and other minimization outside compiler

pnkfelix: rr -M, flag includes process number running and event count
rr -a, rr -a -M <event-count>

matt: will write blog post for rr

pnkfelix: use debuginfo-level=2 in general when using using debugger
watch -location diag.level; reverse-continue. jump to the point where diagnostic is written

How to know which modules to turn on debug output for?

Mix of responses

First thing: debug! respect tree structure of modules.

Can turn on RUSTC_LOG=rustc_mir_transform, that will emit debugging for all submodules that occur under that root module (e.g. rustc_mir_transform::abort_unwinding_calls)

(pnkfelix doesn't know off hand if one can turn off subtrees once one has opted in from a parent module tree.)

Second: Look at stack trace, see the chain of modules referenced by the stack trace.

Third: guess compiler crates that might be relevant, grep for debug! in the source.

Q: would it be useful to have cross-referencing of knowing other crates that one should turn on.

e.g. rustc_hir_typeck, eventually realized that rustc_infer was another good crate to turn on debug logging for.

A1: could the [dependencies] of Cargo.toml for the rustc_ crate in question be of use in guiding search

A2: also look at the use statements of the mod.rs

A3: (can the above be automated? Maybe, but it might not be what you want.)

Internal stucture of compiler

Mapping between long unfolded internal structure (including def-id's etc) to the source code

THIR structure made by macro thir_with_elements.
arms, blocks, expressions, statements, parameters

Descriptive image of ScopeTree
rustc_middle::middle::region::scope

Block is made of a series of statements, optionally followed by a tail expression. We don't put the data inline from the block, we use a statement Id to point to a structure located elsewhere. Ids act as conceptual pointers, indices in an array.

rustc_middle::thir