Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compilation under rustc 1.77.2: missing unsafe #60

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix compilation under rustc 1.77.2: missing unsafe
pstiasny committed Jun 12, 2024
commit 8a7c720bc4654d576bbc310ab83dea373a386de9
2 changes: 1 addition & 1 deletion src/completion.rs
Original file line number Diff line number Diff line change
@@ -385,7 +385,7 @@ impl<'r> CompletionString<'r> {
iter!(
clang_getCompletionNumAnnotations(self.ptr),
clang_getCompletionAnnotation(self.ptr),
).map(utility::to_string).collect()
).map(|cxs| unsafe { utility::to_string(cxs) }).collect()
}

/// Returns the availability of this completion string.
4 changes: 2 additions & 2 deletions src/documentation.rs
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ impl BlockCommand {
let arguments = iter!(
clang_BlockCommandComment_getNumArgs(raw),
clang_BlockCommandComment_getArgText(raw),
).map(utility::to_string).collect();
).map(|cxs| unsafe { utility::to_string(cxs) }).collect();
let paragraph = clang_BlockCommandComment_getParagraph(raw);
let children = Comment::from_raw(paragraph).get_children();
BlockCommand { command, arguments, children }
@@ -249,7 +249,7 @@ impl InlineCommand {
let arguments = iter!(
clang_InlineCommandComment_getNumArgs(raw),
clang_InlineCommandComment_getArgText(raw),
).map(utility::to_string).collect();
).map(|cxs| unsafe { utility::to_string(cxs) }).collect();
let style = match clang_InlineCommandComment_getRenderKind(raw) {
CXCommentInlineCommandRenderKind_Normal => None,
other => Some(mem::transmute(other)),
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1787,7 +1787,7 @@ impl<'cmds> CompileCommand<'cmds> {
clang_CompileCommand_getNumArgs(self.ptr),
clang_CompileCommand_getArg(self.ptr),
)
.map(utility::to_string)
.map(|cxs| unsafe { utility::to_string(cxs) })
.collect()
}

2 changes: 1 addition & 1 deletion src/utility.rs
Original file line number Diff line number Diff line change
@@ -273,7 +273,7 @@ pub unsafe fn to_string(clang: CXString) -> String {
}

pub fn to_string_option(clang: CXString) -> Option<String> {
clang.map(to_string).and_then(|s| {
clang.map(|cxs| unsafe { to_string(cxs) }).and_then(|s| {
if !s.is_empty() {
Some(s)
} else {