diff --git a/Cargo.toml b/Cargo.toml index 7e15844..dcad106 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,3 +26,4 @@ runtime-dispatch-simd = ["bytecount/runtime-dispatch-simd"] bytecount = "^0.6" memchr = ">=1.0.1, <3.0.0" # ^1.0.0 + ^2.0 nom = { version = "5.0.0", default-features = false } +stable_deref_trait = "^1" diff --git a/src/lib.rs b/src/lib.rs index f9259b5..d5ccc56 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -114,6 +114,7 @@ use nom::{ AsBytes, Compare, CompareResult, Err, FindSubstring, FindToken, IResult, InputIter, InputLength, InputTake, InputTakeAtPosition, Offset, ParseTo, Slice, }; +use stable_deref_trait::StableDeref; /// A LocatedSpan is a set of meta information about the location of a token, including extra /// information. @@ -146,6 +147,8 @@ impl core::ops::Deref for LocatedSpan { } } +unsafe impl StableDeref for LocatedSpan {} + impl LocatedSpan { /// Create a span for a particular input with default `offset` and /// `line` values and empty extra data.