summaryrefslogtreecommitdiffstats
path: root/vendor/git2/src/tree.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:42 +0000
commitcec1877e180393eba0f6ddb0cf97bf3a791631c7 (patch)
tree47b4dac2a9dd9a40c30c251b4d4a72d7ccf77e9f /vendor/git2/src/tree.rs
parentAdding debian version 1.74.1+dfsg1-1. (diff)
downloadrustc-cec1877e180393eba0f6ddb0cf97bf3a791631c7.tar.xz
rustc-cec1877e180393eba0f6ddb0cf97bf3a791631c7.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/git2/src/tree.rs')
-rw-r--r--vendor/git2/src/tree.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/vendor/git2/src/tree.rs b/vendor/git2/src/tree.rs
index 78b241384..9a38244cf 100644
--- a/vendor/git2/src/tree.rs
+++ b/vendor/git2/src/tree.rs
@@ -122,10 +122,6 @@ impl<'repo> Tree<'repo> {
C: FnMut(&str, &TreeEntry<'_>) -> T,
T: Into<i32>,
{
- #[allow(unused)]
- struct TreeWalkCbData<'a, T> {
- pub callback: &'a mut TreeWalkCb<'a, T>,
- }
unsafe {
let mut data = TreeWalkCbData {
callback: &mut callback,
@@ -209,6 +205,10 @@ impl<'repo> Tree<'repo> {
type TreeWalkCb<'a, T> = dyn FnMut(&str, &TreeEntry<'_>) -> T + 'a;
+struct TreeWalkCbData<'a, T> {
+ callback: &'a mut TreeWalkCb<'a, T>,
+}
+
extern "C" fn treewalk_cb<T: Into<i32>>(
root: *const c_char,
entry: *const raw::git_tree_entry,
@@ -220,8 +220,9 @@ extern "C" fn treewalk_cb<T: Into<i32>>(
_ => return -1,
};
let entry = entry_from_raw_const(entry);
- let payload = payload as *mut &mut TreeWalkCb<'_, T>;
- (*payload)(root, &entry).into()
+ let payload = &mut *(payload as *mut TreeWalkCbData<'_, T>);
+ let callback = &mut payload.callback;
+ callback(root, &entry).into()
}) {
Some(value) => value,
None => -1,