mir: Add a new method to statement
Avoid introducing a large number of changes when adding optional initialization fields.
This commit is contained in:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user