Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix cases of conflicting two-phase borrows
  • Loading branch information
matthewjasper committed Apr 4, 2019
1 parent 2d06571 commit 7eda723
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/librustc_codegen_llvm/abi.rs
Expand Up @@ -266,7 +266,8 @@ impl ArgTypeExt<'ll, 'tcx> for ArgType<'tcx, Ty<'tcx>> {
OperandValue::Ref(next(), Some(next()), self.layout.align.abi).store(bx, dst);
}
PassMode::Direct(_) | PassMode::Indirect(_, None) | PassMode::Cast(_) => {
self.store(bx, next(), dst);
let next_arg = next();
self.store(bx, next_arg, dst);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_mir/transform/add_retag.rs
Expand Up @@ -164,7 +164,7 @@ impl MirPass for AddRetag {
if src_ty.is_region_ptr() {
// The only `Misc` casts on references are those creating raw pointers.
assert!(dest_ty.is_unsafe_ptr());
(RetagKind::Raw, place)
(RetagKind::Raw, place.clone())
} else {
// Some other cast, no retag
continue
Expand All @@ -182,7 +182,7 @@ impl MirPass for AddRetag {
_ =>
RetagKind::Default,
};
(kind, place)
(kind, place.clone())
}
// Do nothing for the rest
_ => continue,
Expand All @@ -191,7 +191,7 @@ impl MirPass for AddRetag {
let source_info = block_data.statements[i].source_info;
block_data.statements.insert(i+1, Statement {
source_info,
kind: StatementKind::Retag(retag_kind, place.clone()),
kind: StatementKind::Retag(retag_kind, place),
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax_ext/format.rs
Expand Up @@ -347,9 +347,9 @@ impl<'a, 'b> Context<'a, 'b> {

Named(name) => {
match self.names.get(&name) {
Some(idx) => {
Some(&idx) => {
// Treat as positional arg.
self.verify_arg_type(Exact(*idx), ty)
self.verify_arg_type(Exact(idx), ty)
}
None => {
let msg = format!("there is no argument named `{}`", name);
Expand Down

0 comments on commit 7eda723

Please sign in to comment.