Skip to content

Commit 36a8eda

Browse files
committed
lifetime insanity
1 parent 6453a0b commit 36a8eda

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

crates/ty_python_semantic/src/types/tuple.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,16 @@ impl<'db> PyIndex<'db> for &FixedLengthTuple<Type<'db>> {
490490
impl<'db> PySlice<'db> for FixedLengthTuple<Type<'db>> {
491491
type Item = Type<'db>;
492492

493-
fn py_slice(
494-
&'db self,
493+
fn py_slice<'self_>(
494+
&'self_ self,
495495
db: &'db dyn Db,
496496
start: Option<i32>,
497497
stop: Option<i32>,
498498
step: Option<i32>,
499-
) -> Result<impl Iterator<Item = &'db Self::Item>, StepSizeZeroError> {
499+
) -> Result<impl Iterator<Item = &'self_ Self::Item>, StepSizeZeroError>
500+
where
501+
'db: 'self_,
502+
{
500503
self.0.py_slice(db, start, stop, step)
501504
}
502505
}

crates/ty_python_semantic/src/util/subscript.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,25 +110,30 @@ pub(crate) struct StepSizeZeroError;
110110
pub(crate) trait PySlice<'db> {
111111
type Item: 'db;
112112

113-
fn py_slice(
114-
&'db self,
113+
fn py_slice<'self_>(
114+
&'self_ self,
115115
db: &'db dyn Db,
116116
start: Option<i32>,
117117
stop: Option<i32>,
118118
step: Option<i32>,
119-
) -> Result<impl Iterator<Item = &'db Self::Item>, StepSizeZeroError>;
119+
) -> Result<impl Iterator<Item = &'self_ Self::Item>, StepSizeZeroError>
120+
where
121+
'db: 'self_;
120122
}
121123

122124
impl<'db, T: 'db> PySlice<'db> for [T] {
123125
type Item = T;
124126

125-
fn py_slice(
126-
&'db self,
127+
fn py_slice<'self_>(
128+
&'self_ self,
127129
_db: &'db dyn Db,
128130
start: Option<i32>,
129131
stop: Option<i32>,
130132
step_int: Option<i32>,
131-
) -> Result<impl Iterator<Item = &'db Self::Item>, StepSizeZeroError> {
133+
) -> Result<impl Iterator<Item = &'self_ Self::Item>, StepSizeZeroError>
134+
where
135+
'db: 'self_,
136+
{
132137
let step_int = step_int.unwrap_or(1);
133138
if step_int == 0 {
134139
return Err(StepSizeZeroError);

0 commit comments

Comments
 (0)