diff --git a/rust/build.rs b/rust/build.rs index 16d663c4d..c98bf81bf 100644 --- a/rust/build.rs +++ b/rust/build.rs @@ -1,13 +1,6 @@ use std::path::PathBuf; fn main() { - // TODO : Enable the following when https://github.com/rust-lang/rust/issues/43781 stabilizes - // #[cfg(doc)] - let _ = std::fs::create_dir("target"); - let _ = std::fs::create_dir("target/doc"); - let _ = std::fs::copy("../docs/img/favicon.ico", "target/doc/favicon.ico"); - let _ = std::fs::copy("../docs/img/logo.png", "target/doc/logo.png"); - let link_path = std::env::var_os("DEP_BINARYNINJACORE_PATH").expect("DEP_BINARYNINJACORE_PATH specified"); diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 9499fd512..2865552c3 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -19,8 +19,8 @@ #![allow(clippy::too_many_arguments)] #![allow(clippy::needless_doctest_main)] #![doc(html_root_url = "https://dev-rust.binary.ninja/")] -#![doc(html_favicon_url = "/favicon.ico")] -#![doc(html_logo_url = "/logo.png")] +#![doc(html_favicon_url = "https://binary.ninja/icons/favicon-32x32.png")] +#![doc(html_logo_url = "https://binary.ninja/icons/android-chrome-512x512.png")] #![doc(issue_tracker_base_url = "https://github.com/Vector35/binaryninja-api/issues/")] #![doc = include_str!("../README.md")] diff --git a/rust/src/low_level_il/lifting.rs b/rust/src/low_level_il/lifting.rs index 0e8994c60..620b27652 100644 --- a/rust/src/low_level_il/lifting.rs +++ b/rust/src/low_level_il/lifting.rs @@ -1119,11 +1119,19 @@ where }; // Update the labels after they have been resolved. - *true_label = LowLevelILLabel::from(raw_true_label); - *false_label = LowLevelILLabel::from(raw_false_label); - self.update_label_map_for_label(true_label); - self.update_label_map_for_label(false_label); - + let mut new_true_label = LowLevelILLabel::from(raw_true_label); + let mut new_false_label = LowLevelILLabel::from(raw_false_label); + if let Some(location) = true_label.location { + new_true_label.location = Some(location); + self.update_label_map_for_label(&new_true_label); + } + if let Some(location) = false_label.location { + new_false_label.location = Some(location); + self.update_label_map_for_label(&new_false_label); + } + *true_label = new_true_label; + *false_label = new_false_label; + LowLevelILExpression::new(self, LowLevelExpressionIndex(expr_idx)) } @@ -1138,8 +1146,12 @@ where let expr_idx = unsafe { BNLowLevelILGoto(self.handle, &mut raw_label) }; // Update the labels after they have been resolved. - *label = LowLevelILLabel::from(raw_label); - self.update_label_map_for_label(label); + let mut new_label = LowLevelILLabel::from(raw_label); + if let Some(location) = label.location { + new_label.location = Some(location); + self.update_label_map_for_label(&new_label); + } + *label = new_label; LowLevelILExpression::new(self, LowLevelExpressionIndex(expr_idx)) } @@ -1594,8 +1606,12 @@ where let mut raw_label = BNLowLevelILLabel::from(*label); unsafe { BNLowLevelILMarkLabel(self.handle, &mut raw_label) }; - *label = LowLevelILLabel::from(raw_label); - self.update_label_map_for_label(label); + let mut new_label = LowLevelILLabel::from(raw_label); + if let Some(location) = label.location { + new_label.location = Some(location); + self.update_label_map_for_label(&new_label); + } + *label = new_label; } }