Fix lifetimes in the compare functions.
This commit is contained in:
@@ -16,9 +16,9 @@ fn is_slice_of(parent: &str, child: &str) -> bool {
|
||||
/// Get the byte offset into source that the rust object exists at.
|
||||
///
|
||||
/// These offsets are zero-based unlike the elisp ones.
|
||||
fn get_rust_byte_offsets<'s, S: StandardProperties<'s> + ?Sized>(
|
||||
fn get_rust_byte_offsets<'b, 's, S: StandardProperties<'s> + ?Sized>(
|
||||
original_document: &'s str,
|
||||
rust_ast_node: &'s S,
|
||||
rust_ast_node: &'b S,
|
||||
) -> (usize, usize) {
|
||||
let rust_object_source = rust_ast_node.get_source();
|
||||
debug_assert!(is_slice_of(original_document, rust_object_source));
|
||||
@@ -28,12 +28,13 @@ fn get_rust_byte_offsets<'s, S: StandardProperties<'s> + ?Sized>(
|
||||
}
|
||||
|
||||
pub(crate) fn compare_standard_properties<
|
||||
'b,
|
||||
's,
|
||||
S: GetStandardProperties<'s> + GetElispFact<'s> + ?Sized,
|
||||
>(
|
||||
original_document: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s S,
|
||||
emacs: &'b Token<'s>,
|
||||
rust: &'b S,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
assert_name(emacs, rust.get_elisp_fact().get_elisp_name())?;
|
||||
assert_bounds(original_document, emacs, rust.get_standard_properties())?;
|
||||
@@ -63,10 +64,10 @@ pub(crate) fn assert_name<'s, S: AsRef<str>>(
|
||||
/// Assert that the character ranges defined by upstream org-mode's :standard-properties match the slices in Organic's StandardProperties.
|
||||
///
|
||||
/// This does **not** handle plain text because plain text is a special case.
|
||||
pub(crate) fn assert_bounds<'s, S: StandardProperties<'s> + ?Sized>(
|
||||
pub(crate) fn assert_bounds<'b, 's, S: StandardProperties<'s> + ?Sized>(
|
||||
original_document: &'s str,
|
||||
emacs: &'s Token<'s>,
|
||||
rust: &'s S,
|
||||
emacs: &'b Token<'s>,
|
||||
rust: &'b S,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let standard_properties = get_emacs_standard_properties(emacs)?; // 1-based
|
||||
let (begin, end) = (
|
||||
|
||||
Reference in New Issue
Block a user