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. Originallyconst fn
was skipped due to issue #43636 thatloop
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.
Fields
within_static_or_const: bool
nested_blocks: Option<Vec<Block>>
resolver: &'a mut Resolver<'b>
Implementations
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
fn flat_map_foreign_item(
&mut self,
ni: P<Item<ForeignItemKind>>
) -> SmallVec<[P<Item<ForeignItemKind>>; 1]>
Auto Trait Implementations
impl<'a, 'b> !RefUnwindSafe for ReplaceBodyWithLoop<'a, 'b>
impl<'a, 'b> !Send for ReplaceBodyWithLoop<'a, 'b>
impl<'a, 'b> !Sync for ReplaceBodyWithLoop<'a, 'b>
impl<'a, 'b> Unpin for ReplaceBodyWithLoop<'a, 'b> where
'b: 'a,
impl<'a, 'b> !UnwindSafe for ReplaceBodyWithLoop<'a, 'b>
Blanket Implementations
Layout
Note: Most layout information is completely unstable and may even differ between compilations. 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