Skip to content

Commit 1d847ca

Browse files
committed
Update to current Rust nightly
Notably, this lets us use bytestring literals (with a slightly awkward double-cast).
1 parent 9d28020 commit 1d847ca

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/bash.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
extern crate libc;
1+
#![allow(non_camel_case_types, dead_code)]
22

3-
// command.h
3+
extern crate libc;
44

55
#[repr(C)]
66
pub struct word_desc {
@@ -15,7 +15,7 @@ pub struct word_list {
1515

1616
// general.h
1717

18-
type sh_builtin_func_t = extern fn (*mut word_list) -> libc::c_int;
18+
pub type sh_builtin_func_t = extern fn (*mut word_list) -> libc::c_int;
1919

2020
// builtins.h
2121

src/lib.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1+
#![feature(libc)]
2+
13
extern crate libc;
4+
25
mod bash;
36

4-
extern fn builtin_lulz(args: *mut bash::word_list) -> libc::c_int {
7+
extern fn builtin_lulz(_: *mut bash::word_list) -> libc::c_int {
58
println!("lulz");
69
0
710
}
811

912
#[no_mangle]
1013
pub static mut lulz_struct: bash::builtin = bash::builtin {
11-
name: &['l' as i8, 'u' as i8, 'l' as i8, 'z' as i8, 0 as i8] as *const i8,
14+
name: b"lulz\0" as *const u8 as *const libc::c_char,
1215
function: builtin_lulz,
1316
flags: bash::BUILTIN_ENABLED,
14-
long_doc: 0 as *const *const i8,
15-
short_doc: &['l' as i8, 'o' as i8, 'l' as i8, 'w' as i8, 'u' as i8, 't' as i8, 0 as i8] as *const i8,
17+
long_doc: 0 as *const *const libc::c_char,
18+
short_doc: b"lolwut\0" as *const u8 as *const libc::c_char,
1619
handle: 0 as *const i8,
1720
};

0 commit comments

Comments
 (0)