diff options
| author | dianqk <dianqk@dianqk.net> | 2025-07-01 07:02:14 +0800 |
|---|---|---|
| committer | dianqk <dianqk@dianqk.net> | 2025-07-01 07:14:13 +0800 |
| commit | 90e0835004b2ec6dc596bbecf65eb49f49c01e7f (patch) | |
| tree | b540fc3421d8b09d1f005f1d384ceb2562416971 /compiler/rustc_middle/src | |
| parent | f26e58023071e71636a3c72ac3a2bf89b1f76706 (diff) | |
| download | rust-90e0835004b2ec6dc596bbecf65eb49f49c01e7f.tar.gz rust-90e0835004b2ec6dc596bbecf65eb49f49c01e7f.zip | |
mir: Mark `Statement` and `BasicBlockData` as `#[non_exhaustive]`
Ensure they are always created using constructors.
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/mir/mod.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/mir/statement.rs | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 9f39908c3b2..33e97766a02 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -1336,6 +1336,7 @@ impl BasicBlock { /// /// See [`BasicBlock`] for documentation on what basic blocks are at a high level. #[derive(Clone, Debug, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)] +#[non_exhaustive] pub struct BasicBlockData<'tcx> { /// List of statements in this block. pub statements: Vec<Statement<'tcx>>, diff --git a/compiler/rustc_middle/src/mir/statement.rs b/compiler/rustc_middle/src/mir/statement.rs index d16477adb77..683d7b48617 100644 --- a/compiler/rustc_middle/src/mir/statement.rs +++ b/compiler/rustc_middle/src/mir/statement.rs @@ -11,6 +11,7 @@ use crate::ty::CoroutineArgsExt; /// A statement in a basic block, including information about its source code. #[derive(Clone, TyEncodable, TyDecodable, HashStable, TypeFoldable, TypeVisitable)] +#[non_exhaustive] pub struct Statement<'tcx> { pub source_info: SourceInfo, pub kind: StatementKind<'tcx>, |
