I'm looking at ReplaceBodyInLoop
for https://github.com/rust-lang/rust/pull/73103#issuecomment-646339691. From my understanding, this replaces function bodies with loop {}
so rustc doesn't have to do item-bodies checking. However, I'm not seeing this in the debug output:
$ rustc +nightly priv-in-pub.rs -Z unpretty=everybody_loops
#![no_std]
/// See also [`g()`][crate::g] and [`h()`]
pub fn f() { }
fn g() { }
pub fn h() { 1 + 2; }
Am I misunderstanding what this does? Why isn't 1 + 2;
replaced with loop {}
?
I added some debug logging and it looks like ReplaceBodyInLoop
just isn't being run at all. It must have broken silently at some point.
I think I have a fix, it needs to return true
from needs_ast_map
.