Skip to content

Commit 97ed808

Browse files
author
Lukas Markeffsky
committed
remove no-op logic
1 parent 4a59ba4 commit 97ed808

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

compiler/rustc_mir_transform/src/deduce_param_attrs.rs

+2-13
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,14 @@ impl DeduceReadOnly {
2929
}
3030

3131
impl<'tcx> Visitor<'tcx> for DeduceReadOnly {
32-
fn visit_local(&mut self, local: Local, mut context: PlaceContext, _: Location) {
32+
fn visit_local(&mut self, local: Local, context: PlaceContext, _location: Location) {
3333
// We're only interested in arguments.
3434
if local == RETURN_PLACE || local.index() > self.mutable_args.domain_size() {
3535
return;
3636
}
3737

38-
// Replace place contexts that are moves with copies. This is safe in all cases except
39-
// function argument position, which we already handled in `visit_terminator()` by using the
40-
// ArgumentChecker. See the comment in that method for more details.
41-
//
42-
// In the future, we might want to move this out into a separate pass, but for now let's
43-
// just do it on the fly because that's faster.
44-
if matches!(context, PlaceContext::NonMutatingUse(NonMutatingUseContext::Move)) {
45-
context = PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy);
46-
}
47-
4838
match context {
49-
PlaceContext::MutatingUse(..)
50-
| PlaceContext::NonMutatingUse(NonMutatingUseContext::Move) => {
39+
PlaceContext::MutatingUse(..) => {
5140
// This is a mutation, so mark it as such.
5241
self.mutable_args.insert(local.index() - 1);
5342
}

0 commit comments

Comments
 (0)