Skip to content

Commit

Permalink
Update to current Rust nightly
Browse files Browse the repository at this point in the history
Notably, this lets us use bytestring literals (with a slightly awkward
double-cast).
  • Loading branch information
geofft committed Mar 25, 2015
1 parent 9d28020 commit 1d847ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/bash.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate libc;
#![allow(non_camel_case_types, dead_code)]

// command.h
extern crate libc;

#[repr(C)]
pub struct word_desc {
Expand All @@ -15,7 +15,7 @@ pub struct word_list {

// general.h

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

// builtins.h

Expand Down
11 changes: 7 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
#![feature(libc)]

extern crate libc;

mod bash;

extern fn builtin_lulz(args: *mut bash::word_list) -> libc::c_int {
extern fn builtin_lulz(_: *mut bash::word_list) -> libc::c_int {
println!("lulz");
0
}

#[no_mangle]
pub static mut lulz_struct: bash::builtin = bash::builtin {
name: &['l' as i8, 'u' as i8, 'l' as i8, 'z' as i8, 0 as i8] as *const i8,
name: b"lulz\0" as *const u8 as *const libc::c_char,
function: builtin_lulz,
flags: bash::BUILTIN_ENABLED,
long_doc: 0 as *const *const i8,
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,
long_doc: 0 as *const *const libc::c_char,
short_doc: b"lolwut\0" as *const u8 as *const libc::c_char,
handle: 0 as *const i8,
};

0 comments on commit 1d847ca

Please # to comment.