Skip to content

Commit 8164a74

Browse files
committed
Document everybody_loops
1 parent 8f349be commit 8164a74

File tree

1 file changed

+18
-10
lines changed
  • compiler/rustc_interface/src

1 file changed

+18
-10
lines changed

compiler/rustc_interface/src/util.rs

+18-10
Original file line numberDiff line numberDiff line change
@@ -712,16 +712,24 @@ pub fn non_durable_rename(src: &Path, dst: &Path) -> std::io::Result<()> {
712712
std::fs::rename(src, dst)
713713
}
714714

715-
// Note: Also used by librustdoc, see PR #43348. Consider moving this struct elsewhere.
716-
//
717-
// FIXME: Currently the `everybody_loops` transformation is not applied to:
718-
// * `const fn`, due to issue #43636 that `loop` is not supported for const evaluation. We are
719-
// waiting for miri to fix that.
720-
// * `impl Trait`, due to issue #43869 that functions returning impl Trait cannot be diverging.
721-
// Solving this may require `!` to implement every trait, which relies on the an even more
722-
// ambitious form of the closed RFC #1637. See also [#34511].
723-
//
724-
// [#34511]: https://github.com/rust-lang/rust/issues/34511#issuecomment-322340401
715+
/// Replaces function bodies with `loop {}` (an infinite loop). This gets rid of
716+
/// all semantic errors in the body while still satisfying the return type,
717+
/// except in certain cases, see below for more.
718+
///
719+
/// This pass is known as `everybody_loops`. Very punny.
720+
///
721+
/// As of March 2021, `everybody_loops` is only used for the
722+
/// `-Z unpretty=everybody_loops` debugging option.
723+
///
724+
/// FIXME: Currently the `everybody_loops` transformation is not applied to:
725+
/// * `const fn`; support could be added, but hasn't. Originally `const fn`
726+
/// was skipped due to issue #43636 that `loop` was not supported for
727+
/// const evaluation.
728+
/// * `impl Trait`, due to issue #43869 that functions returning impl Trait cannot be diverging.
729+
/// Solving this may require `!` to implement every trait, which relies on the an even more
730+
/// ambitious form of the closed RFC #1637. See also [#34511].
731+
///
732+
/// [#34511]: https://github.com/rust-lang/rust/issues/34511#issuecomment-322340401
725733
pub struct ReplaceBodyWithLoop<'a, 'b> {
726734
within_static_or_const: bool,
727735
nested_blocks: Option<Vec<ast::Block>>,

0 commit comments

Comments
 (0)