Skip to content

Commit 7eda723

Browse files
committed
Fix cases of conflicting two-phase borrows
1 parent 2d06571 commit 7eda723

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/librustc_codegen_llvm/abi.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
266266
OperandValue::Ref(next(), Some(next()), self.layout.align.abi).store(bx, dst);
267267
}
268268
PassMode::Direct(_) | PassMode::Indirect(_, None) | PassMode::Cast(_) => {
269-
self.store(bx, next(), dst);
269+
let next_arg = next();
270+
self.store(bx, next_arg, dst);
270271
}
271272
}
272273
}

src/librustc_mir/transform/add_retag.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl MirPass for AddRetag {
164164
if src_ty.is_region_ptr() {
165165
// The only `Misc` casts on references are those creating raw pointers.
166166
assert!(dest_ty.is_unsafe_ptr());
167-
(RetagKind::Raw, place)
167+
(RetagKind::Raw, place.clone())
168168
} else {
169169
// Some other cast, no retag
170170
continue
@@ -182,7 +182,7 @@ impl MirPass for AddRetag {
182182
_ =>
183183
RetagKind::Default,
184184
};
185-
(kind, place)
185+
(kind, place.clone())
186186
}
187187
// Do nothing for the rest
188188
_ => continue,
@@ -191,7 +191,7 @@ impl MirPass for AddRetag {
191191
let source_info = block_data.statements[i].source_info;
192192
block_data.statements.insert(i+1, Statement {
193193
source_info,
194-
kind: StatementKind::Retag(retag_kind, place.clone()),
194+
kind: StatementKind::Retag(retag_kind, place),
195195
});
196196
}
197197
}

src/libsyntax_ext/format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,9 @@ impl<'a, 'b> Context<'a, 'b> {
347347

348348
Named(name) => {
349349
match self.names.get(&name) {
350-
Some(idx) => {
350+
Some(&idx) => {
351351
// Treat as positional arg.
352-
self.verify_arg_type(Exact(*idx), ty)
352+
self.verify_arg_type(Exact(idx), ty)
353353
}
354354
None => {
355355
let msg = format!("there is no argument named `{}`", name);

0 commit comments

Comments
 (0)