Skip to content

Commit c41f16b

Browse files
authored
Merge pull request #1362 from sporksmith/tpp-slice
TypedPluginPtr::slice : allow empty slice at end of range
2 parents 77aee74 + b93a8cb commit c41f16b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/main/host/syscall_types.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,11 @@ impl<T> TypedPluginPtr<T> {
228228
Bound::Excluded(s) => s + 1,
229229
Bound::Unbounded => 0,
230230
};
231+
assert!(included_start <= excluded_end);
231232
assert!(excluded_end <= self.count);
232-
assert!(included_start < self.count);
233+
// `<=` rather than `<`, to allow empty slice at end of ptr.
234+
// e.g. `assert_eq!(&[1,2,3][3..3], &[])` passes.
235+
assert!(included_start <= self.count);
233236
TypedPluginPtr {
234237
base: PluginPtr {
235238
ptr: c::PluginPtr {

0 commit comments

Comments
 (0)