Skip to content

Commit 678500b

Browse files
committed
stop using a couple unstable features
It would be nice to build on stable Rust. In particular, I'm hitting compiler bugs in Rust nightly, such at this one: rust-lang/rust#38177 I imagine beta/stable compilers would be less problematic. These two features were easy to get rid of: * alloc was used to get a Box<[u8]> to uninitialized memory. Looks like that's possible with Vec. * box_syntax wasn't actually used at all. (Maybe a leftover from something.) The remaining features are: * plugin, for clippy. rust-lang/rust#29597 I could easily gate it with a "nightly" cargo feature. * proc_macro, for serde_derive. rust-lang/rust#35900 serde does support stable rust, although it's annoying. https://serde.rs/codegen-stable.html I might just wait a bit; this feature looks like it's getting close to stabilization.
1 parent 474b540 commit 678500b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/main.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@
2929
// along with this program. If not, see <http://www.gnu.org/licenses/>.
3030

3131
#![cfg_attr(test, feature(test))]
32-
#![feature(alloc, box_syntax, conservative_impl_trait, plugin, proc_macro)]
32+
#![feature(conservative_impl_trait, plugin, proc_macro)]
3333
#![plugin(clippy)]
3434

35-
extern crate alloc;
3635
extern crate byteorder;
3736
extern crate core;
3837
#[macro_use] extern crate chan;

src/mp4.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
extern crate byteorder;
8080
extern crate time;
8181

82-
use alloc::raw_vec::RawVec;
8382
use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
8483
use db;
8584
use dir;
@@ -366,7 +365,11 @@ impl Mp4Segment {
366365
let stsz_len = mem::size_of::<u32>() * s.frames as usize;
367366
let stss_len = mem::size_of::<u32>() * s.key_frames as usize;
368367
let len = stts_len + stsz_len + stss_len;
369-
let mut buf = unsafe { RawVec::with_capacity(len).into_box() };
368+
let mut buf = unsafe {
369+
let mut v = Vec::with_capacity(len);
370+
v.set_len(len);
371+
v.into_boxed_slice()
372+
};
370373
{
371374
let (stts, mut rest) = buf.split_at_mut(stts_len);
372375
let (stsz, stss) = rest.split_at_mut(stsz_len);

0 commit comments

Comments
 (0)