diff options
| author | dianqk <dianqk@dianqk.net> | 2025-06-08 15:30:18 +0800 |
|---|---|---|
| committer | dianqk <dianqk@dianqk.net> | 2025-06-29 20:13:36 +0800 |
| commit | 9f9cd5e2837f57504b92b5acbadb48ff0cb9e29c (patch) | |
| tree | 40909c9f107775e415bed62051fe9d757c647ad5 /compiler/rustc_middle/src | |
| parent | 5ca574e85b67cec0a6fc3fddfe398cbe676c9c69 (diff) | |
| download | rust-9f9cd5e2837f57504b92b5acbadb48ff0cb9e29c.tar.gz rust-9f9cd5e2837f57504b92b5acbadb48ff0cb9e29c.zip | |
mir: Add a `new` method to `statement`
Avoid introducing a large number of changes when adding optional initialization fields.
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/mir/statement.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/mir/statement.rs b/compiler/rustc_middle/src/mir/statement.rs index d98b40f0fcf..d16477adb77 100644 --- a/compiler/rustc_middle/src/mir/statement.rs +++ b/compiler/rustc_middle/src/mir/statement.rs @@ -16,12 +16,16 @@ pub struct Statement<'tcx> { pub kind: StatementKind<'tcx>, } -impl Statement<'_> { +impl<'tcx> Statement<'tcx> { /// Changes a statement to a nop. This is both faster than deleting instructions and avoids /// invalidating statement indices in `Location`s. pub fn make_nop(&mut self) { self.kind = StatementKind::Nop } + + pub fn new(source_info: SourceInfo, kind: StatementKind<'tcx>) -> Self { + Statement { source_info, kind } + } } impl<'tcx> StatementKind<'tcx> { |
