Skip to content

Commit 9d98cba

Browse files
committed
feat: make rftrace-frontend compile on stable
1 parent 57479d4 commit 9d98cba

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

rftrace-frontend/src/frontend.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::fs::File;
22
use std::io::prelude::*;
33
use std::io::{self};
4+
use std::mem;
45

56
use byteorder::{LittleEndian, WriteBytesExt};
67

@@ -56,9 +57,12 @@ pub fn init(max_event_count: usize, overwriting: bool) -> &'static mut Events {
5657
"Event buffer has to be larger than maximum stack height!"
5758
);
5859
let buf = vec![Event::Empty; max_event_count];
60+
// intentionally leak here! stacks have to live until end of application.
61+
let mut buf = mem::ManuallyDrop::new(buf);
62+
let ptr = buf.as_mut_ptr();
63+
let len = buf.len();
64+
let cap = buf.capacity();
5965
unsafe {
60-
// intentionally leak here! stacks have to live until end of application.
61-
let (ptr, len, cap) = buf.into_raw_parts();
6266
rftrace_backend_init(ptr, cap, overwriting);
6367
// TODO: free this leaked box somewhere. Create a drop() function or similar?
6468
Box::leak(Box::new(Events { ptr, len, cap }))

rftrace-frontend/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//! It can initialize an event buffer, enable/disable tracing and save the trace to disk in a uftrace compatible format.
33
//! A lot of documentation can be found in the parent workspaces [readme](https://github.com/hermit-os/rftrace).
44
5-
#![feature(vec_into_raw_parts)]
65
extern crate byteorder;
76

87
mod frontend;

0 commit comments

Comments
 (0)