Struct rustc_interface::util::ReplaceBodyWithLoop[][src]

pub struct ReplaceBodyWithLoop<'a, 'b> {
    within_static_or_const: bool,
    nested_blocks: Option<Vec<Block>>,
    resolver: &'a mut Resolver<'b>,
Expand description

Replaces function bodies with loop {} (an infinite loop). This gets rid of all semantic errors in the body while still satisfying the return type, except in certain cases, see below for more.

This pass is known as everybody_loops. Very punny.

As of March 2021, everybody_loops is only used for the -Z unpretty=everybody_loops debugging option.

FIXME: Currently the everybody_loops transformation is not applied to:

  • const fn; support could be added, but hasn’t. Originally const fn was skipped due to issue #43636 that loop was not supported for const evaluation.
  • impl Trait, due to issue #43869 that functions returning impl Trait cannot be diverging. Solving this may require ! to implement every trait, which relies on the an even more ambitious form of the closed RFC #1637. See also #34511.


within_static_or_const: boolnested_blocks: Option<Vec<Block>>resolver: &'a mut Resolver<'b>


Trait Implementations

Mutable token visiting only exists for the macro_rules token marker and should not be used otherwise. Token visitor would be entirely separate from the regular visitor if the marker didn’t have to visit AST fragments in nonterminal tokens. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.


Note: Most layout information is completely unstable and may be different between compiler versions and platforms. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 40 bytes