Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Cow instead of &[] for InlineAsm MIR #72392

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/librustc_codegen_ssa/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
bug!("borrowck false edges in codegen")
}

mir::TerminatorKind::InlineAsm { template, ref operands, options, destination } => {
mir::TerminatorKind::InlineAsm { ref template, ref operands, options, destination } => {
self.codegen_asm_terminator(
helper,
bx,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_middle/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ pub enum TerminatorKind<'tcx> {
/// inline assembly is allowed to diverge.
InlineAsm {
/// The template for the inline assembly, with placeholders.
template: &'tcx [InlineAsmTemplatePiece],
template: Cow<'tcx, [InlineAsmTemplatePiece]>,

/// The operands for the inline assembly, as `Operand`s or `Place`s.
operands: Vec<InlineAsmOperand<'tcx>>,
Expand Down
9 changes: 6 additions & 3 deletions src/librustc_middle/mir/type_foldable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
FalseEdges { real_target, imaginary_target }
}
FalseUnwind { real_target, unwind } => FalseUnwind { real_target, unwind },
InlineAsm { template, ref operands, options, destination } => {
InlineAsm { template, operands: operands.fold_with(folder), options, destination }
}
InlineAsm { ref template, ref operands, options, destination } => InlineAsm {
template: template.clone(),
operands: operands.fold_with(folder),
options,
destination,
},
};
Terminator { source_info: self.source_info, kind }
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir_build/build/expr/into.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
block,
source_info,
TerminatorKind::InlineAsm {
template,
template: template.into(),
operands,
options,
destination: if options.contains(InlineAsmOptions::NORETURN) {
Expand Down