Fix cases of conflicting two-phase borrows
This commit is contained in:
parent
2d065712cf
commit
7eda723279
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
@ -182,7 +182,7 @@ impl MirPass for AddRetag {
|
||||
_ =>
|
||||
RetagKind::Default,
|
||||
};
|
||||
(kind, place)
|
||||
(kind, place.clone())
|
||||
}
|
||||
// Do nothing for the rest
|
||||
_ => continue,
|
||||
@ -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),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user