Skip to content

Commit 969da62

Browse files
committed
Use Cow instead of &[] for InlineAsm MIR
Fixes rust-lang#72386
1 parent f182c4a commit 969da62

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/librustc_codegen_ssa/mir/block.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
10341034
bug!("borrowck false edges in codegen")
10351035
}
10361036

1037-
mir::TerminatorKind::InlineAsm { template, ref operands, options, destination } => {
1037+
mir::TerminatorKind::InlineAsm { ref template, ref operands, options, destination } => {
10381038
self.codegen_asm_terminator(
10391039
helper,
10401040
bx,

src/librustc_middle/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ pub enum TerminatorKind<'tcx> {
11851185
/// inline assembly is allowed to diverge.
11861186
InlineAsm {
11871187
/// The template for the inline assembly, with placeholders.
1188-
template: &'tcx [InlineAsmTemplatePiece],
1188+
template: Cow<'tcx, [InlineAsmTemplatePiece]>,
11891189

11901190
/// The operands for the inline assembly, as `Operand`s or `Place`s.
11911191
operands: Vec<InlineAsmOperand<'tcx>>,

src/librustc_middle/mir/type_foldable.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
7878
FalseEdges { real_target, imaginary_target }
7979
}
8080
FalseUnwind { real_target, unwind } => FalseUnwind { real_target, unwind },
81-
InlineAsm { template, ref operands, options, destination } => {
82-
InlineAsm { template, operands: operands.fold_with(folder), options, destination }
83-
}
81+
InlineAsm { ref template, ref operands, options, destination } => InlineAsm {
82+
template: template.clone(),
83+
operands: operands.fold_with(folder),
84+
options,
85+
destination,
86+
},
8487
};
8588
Terminator { source_info: self.source_info, kind }
8689
}

src/librustc_mir_build/build/expr/into.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
365365
block,
366366
source_info,
367367
TerminatorKind::InlineAsm {
368-
template,
368+
template: template.into(),
369369
operands,
370370
options,
371371
destination: if options.contains(InlineAsmOptions::NORETURN) {

0 commit comments

Comments
 (0)