Skip to content

Commit fd5a89e

Browse files
committed
Fix rust warnings about lifetimes introduced by 1.89.0
1 parent 4870c90 commit fd5a89e

File tree

7 files changed

+44
-44
lines changed

7 files changed

+44
-44
lines changed

rust/src/architecture.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ pub trait RegisterInfo: Sized {
313313
pub trait Register: Debug + Sized + Clone + Copy + Hash + Eq {
314314
type InfoType: RegisterInfo<RegType = Self>;
315315

316-
fn name(&self) -> Cow<str>;
316+
fn name(&self) -> Cow<'_, str>;
317317
fn info(&self) -> Self::InfoType;
318318

319319
/// Unique identifier for this `Register`.
@@ -341,7 +341,7 @@ pub trait RegisterStack: Debug + Sized + Clone + Copy {
341341
type RegType: Register<InfoType = Self::RegInfoType>;
342342
type RegInfoType: RegisterInfo<RegType = Self::RegType>;
343343

344-
fn name(&self) -> Cow<str>;
344+
fn name(&self) -> Cow<'_, str>;
345345
fn info(&self) -> Self::InfoType;
346346

347347
/// Unique identifier for this `RegisterStack`.
@@ -353,7 +353,7 @@ pub trait RegisterStack: Debug + Sized + Clone + Copy {
353353
pub trait Flag: Debug + Sized + Clone + Copy + Hash + Eq {
354354
type FlagClass: FlagClass;
355355

356-
fn name(&self) -> Cow<str>;
356+
fn name(&self) -> Cow<'_, str>;
357357
fn role(&self, class: Option<Self::FlagClass>) -> FlagRole;
358358

359359
/// Unique identifier for this `Flag`.
@@ -366,7 +366,7 @@ pub trait FlagWrite: Sized + Clone + Copy {
366366
type FlagType: Flag;
367367
type FlagClass: FlagClass;
368368

369-
fn name(&self) -> Cow<str>;
369+
fn name(&self) -> Cow<'_, str>;
370370
fn class(&self) -> Option<Self::FlagClass>;
371371

372372
/// Unique identifier for this `FlagWrite`.
@@ -379,7 +379,7 @@ pub trait FlagWrite: Sized + Clone + Copy {
379379
}
380380

381381
pub trait FlagClass: Sized + Clone + Copy + Hash + Eq {
382-
fn name(&self) -> Cow<str>;
382+
fn name(&self) -> Cow<'_, str>;
383383

384384
/// Unique identifier for this `FlagClass`.
385385
///
@@ -392,7 +392,7 @@ pub trait FlagGroup: Debug + Sized + Clone + Copy {
392392
type FlagType: Flag;
393393
type FlagClass: FlagClass;
394394

395-
fn name(&self) -> Cow<str>;
395+
fn name(&self) -> Cow<'_, str>;
396396

397397
/// Unique identifier for this `FlagGroup`.
398398
///
@@ -427,7 +427,7 @@ pub trait FlagGroup: Debug + Sized + Clone + Copy {
427427
}
428428

429429
pub trait Intrinsic: Debug + Sized + Clone + Copy {
430-
fn name(&self) -> Cow<str>;
430+
fn name(&self) -> Cow<'_, str>;
431431

432432
/// Unique identifier for this `Intrinsic`.
433433
fn id(&self) -> IntrinsicId;
@@ -704,7 +704,7 @@ impl<R: Register> RegisterStack for UnusedRegisterStack<R> {
704704
type RegType = R;
705705
type RegInfoType = R::InfoType;
706706

707-
fn name(&self) -> Cow<str> {
707+
fn name(&self) -> Cow<'_, str> {
708708
unreachable!()
709709
}
710710
fn id(&self) -> RegisterStackId {
@@ -721,7 +721,7 @@ pub struct UnusedFlag;
721721

722722
impl Flag for UnusedFlag {
723723
type FlagClass = Self;
724-
fn name(&self) -> Cow<str> {
724+
fn name(&self) -> Cow<'_, str> {
725725
unreachable!()
726726
}
727727
fn role(&self, _class: Option<Self::FlagClass>) -> FlagRole {
@@ -735,7 +735,7 @@ impl Flag for UnusedFlag {
735735
impl FlagWrite for UnusedFlag {
736736
type FlagType = Self;
737737
type FlagClass = Self;
738-
fn name(&self) -> Cow<str> {
738+
fn name(&self) -> Cow<'_, str> {
739739
unreachable!()
740740
}
741741
fn class(&self) -> Option<Self> {
@@ -750,7 +750,7 @@ impl FlagWrite for UnusedFlag {
750750
}
751751

752752
impl FlagClass for UnusedFlag {
753-
fn name(&self) -> Cow<str> {
753+
fn name(&self) -> Cow<'_, str> {
754754
unreachable!()
755755
}
756756
fn id(&self) -> FlagClassId {
@@ -761,7 +761,7 @@ impl FlagClass for UnusedFlag {
761761
impl FlagGroup for UnusedFlag {
762762
type FlagType = Self;
763763
type FlagClass = Self;
764-
fn name(&self) -> Cow<str> {
764+
fn name(&self) -> Cow<'_, str> {
765765
unreachable!()
766766
}
767767
fn id(&self) -> FlagGroupId {
@@ -780,7 +780,7 @@ impl FlagGroup for UnusedFlag {
780780
pub struct UnusedIntrinsic;
781781

782782
impl Intrinsic for UnusedIntrinsic {
783-
fn name(&self) -> Cow<str> {
783+
fn name(&self) -> Cow<'_, str> {
784784
unreachable!()
785785
}
786786
fn id(&self) -> IntrinsicId {
@@ -862,7 +862,7 @@ impl CoreRegister {
862862
impl Register for CoreRegister {
863863
type InfoType = CoreRegisterInfo;
864864

865-
fn name(&self) -> Cow<str> {
865+
fn name(&self) -> Cow<'_, str> {
866866
unsafe {
867867
let name = BNGetArchitectureRegisterName(self.arch.handle, self.id.into());
868868

@@ -988,7 +988,7 @@ impl RegisterStack for CoreRegisterStack {
988988
type RegType = CoreRegister;
989989
type RegInfoType = CoreRegisterInfo;
990990

991-
fn name(&self) -> Cow<str> {
991+
fn name(&self) -> Cow<'_, str> {
992992
unsafe {
993993
let name = BNGetArchitectureRegisterStackName(self.arch.handle, self.id.into());
994994

@@ -1043,7 +1043,7 @@ impl CoreFlag {
10431043
impl Flag for CoreFlag {
10441044
type FlagClass = CoreFlagClass;
10451045

1046-
fn name(&self) -> Cow<str> {
1046+
fn name(&self) -> Cow<'_, str> {
10471047
unsafe {
10481048
let name = BNGetArchitectureFlagName(self.arch.handle, self.id.into());
10491049

@@ -1103,7 +1103,7 @@ impl FlagWrite for CoreFlagWrite {
11031103
type FlagType = CoreFlag;
11041104
type FlagClass = CoreFlagClass;
11051105

1106-
fn name(&self) -> Cow<str> {
1106+
fn name(&self) -> Cow<'_, str> {
11071107
unsafe {
11081108
let name = BNGetArchitectureFlagWriteTypeName(self.arch.handle, self.id.into());
11091109

@@ -1187,7 +1187,7 @@ impl CoreFlagClass {
11871187
}
11881188

11891189
impl FlagClass for CoreFlagClass {
1190-
fn name(&self) -> Cow<str> {
1190+
fn name(&self) -> Cow<'_, str> {
11911191
unsafe {
11921192
let name = BNGetArchitectureSemanticFlagClassName(self.arch.handle, self.id.into());
11931193

@@ -1238,7 +1238,7 @@ impl FlagGroup for CoreFlagGroup {
12381238
type FlagType = CoreFlag;
12391239
type FlagClass = CoreFlagClass;
12401240

1241-
fn name(&self) -> Cow<str> {
1241+
fn name(&self) -> Cow<'_, str> {
12421242
unsafe {
12431243
let name = BNGetArchitectureSemanticFlagGroupName(self.arch.handle, self.id.into());
12441244

@@ -1336,7 +1336,7 @@ impl CoreIntrinsic {
13361336
}
13371337

13381338
impl Intrinsic for CoreIntrinsic {
1339-
fn name(&self) -> Cow<str> {
1339+
fn name(&self) -> Cow<'_, str> {
13401340
unsafe {
13411341
let name = BNGetArchitectureIntrinsicName(self.arch.handle, self.id.into());
13421342

rust/src/basic_block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl<C: BlockContext> BasicBlock<C> {
213213
unsafe { BNGetBasicBlockLength(self.handle) }
214214
}
215215

216-
pub fn incoming_edges(&self) -> Array<Edge<C>> {
216+
pub fn incoming_edges(&self) -> Array<Edge<'_, C>> {
217217
unsafe {
218218
let mut count = 0;
219219
let edges = BNGetBasicBlockIncomingEdges(self.handle, &mut count);
@@ -228,7 +228,7 @@ impl<C: BlockContext> BasicBlock<C> {
228228
}
229229
}
230230

231-
pub fn outgoing_edges(&self) -> Array<Edge<C>> {
231+
pub fn outgoing_edges(&self) -> Array<Edge<'_, C>> {
232232
unsafe {
233233
let mut count = 0;
234234
let edges = BNGetBasicBlockOutgoingEdges(self.handle, &mut count);

rust/src/low_level_il.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl<R: ArchReg> LowLevelILRegisterKind<R> {
134134
}
135135
}
136136

137-
pub fn name(&self) -> Cow<str> {
137+
pub fn name(&self) -> Cow<'_, str> {
138138
match *self {
139139
LowLevelILRegisterKind::Arch(ref r) => r.name(),
140140
LowLevelILRegisterKind::Temp(temp) => Cow::Owned(format!("temp{}", temp.temp_id)),

rust/src/low_level_il/function.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ where
9595
}
9696
}
9797

98-
pub fn instruction_at<L: Into<Location>>(&self, loc: L) -> Option<LowLevelILInstruction<M, F>> {
98+
pub fn instruction_at<L: Into<Location>>(&self, loc: L) -> Option<LowLevelILInstruction<'_, M, F>> {
9999
Some(LowLevelILInstruction::new(
100100
self,
101101
self.instruction_index_at(loc)?,
102102
))
103103
}
104104

105105
/// Get all the instructions for a given location.
106-
pub fn instructions_at<L: Into<Location>>(&self, loc: L) -> Vec<LowLevelILInstruction<M, F>> {
106+
pub fn instructions_at<L: Into<Location>>(&self, loc: L) -> Vec<LowLevelILInstruction<'_, M, F>> {
107107
let loc = loc.into();
108108
self.instruction_indexes_at(loc)
109109
.iter()
@@ -146,7 +146,7 @@ where
146146
pub fn instruction_from_index(
147147
&self,
148148
index: LowLevelInstructionIndex,
149-
) -> Option<LowLevelILInstruction<M, F>> {
149+
) -> Option<LowLevelILInstruction<'_, M, F>> {
150150
if index.0 >= self.instruction_count() {
151151
None
152152
} else {
@@ -178,7 +178,7 @@ where
178178
}
179179
}
180180

181-
pub fn basic_blocks(&self) -> Array<BasicBlock<LowLevelILBlock<M, F>>> {
181+
pub fn basic_blocks(&self) -> Array<BasicBlock<LowLevelILBlock<'_, M, F>>> {
182182
use binaryninjacore_sys::BNGetLowLevelILBasicBlockList;
183183

184184
unsafe {
@@ -195,7 +195,7 @@ where
195195
pub fn basic_block_containing_index(
196196
&self,
197197
index: LowLevelInstructionIndex,
198-
) -> Option<Ref<BasicBlock<LowLevelILBlock<M, F>>>> {
198+
) -> Option<Ref<BasicBlock<LowLevelILBlock<'_, M, F>>>> {
199199
let block = unsafe { BNGetLowLevelILBasicBlockForInstruction(self.handle, index.0) };
200200
if block.is_null() {
201201
None
@@ -259,7 +259,7 @@ impl<M: FunctionMutability> LowLevelILFunction<M, SSA> {
259259
pub fn get_ssa_register_uses<R: ArchReg>(
260260
&self,
261261
reg: LowLevelILSSARegisterKind<R>,
262-
) -> Vec<LowLevelILInstruction<M, SSA>> {
262+
) -> Vec<LowLevelILInstruction<'_, M, SSA>> {
263263
use binaryninjacore_sys::BNGetLowLevelILSSARegisterUses;
264264
let register_id = match reg {
265265
LowLevelILSSARegisterKind::Full { kind, .. } => kind.id(),
@@ -287,7 +287,7 @@ impl<M: FunctionMutability> LowLevelILFunction<M, SSA> {
287287
pub fn get_ssa_register_definition<R: ArchReg>(
288288
&self,
289289
reg: &LowLevelILSSARegisterKind<R>,
290-
) -> Option<LowLevelILInstruction<M, SSA>> {
290+
) -> Option<LowLevelILInstruction<'_, M, SSA>> {
291291
use binaryninjacore_sys::BNGetLowLevelILSSARegisterDefinition;
292292
let register_id = match reg {
293293
LowLevelILSSARegisterKind::Full { kind, .. } => kind.id(),

rust/src/low_level_il/lifting.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ impl<'a> LiftableLowLevelILWithSize<'a> for ExpressionBuilder<'a, ValueExpr> {
803803

804804
macro_rules! no_arg_lifter {
805805
($name:ident, $op:ident, $result:ty) => {
806-
pub fn $name(&self) -> LowLevelILExpression<Mutable, NonSSA, $result> {
806+
pub fn $name(&self) -> LowLevelILExpression<'_, Mutable, NonSSA, $result> {
807807
use binaryninjacore_sys::BNLowLevelILAddExpr;
808808
use binaryninjacore_sys::BNLowLevelILOperation::$op;
809809

@@ -816,7 +816,7 @@ macro_rules! no_arg_lifter {
816816

817817
macro_rules! sized_no_arg_lifter {
818818
($name:ident, $op:ident, $result:ty) => {
819-
pub fn $name(&self, size: usize) -> ExpressionBuilder<$result> {
819+
pub fn $name(&self, size: usize) -> ExpressionBuilder<'_, $result> {
820820
use binaryninjacore_sys::BNLowLevelILOperation::$op;
821821

822822
ExpressionBuilder {
@@ -1006,7 +1006,7 @@ impl LowLevelILMutableFunction {
10061006
true
10071007
}
10081008

1009-
pub fn const_int(&self, size: usize, val: u64) -> LowLevelILMutableExpression<ValueExpr> {
1009+
pub fn const_int(&self, size: usize, val: u64) -> LowLevelILMutableExpression<'_, ValueExpr> {
10101010
use binaryninjacore_sys::BNLowLevelILAddExpr;
10111011
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_CONST;
10121012

@@ -1016,7 +1016,7 @@ impl LowLevelILMutableFunction {
10161016
LowLevelILExpression::new(self, LowLevelExpressionIndex(expr_idx))
10171017
}
10181018

1019-
pub fn const_ptr_sized(&self, size: usize, val: u64) -> LowLevelILMutableExpression<ValueExpr> {
1019+
pub fn const_ptr_sized(&self, size: usize, val: u64) -> LowLevelILMutableExpression<'_, ValueExpr> {
10201020
use binaryninjacore_sys::BNLowLevelILAddExpr;
10211021
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_CONST_PTR;
10221022

@@ -1026,11 +1026,11 @@ impl LowLevelILMutableFunction {
10261026
LowLevelILExpression::new(self, LowLevelExpressionIndex(expr_idx))
10271027
}
10281028

1029-
pub fn const_ptr(&self, val: u64) -> LowLevelILMutableExpression<ValueExpr> {
1029+
pub fn const_ptr(&self, val: u64) -> LowLevelILMutableExpression<'_, ValueExpr> {
10301030
self.const_ptr_sized(self.arch().address_size(), val)
10311031
}
10321032

1033-
pub fn trap(&self, val: u64) -> LowLevelILExpression<Mutable, NonSSA, VoidExpr> {
1033+
pub fn trap(&self, val: u64) -> LowLevelILExpression<'_, Mutable, NonSSA, VoidExpr> {
10341034
use binaryninjacore_sys::BNLowLevelILAddExpr;
10351035
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_TRAP;
10361036

@@ -1119,7 +1119,7 @@ impl LowLevelILMutableFunction {
11191119
&self,
11201120
size: usize,
11211121
reg: LR,
1122-
) -> LowLevelILMutableExpression<ValueExpr> {
1122+
) -> LowLevelILMutableExpression<'_, ValueExpr> {
11231123
use binaryninjacore_sys::BNLowLevelILAddExpr;
11241124
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_REG;
11251125

@@ -1137,7 +1137,7 @@ impl LowLevelILMutableFunction {
11371137
size: usize,
11381138
hi_reg: LR,
11391139
lo_reg: LR,
1140-
) -> LowLevelILMutableExpression<ValueExpr> {
1140+
) -> LowLevelILMutableExpression<'_, ValueExpr> {
11411141
use binaryninjacore_sys::BNLowLevelILAddExpr;
11421142
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_REG_SPLIT;
11431143

@@ -1226,7 +1226,7 @@ impl LowLevelILMutableFunction {
12261226
}
12271227
}
12281228

1229-
pub fn flag(&self, flag: impl Flag) -> LowLevelILMutableExpression<ValueExpr> {
1229+
pub fn flag(&self, flag: impl Flag) -> LowLevelILMutableExpression<'_, ValueExpr> {
12301230
use binaryninjacore_sys::BNLowLevelILAddExpr;
12311231
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_FLAG;
12321232

@@ -1238,7 +1238,7 @@ impl LowLevelILMutableFunction {
12381238
LowLevelILExpression::new(self, LowLevelExpressionIndex(expr_idx))
12391239
}
12401240

1241-
pub fn flag_cond(&self, cond: FlagCondition) -> LowLevelILMutableExpression<ValueExpr> {
1241+
pub fn flag_cond(&self, cond: FlagCondition) -> LowLevelILMutableExpression<'_, ValueExpr> {
12421242
use binaryninjacore_sys::BNLowLevelILAddExpr;
12431243
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_FLAG_COND;
12441244

@@ -1249,7 +1249,7 @@ impl LowLevelILMutableFunction {
12491249
LowLevelILExpression::new(self, LowLevelExpressionIndex(expr_idx))
12501250
}
12511251

1252-
pub fn flag_group(&self, group: impl FlagGroup) -> LowLevelILMutableExpression<ValueExpr> {
1252+
pub fn flag_group(&self, group: impl FlagGroup) -> LowLevelILMutableExpression<'_, ValueExpr> {
12531253
use binaryninjacore_sys::BNLowLevelILAddExpr;
12541254
use binaryninjacore_sys::BNLowLevelILOperation::LLIL_FLAG_GROUP;
12551255

rust/src/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ impl Project {
612612
/// }
613613
/// ```
614614
// NOTE mut is used here, so only one lock can be acquired at once
615-
pub fn bulk_operation(&mut self) -> Result<ProjectBulkOperationLock, ()> {
615+
pub fn bulk_operation(&mut self) -> Result<ProjectBulkOperationLock<'_>, ()> {
616616
Ok(ProjectBulkOperationLock::lock(self))
617617
}
618618
}

rust/src/rc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ impl<P: CoreArrayProviderInner> Array<P> {
258258
}
259259
}
260260

261-
pub fn iter(&self) -> ArrayIter<P> {
261+
pub fn iter(&self) -> ArrayIter<'_, P> {
262262
ArrayIter {
263263
it: unsafe { slice::from_raw_parts(self.contents, self.count).iter() },
264264
context: &self.context,
@@ -347,7 +347,7 @@ impl<P: CoreArrayProviderInner> ArrayGuard<P> {
347347
}
348348
}
349349

350-
pub fn iter(&self) -> ArrayIter<P> {
350+
pub fn iter(&self) -> ArrayIter<'_, P> {
351351
ArrayIter {
352352
it: unsafe { slice::from_raw_parts(self.contents, self.count).iter() },
353353
context: &self.context,

0 commit comments

Comments
 (0)