diff options
| author | lcnr <rust@lcnr.de> | 2022-03-08 15:39:52 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2022-03-08 15:39:52 +0100 |
| commit | b8135fd5c8e51a0578cff82096cbbf7e5d57fdeb (patch) | |
| tree | 424db470532660fc53ca3239561ad29f137e5fd9 /compiler/rustc_mir_transform/src/check_unsafety.rs | |
| parent | 67b3e8183830c7af4e06a9aa91de4d1be3c860f7 (diff) | |
| download | rust-b8135fd5c8e51a0578cff82096cbbf7e5d57fdeb.tar.gz rust-b8135fd5c8e51a0578cff82096cbbf7e5d57fdeb.zip | |
add `#[rustc_pass_by_value]` to more types
Diffstat (limited to 'compiler/rustc_mir_transform/src/check_unsafety.rs')
| -rw-r--r-- | compiler/rustc_mir_transform/src/check_unsafety.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/rustc_mir_transform/src/check_unsafety.rs b/compiler/rustc_mir_transform/src/check_unsafety.rs index eaf3f19bff1..87b9244c068 100644 --- a/compiler/rustc_mir_transform/src/check_unsafety.rs +++ b/compiler/rustc_mir_transform/src/check_unsafety.rs @@ -127,7 +127,10 @@ impl<'tcx> Visitor<'tcx> for UnsafetyChecker<'_, 'tcx> { &AggregateKind::Closure(def_id, _) | &AggregateKind::Generator(def_id, _, _) => { let UnsafetyCheckResult { violations, used_unsafe_blocks, .. } = self.tcx.unsafety_check_result(def_id.expect_local()); - self.register_violations(violations, used_unsafe_blocks); + self.register_violations( + violations, + used_unsafe_blocks.iter().map(|(&h, &d)| (h, d)), + ); } }, _ => {} @@ -261,7 +264,7 @@ impl<'tcx> UnsafetyChecker<'_, 'tcx> { fn register_violations<'a>( &mut self, violations: impl IntoIterator<Item = &'a UnsafetyViolation>, - new_used_unsafe_blocks: impl IntoIterator<Item = (&'a HirId, &'a UsedUnsafeBlockData)>, + new_used_unsafe_blocks: impl IntoIterator<Item = (HirId, UsedUnsafeBlockData)>, ) { use UsedUnsafeBlockData::{AllAllowedInUnsafeFn, SomeDisallowedInUnsafeFn}; @@ -318,7 +321,7 @@ impl<'tcx> UnsafetyChecker<'_, 'tcx> { new_used_unsafe_blocks .into_iter() - .for_each(|(&hir_id, &usage_data)| update_entry(self, hir_id, usage_data)); + .for_each(|(hir_id, usage_data)| update_entry(self, hir_id, usage_data)); } fn check_mut_borrowing_layout_constrained_field( &mut self, |
