Stream: t-compiler/help

Topic: -Z unpretty=everybody_loops does not behave as expected


Joshua Nelson (Jun 19 2020 at 21:20, on Zulip):

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 {}?

Joshua Nelson (Jun 19 2020 at 21:37, on Zulip):

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.

Joshua Nelson (Jun 19 2020 at 23:50, on Zulip):

I think I have a fix, it needs to return true from needs_ast_map.

Joshua Nelson (Jun 20 2020 at 00:13, on Zulip):

https://github.com/rust-lang/rust/pull/73523

Last update: Jan 22 2021 at 13:15UTC