Skip to content

Commit 277849f

Browse files
committed
fix: do not rely on the new range feature
1 parent 530ebcd commit 277849f

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

raw_struct/src/builtins/array.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[cfg(feature = "alloc")]
2+
use core::ops::Range;
13
use core::{
24
self,
35
mem,
@@ -36,7 +38,7 @@ impl<T: CopyConstructable> dyn Array<T> {
3638
pub fn elements<M: MemoryView>(
3739
&self,
3840
memory: &M,
39-
range: crate::Range<usize>,
41+
range: Range<usize>,
4042
) -> Result<alloc::vec::Vec<T>, M::AccessError> {
4143
let element_count = range.end - range.start;
4244
let mut result = alloc::vec::Vec::with_capacity(element_count);
@@ -66,7 +68,7 @@ impl<T: SizedViewable> dyn Array<T> {
6668
pub fn elements_reference<M: MemoryView + Clone>(
6769
&self,
6870
memory: M,
69-
range: core::range::legacy::Range<usize>,
71+
range: Range<usize>,
7072
) -> alloc::vec::Vec<Reference<T, M>> {
7173
alloc::vec::Vec::from_iter(range.map(|index| {
7274
Reference::new(
@@ -89,7 +91,7 @@ impl<T: SizedViewable> dyn Array<T> {
8991
pub fn elements_copy<M: MemoryView>(
9092
&self,
9193
memory: &M,
92-
range: crate::Range<usize>,
94+
range: Range<usize>,
9395
) -> Result<alloc::vec::Vec<Copy<T>>, M::AccessError> {
9496
let element_count = range.end - range.start;
9597
let mut result = alloc::vec::Vec::<T::Memory>::with_capacity(element_count);

raw_struct/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
#![feature(new_range_api)]
21
#![cfg_attr(not(feature = "std"), no_std)]
32

43
#[cfg(feature = "alloc")]
54
extern crate alloc;
65

7-
#[cfg(all(feature = "alloc", not(feature = "std")))]
8-
pub(crate) use core::range::Range;
9-
#[cfg(all(feature = "std"))]
10-
pub(crate) use std::range::Range;
11-
126
pub mod builtins;
137

148
mod error;

0 commit comments

Comments
 (0)