From 5934e0afeff267d58a6449f10a263f9f1ad8f847 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 6 Feb 2025 10:06:07 +0100 Subject: [PATCH] MIR validation: add comment explaining the limitations of CfgChecker --- compiler/rustc_mir_transform/src/validate.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compiler/rustc_mir_transform/src/validate.rs b/compiler/rustc_mir_transform/src/validate.rs index b7a3770fc6b1d..4ac3a268c9c33 100644 --- a/compiler/rustc_mir_transform/src/validate.rs +++ b/compiler/rustc_mir_transform/src/validate.rs @@ -97,6 +97,12 @@ impl<'tcx> crate::MirPass<'tcx> for Validator { } } +/// This checker covers basic properties of the control-flow graph, (dis)allowed statements and terminators. +/// Everything checked here must be stable under substitution of generic parameters. In other words, +/// this is about the *structure* of the MIR, not the *contents*. +/// +/// Everything that depends on types, or otherwise can be affected by generic parameters, +/// must be checked in `TypeChecker`. struct CfgChecker<'a, 'tcx> { when: &'a str, body: &'a Body<'tcx>,