X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_middle%2Fsrc%2Fmir%2Fsyntax.rs;h=faf903a59490164f42733f41a91289eaf9aecf8d;hb=360db516ccf358bd4b35c483ae44634a74c66c0b;hp=6b4489026d3d379dee958125b73ced3eb3d40fb1;hpb=2dd2fb728e61a6e7912e1e2818407625ad806bb9;p=rust.git diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs index 6b4489026d3..faf903a5949 100644 --- a/compiler/rustc_middle/src/mir/syntax.rs +++ b/compiler/rustc_middle/src/mir/syntax.rs @@ -286,7 +286,10 @@ pub enum StatementKind<'tcx> { /// This is permitted for both generators and ADTs. This does not necessarily write to the /// entire place; instead, it writes to the minimum set of bytes as required by the layout for /// the type. - SetDiscriminant { place: Box>, variant_index: VariantIdx }, + SetDiscriminant { + place: Box>, + variant_index: VariantIdx, + }, /// Deinitializes the place. /// @@ -355,6 +358,8 @@ pub enum StatementKind<'tcx> { /// This avoids adding a new block and a terminator for simple intrinsics. Intrinsic(Box>), + ConstEvalCounter, + /// No-op. Useful for deleting instructions without affecting statement indices. Nop, } @@ -512,6 +517,16 @@ pub struct CopyNonOverlapping<'tcx> { /// must also be `cleanup`. This is a part of the type system and checked statically, so it is /// still an error to have such an edge in the CFG even if it's known that it won't be taken at /// runtime. +/// 4. The control flow between cleanup blocks must look like an upside down tree. Roughly +/// speaking, this means that control flow that looks like a V is allowed, while control flow +/// that looks like a W is not. This is necessary to ensure that landing pad information can be +/// correctly codegened on MSVC. More precisely: +/// +/// Begin with the standard control flow graph `G`. Modify `G` as follows: for any two cleanup +/// vertices `u` and `v` such that `u` dominates `v`, contract `u` and `v` into a single vertex, +/// deleting self edges and duplicate edges in the process. Now remove all vertices from `G` +/// that are not cleanup vertices or are not reachable. The resulting graph must be an inverted +/// tree, that is each vertex may have at most one successor and there may be no cycles. #[derive(Clone, TyEncodable, TyDecodable, Hash, HashStable, PartialEq, TypeFoldable, TypeVisitable)] pub enum TerminatorKind<'tcx> { /// Block has one successor; we continue execution there.