diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-10-11 03:19:14 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-11 03:19:14 +0900 |
| commit | 8752b43900a82f8f7c0f08c74a3f360148b91e5a (patch) | |
| tree | 980085f80e636accd9fe25b246f04d19c55c15b4 /compiler/rustc_mir/src/transform | |
| parent | 83685880b6de32e9781bea09d3d54decd195a9dd (diff) | |
| parent | 217d6f9741819aedfe22e6d3ec9cca6e4a49f77d (diff) | |
| download | rust-8752b43900a82f8f7c0f08c74a3f360148b91e5a.tar.gz rust-8752b43900a82f8f7c0f08c74a3f360148b91e5a.zip | |
Rollup merge of #77754 - bugadani:find_map_relevant_impl, r=matthewjasper
Add TraitDef::find_map_relevant_impl This PR adds a method to `TraitDef`. While `for_each_relevant_impl` covers the general use case, sometimes it's not necessary to scan through all the relevant implementations, so this PR introduces a new method, `find_map_relevant_impl`. I've also replaced the `for_each_relevant_impl` calls where possible. I'm hoping for a tiny bit of efficiency gain here and there.
Diffstat (limited to 'compiler/rustc_mir/src/transform')
| -rw-r--r-- | compiler/rustc_mir/src/transform/check_const_item_mutation.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_mir/src/transform/check_const_item_mutation.rs b/compiler/rustc_mir/src/transform/check_const_item_mutation.rs index 4d4e9b98917..26993a6b941 100644 --- a/compiler/rustc_mir/src/transform/check_const_item_mutation.rs +++ b/compiler/rustc_mir/src/transform/check_const_item_mutation.rs @@ -34,7 +34,6 @@ impl<'a, 'tcx> ConstMutationChecker<'a, 'tcx> { fn is_const_item_without_destructor(&self, local: Local) -> Option<DefId> { let def_id = self.is_const_item(local)?; - let mut any_dtor = |_tcx, _def_id| Ok(()); // We avoid linting mutation of a const item if the const's type has a // Drop impl. The Drop logic observes the mutation which was performed. @@ -54,7 +53,7 @@ impl<'a, 'tcx> ConstMutationChecker<'a, 'tcx> { // // #[const_mutation_allowed] // pub const LOG: Log = Log { msg: "" }; - match self.tcx.calculate_dtor(def_id, &mut any_dtor) { + match self.tcx.calculate_dtor(def_id, &mut |_, _| Ok(())) { Some(_) => None, None => Some(def_id), } |
