summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2025-09-29 14:53:05 -0400
committerJosh Ferrell <josh@vector35.com>2025-09-29 15:08:06 -0400
commitfd5a89e174e01b0adb089dcf8f6da36cf5008443 (patch)
tree25f66fa722f8759a817a053580f2461309ac448e
parent4870c90e6fbf31898c57db04f97c69f647157fd5 (diff)
Fix rust warnings about lifetimes introduced by 1.89.0
-rw-r--r--rust/src/architecture.rs40
-rw-r--r--rust/src/basic_block.rs4
-rw-r--r--rust/src/low_level_il.rs2
-rw-r--r--rust/src/low_level_il/function.rs14
-rw-r--r--rust/src/low_level_il/lifting.rs22
-rw-r--r--rust/src/project.rs2
-rw-r--r--rust/src/rc.rs4
7 files changed, 44 insertions, 44 deletions
diff --git a/rust/src/architecture.rs b/rust/src/architecture.rs
index 1f37a4df..0a6e4f82 100644
--- a/rust/src/architecture.rs
+++ b/rust/src/architecture.rs
@@ -313,7 +313,7 @@ pub trait RegisterInfo: Sized {
pub trait Register: Debug + Sized + Clone + Copy + Hash + Eq {
type InfoType: RegisterInfo<RegType = Self>;
- fn name(&self) -> Cow<str>;
+ fn name(&self) -> Cow<'_, str>;
fn info(&self) -> Self::InfoType;
/// Unique identifier for this `Register`.
@@ -341,7 +341,7 @@ pub trait RegisterStack: Debug + Sized + Clone + Copy {
type RegType: Register<InfoType = Self::RegInfoType>;
type RegInfoType: RegisterInfo<RegType = Self::RegType>;
- fn name(&self) -> Cow<str>;
+ fn name(&self) -> Cow<'_, str>;
fn info(&self) -> Self::InfoType;
/// Unique identifier for this `RegisterStack`.
@@ -353,7 +353,7 @@ pub trait RegisterStack: Debug + Sized + Clone + Copy {
pub trait Flag: Debug + Sized + Clone + Copy + Hash + Eq {
type FlagClass: FlagClass;
- fn name(&self) -> Cow<str>;
+ fn name(&self) -> Cow<'_, str>;
fn role(&self, class: Option<Self::FlagClass>) -> FlagRole;
/// Unique identifier for this `Flag`.
@@ -366,7 +366,7 @@ pub trait FlagWrite: Sized + Clone + Copy {
type FlagType: Flag;
type FlagClass: FlagClass;
- fn name(&self) -> Cow<str>;
+ fn name(&self) -> Cow<'_, str>;
fn class(&self) -> Option<Self::FlagClass>;
/// Unique identifier for this `FlagWrite`.
@@ -379,7 +379,7 @@ pub trait FlagWrite: Sized + Clone + Copy {
}
pub trait FlagClass: Sized + Clone + Copy + Hash + Eq {
- fn name(&self) -> Cow<str>;
+ fn name(&self) -> Cow<'_, str>;
/// Unique identifier for this `FlagClass`.
///
@@ -392,7 +392,7 @@ pub trait FlagGroup: Debug + Sized + Clone + Copy {
type FlagType: Flag;
type FlagClass: FlagClass;
- fn name(&self) -> Cow<str>;
+ fn name(&self) -> Cow<'_, str>;
/// Unique identifier for this `FlagGroup`.
///
@@ -427,7 +427,7 @@ pub trait FlagGroup: Debug + Sized + Clone + Copy {
}
pub trait Intrinsic: Debug + Sized + Clone + Copy {
- fn name(&self) -> Cow<str>;
+ fn name(&self) -> Cow<'_, str>;
/// Unique identifier for this `Intrinsic`.
fn id(&self) -> IntrinsicId;
@@ -704,7 +704,7 @@ impl<R: Register> RegisterStack for UnusedRegisterStack<R> {
type RegType = R;
type RegInfoType = R::InfoType;
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unreachable!()
}
fn id(&self) -> RegisterStackId {
@@ -721,7 +721,7 @@ pub struct UnusedFlag;
impl Flag for UnusedFlag {
type FlagClass = Self;
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unreachable!()
}
fn role(&self, _class: Option<Self::FlagClass>) -> FlagRole {
@@ -735,7 +735,7 @@ impl Flag for UnusedFlag {
impl FlagWrite for UnusedFlag {
type FlagType = Self;
type FlagClass = Self;
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unreachable!()
}
fn class(&self) -> Option<Self> {
@@ -750,7 +750,7 @@ impl FlagWrite for UnusedFlag {
}
impl FlagClass for UnusedFlag {
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unreachable!()
}
fn id(&self) -> FlagClassId {
@@ -761,7 +761,7 @@ impl FlagClass for UnusedFlag {
impl FlagGroup for UnusedFlag {
type FlagType = Self;
type FlagClass = Self;
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unreachable!()
}
fn id(&self) -> FlagGroupId {
@@ -780,7 +780,7 @@ impl FlagGroup for UnusedFlag {
pub struct UnusedIntrinsic;
impl Intrinsic for UnusedIntrinsic {
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unreachable!()
}
fn id(&self) -> IntrinsicId {
@@ -862,7 +862,7 @@ impl CoreRegister {
impl Register for CoreRegister {
type InfoType = CoreRegisterInfo;
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unsafe {
let name = BNGetArchitectureRegisterName(self.arch.handle, self.id.into());
@@ -988,7 +988,7 @@ impl RegisterStack for CoreRegisterStack {
type RegType = CoreRegister;
type RegInfoType = CoreRegisterInfo;
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unsafe {
let name = BNGetArchitectureRegisterStackName(self.arch.handle, self.id.into());
@@ -1043,7 +1043,7 @@ impl CoreFlag {
impl Flag for CoreFlag {
type FlagClass = CoreFlagClass;
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unsafe {
let name = BNGetArchitectureFlagName(self.arch.handle, self.id.into());
@@ -1103,7 +1103,7 @@ impl FlagWrite for CoreFlagWrite {
type FlagType = CoreFlag;
type FlagClass = CoreFlagClass;
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unsafe {
let name = BNGetArchitectureFlagWriteTypeName(self.arch.handle, self.id.into());
@@ -1187,7 +1187,7 @@ impl CoreFlagClass {
}
impl FlagClass for CoreFlagClass {
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unsafe {
let name = BNGetArchitectureSemanticFlagClassName(self.arch.handle, self.id.into());
@@ -1238,7 +1238,7 @@ impl FlagGroup for CoreFlagGroup {
type FlagType = CoreFlag;
type FlagClass = CoreFlagClass;
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unsafe {
let name = BNGetArchitectureSemanticFlagGroupName(self.arch.handle, self.id.into());
@@ -1336,7 +1336,7 @@ impl CoreIntrinsic {
}
impl Intrinsic for CoreIntrinsic {
- fn name(&self) -> Cow<str> {
+ fn name(&self) -> Cow<'_, str> {
unsafe {
let name = BNGetArchitectureIntrinsicName(self.arch.handle, self.id.into());
diff --git a/rust/src/basic_block.rs b/rust/src/basic_block.rs
index d415b148..90c93ad4 100644
--- a/rust/src/basic_block.rs
+++ b/rust/src/basic_block.rs
@@ -213,7 +213,7 @@ impl<C: BlockContext> BasicBlock<C> {
unsafe { BNGetBasicBlockLength(self.handle) }
}
- pub fn incoming_edges(&self) -> Array<Edge<C>> {
+ pub fn incoming_edges(&self) -> Array<Edge<'_, C>> {
unsafe {
let mut count = 0;
let edges = BNGetBasicBlockIncomingEdges(self.handle, &mut count);
@@ -228,7 +228,7 @@ impl<C: BlockContext> BasicBlock<C> {
}
}
- pub fn outgoing_edges(&self) -> Array<Edge<C>> {
+ pub fn outgoing_edges(&self) -> Array<Edge<'_, C>> {
unsafe {
let mut count = 0;
let edges = BNGetBasicBlockOutgoingEdges(self.handle, &mut count);
diff --git a/rust/src/low_level_il.rs b/rust/src/low_level_il.rs
index 010fa0bc..bb4614ae 100644
--- a/rust/src/low_level_il.rs
+++ b/rust/src/low_level_il.rs
@@ -134,7 +134,7 @@ impl<R: ArchReg> LowLevelILRegisterKind<R> {
}
}
- pub fn name(&self) -> Cow<str> {
+ pub fn name(&self) -> Cow<'_, str> {
match *self {
LowLevelILRegisterKind::Arch(ref r) => r.name(),
LowLevelILRegisterKind::Temp(temp) => Cow::Owned(format!("temp{}", temp.temp_id)),
diff --git a/rust/src/low_level_il/function.rs b/rust/src/low_level_il/function.rs
index ca6508c9..6d2e4239 100644
--- a/rust/src/low_level_il/function.rs
+++ b/rust/src/low_level_il/function.rs
@@ -95,7 +95,7 @@ where
}
}
- pub fn instruction_at<L: Into<Location>>(&self, loc: L) -> Option<LowLevelILInstruction<M, F>> {
+ pub fn instruction_at<L: Into<Location>>(&self, loc: L) -> Option<LowLevelILInstruction<'_, M, F>> {
Some(LowLevelILInstruction::new(
self,
self.instruction_index_at(loc)?,
@@ -103,7 +103,7 @@ where
}
/// Get all the instructions for a given location.
- pub fn instructions_at<L: Into<Location>>(&self, loc: L) -> Vec<LowLevelILInstruction<M, F>> {
+ pub fn instructions_at<L: Into<Location>>(&self, loc: L) -> Vec<LowLevelILInstruction<'_, M, F>> {
let loc = loc.into();
self.instruction_indexes_at(loc)
.iter()
@@ -146,7 +146,7 @@ where
pub fn instruction_from_index(
&self,
index: LowLevelInstructionIndex,
- ) -> Option<LowLevelILInstruction<M, F>> {
+ ) -> Option<LowLevelILInstruction<'_, M, F>> {
if index.0 >= self.instruction_count() {
None
} else {
@@ -178,7 +178,7 @@ where
}
}
- pub fn basic_blocks(&self) -> Array<BasicBlock<LowLevelILBlock<M, F>>> {
+ pub fn basic_blocks(&self) -> Array<BasicBlock<LowLevelILBlock<'_, M, F>>> {
use binaryninjacore_sys::BNGetLowLevelILBasicBlockList;
unsafe {
@@ -195,7 +195,7 @@ where
pub fn basic_block_containing_index(
&self,
index: LowLevelInstructionIndex,
- ) -> Option<Ref<BasicBlock<LowLevelILBlock<M, F>>>> {
+ ) -> Option<Ref<BasicBlock<LowLevelILBlock<'_, M, F>>>> {
let block = unsafe { BNGetLowLevelILBasicBlockForInstruction(self.handle, index.0) };
if block.is_null() {
None
@@ -259,7 +259,7 @@ impl<M: FunctionMutability> LowLevelILFunction<M, SSA> {
pub fn get_ssa_register_uses<R: ArchReg>(
&self,
reg: LowLevelILSSARegisterKind<R>,
- ) -> Vec<LowLevelILInstruction<M, SSA>> {
+ ) -> Vec<LowLevelILInstruction<'_, M, SSA>> {
use binaryninjacore_sys::BNGetLowLevelILSSARegisterUses;
let register_id = match reg {
LowLevelILSSARegisterKind::Full { kind, .. } => kind.id(),
@@ -287,7 +287,7 @@ impl<M: FunctionMutability> LowLevelILFunction<M, SSA> {
pub fn get_ssa_register_definition<R: ArchReg>(
&self,
reg: &LowLevelILSSARegisterKind<R>,
- ) -> Option<LowLevelILInstruction<M, SSA>> {
+ ) -> Option<LowLevelILInstruction<'_, M, SSA>> {
use binaryninjacore_sys::BNGetLowLevelILSSARegisterDefinition;
let register_id = match reg {
LowLevelILSSARegisterKind::Full { kind, .. } => kind.id(),
diff --git a/rust/src/low_level_il/lifting.rs b/rust/src/low_level_il/lifting.rs
index acb21301..09117150 100644
--- a/rust/src/low_level_il/lifting.rs
+++ b/rust/src/low_level_il/lifting.rs
@@ -803,7 +803,7 @@ impl<'a> LiftableLowLevelILWithSize<'a> for ExpressionBuilder<'a, ValueExpr> {
macro_rules! no_arg_lifter {
($name:ident, $op:ident, $result:ty) => {
- pub fn $name(&self) -> LowLevelILExpression<Mutable, NonSSA, $result> {
+ pub fn $name(&self) -> LowLevelILExpression<'_, Mutable, NonSSA, $result> {
use binaryninjacore_sys::BNLowLevelILAddExpr;
use binaryninjacore_sys::BNLowLevelILOperation::$op;
@@ -816,7 +816,7 @@ macro_rules! no_arg_lifter {
macro_rules! sized_no_arg_lifter {
($name:ident, $op:ident, $result:ty) => {
- pub fn $name(&self, size: usize) -> ExpressionBuilder<$result> {
+ pub fn $name(&self, size: usize) -> ExpressionBuilder<'_, $result> {
use binaryninjacore_sys::BNLowLevelILOperation::$op;
ExpressionBuilder {
@@ -1006,7 +1006,7 @@ impl LowLevelILMutableFunction {
true
}
- pub fn const_int(&self, size: usize, val: u64) -> LowLevelILMutableExpression<ValueExpr> {
+ pub fn const_int(&self, size: usize, val: u64) -> LowLevelILMutableExpression<'_, ValueExpr> {
use binaryninjacore_sys::BNLowLevelILAddExpr;
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_CONST;
@@ -1016,7 +1016,7 @@ impl LowLevelILMutableFunction {
LowLevelILExpression::new(self, LowLevelExpressionIndex(expr_idx))
}
- pub fn const_ptr_sized(&self, size: usize, val: u64) -> LowLevelILMutableExpression<ValueExpr> {
+ pub fn const_ptr_sized(&self, size: usize, val: u64) -> LowLevelILMutableExpression<'_, ValueExpr> {
use binaryninjacore_sys::BNLowLevelILAddExpr;
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_CONST_PTR;
@@ -1026,11 +1026,11 @@ impl LowLevelILMutableFunction {
LowLevelILExpression::new(self, LowLevelExpressionIndex(expr_idx))
}
- pub fn const_ptr(&self, val: u64) -> LowLevelILMutableExpression<ValueExpr> {
+ pub fn const_ptr(&self, val: u64) -> LowLevelILMutableExpression<'_, ValueExpr> {
self.const_ptr_sized(self.arch().address_size(), val)
}
- pub fn trap(&self, val: u64) -> LowLevelILExpression<Mutable, NonSSA, VoidExpr> {
+ pub fn trap(&self, val: u64) -> LowLevelILExpression<'_, Mutable, NonSSA, VoidExpr> {
use binaryninjacore_sys::BNLowLevelILAddExpr;
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_TRAP;
@@ -1119,7 +1119,7 @@ impl LowLevelILMutableFunction {
&self,
size: usize,
reg: LR,
- ) -> LowLevelILMutableExpression<ValueExpr> {
+ ) -> LowLevelILMutableExpression<'_, ValueExpr> {
use binaryninjacore_sys::BNLowLevelILAddExpr;
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_REG;
@@ -1137,7 +1137,7 @@ impl LowLevelILMutableFunction {
size: usize,
hi_reg: LR,
lo_reg: LR,
- ) -> LowLevelILMutableExpression<ValueExpr> {
+ ) -> LowLevelILMutableExpression<'_, ValueExpr> {
use binaryninjacore_sys::BNLowLevelILAddExpr;
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_REG_SPLIT;
@@ -1226,7 +1226,7 @@ impl LowLevelILMutableFunction {
}
}
- pub fn flag(&self, flag: impl Flag) -> LowLevelILMutableExpression<ValueExpr> {
+ pub fn flag(&self, flag: impl Flag) -> LowLevelILMutableExpression<'_, ValueExpr> {
use binaryninjacore_sys::BNLowLevelILAddExpr;
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_FLAG;
@@ -1238,7 +1238,7 @@ impl LowLevelILMutableFunction {
LowLevelILExpression::new(self, LowLevelExpressionIndex(expr_idx))
}
- pub fn flag_cond(&self, cond: FlagCondition) -> LowLevelILMutableExpression<ValueExpr> {
+ pub fn flag_cond(&self, cond: FlagCondition) -> LowLevelILMutableExpression<'_, ValueExpr> {
use binaryninjacore_sys::BNLowLevelILAddExpr;
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_FLAG_COND;
@@ -1249,7 +1249,7 @@ impl LowLevelILMutableFunction {
LowLevelILExpression::new(self, LowLevelExpressionIndex(expr_idx))
}
- pub fn flag_group(&self, group: impl FlagGroup) -> LowLevelILMutableExpression<ValueExpr> {
+ pub fn flag_group(&self, group: impl FlagGroup) -> LowLevelILMutableExpression<'_, ValueExpr> {
use binaryninjacore_sys::BNLowLevelILAddExpr;
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_FLAG_GROUP;
diff --git a/rust/src/project.rs b/rust/src/project.rs
index c268d613..4f91010d 100644
--- a/rust/src/project.rs
+++ b/rust/src/project.rs
@@ -612,7 +612,7 @@ impl Project {
/// }
/// ```
// NOTE mut is used here, so only one lock can be acquired at once
- pub fn bulk_operation(&mut self) -> Result<ProjectBulkOperationLock, ()> {
+ pub fn bulk_operation(&mut self) -> Result<ProjectBulkOperationLock<'_>, ()> {
Ok(ProjectBulkOperationLock::lock(self))
}
}
diff --git a/rust/src/rc.rs b/rust/src/rc.rs
index f6abb036..71d72ceb 100644
--- a/rust/src/rc.rs
+++ b/rust/src/rc.rs
@@ -258,7 +258,7 @@ impl<P: CoreArrayProviderInner> Array<P> {
}
}
- pub fn iter(&self) -> ArrayIter<P> {
+ pub fn iter(&self) -> ArrayIter<'_, P> {
ArrayIter {
it: unsafe { slice::from_raw_parts(self.contents, self.count).iter() },
context: &self.context,
@@ -347,7 +347,7 @@ impl<P: CoreArrayProviderInner> ArrayGuard<P> {
}
}
- pub fn iter(&self) -> ArrayIter<P> {
+ pub fn iter(&self) -> ArrayIter<'_, P> {
ArrayIter {
it: unsafe { slice::from_raw_parts(self.contents, self.count).iter() },
context: &self.context,