From 36a8edaf4bc71f886dfefa8cbe356005d618d082 Mon Sep 17 00:00:00 2001 From: Jack O'Connor Date: Thu, 31 Jul 2025 11:04:59 -0700 Subject: [PATCH] lifetime insanity --- crates/ty_python_semantic/src/types/tuple.rs | 9 ++++++--- crates/ty_python_semantic/src/util/subscript.rs | 17 +++++++++++------ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/crates/ty_python_semantic/src/types/tuple.rs b/crates/ty_python_semantic/src/types/tuple.rs index 243a83b11c..34cee31a4e 100644 --- a/crates/ty_python_semantic/src/types/tuple.rs +++ b/crates/ty_python_semantic/src/types/tuple.rs @@ -490,13 +490,16 @@ impl<'db> PyIndex<'db> for &FixedLengthTuple> { impl<'db> PySlice<'db> for FixedLengthTuple> { type Item = Type<'db>; - fn py_slice( - &'db self, + fn py_slice<'self_>( + &'self_ self, db: &'db dyn Db, start: Option, stop: Option, step: Option, - ) -> Result, StepSizeZeroError> { + ) -> Result, StepSizeZeroError> + where + 'db: 'self_, + { self.0.py_slice(db, start, stop, step) } } diff --git a/crates/ty_python_semantic/src/util/subscript.rs b/crates/ty_python_semantic/src/util/subscript.rs index 3f05384d8e..350d940774 100644 --- a/crates/ty_python_semantic/src/util/subscript.rs +++ b/crates/ty_python_semantic/src/util/subscript.rs @@ -110,25 +110,30 @@ pub(crate) struct StepSizeZeroError; pub(crate) trait PySlice<'db> { type Item: 'db; - fn py_slice( - &'db self, + fn py_slice<'self_>( + &'self_ self, db: &'db dyn Db, start: Option, stop: Option, step: Option, - ) -> Result, StepSizeZeroError>; + ) -> Result, StepSizeZeroError> + where + 'db: 'self_; } impl<'db, T: 'db> PySlice<'db> for [T] { type Item = T; - fn py_slice( - &'db self, + fn py_slice<'self_>( + &'self_ self, _db: &'db dyn Db, start: Option, stop: Option, step_int: Option, - ) -> Result, StepSizeZeroError> { + ) -> Result, StepSizeZeroError> + where + 'db: 'self_, + { let step_int = step_int.unwrap_or(1); if step_int == 0 { return Err(StepSizeZeroError);