Skip to content

Commit

Permalink
Remove warnings for zero-sized structs servo#89.
Browse files Browse the repository at this point in the history
This follows the servo pattern mentioned in
rust-lang/rust#27303 to replace the zero-sized
structs with an `enum`.
  • Loading branch information
rthomas committed Jul 27, 2017
1 parent aeb8108 commit b0b6dcd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ pub type CGFloat = libc::c_float;

pub type CGError = libc::int32_t;

pub type CGAffineTransform = ();
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum CGAffineTransform {}

pub const kCGImageAlphaNone: u32 = 0;
pub const kCGImageAlphaPremultipliedLast: u32 = 1;
Expand Down
5 changes: 3 additions & 2 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ pub enum CGTextDrawingMode {
CGTextClip
}

#[repr(C)]
pub struct __CGContext;
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum __CGContext {}

pub type CGContextRef = *const __CGContext;

Expand Down
5 changes: 3 additions & 2 deletions src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ use std::ptr;

pub type CGGlyph = libc::c_ushort;

#[repr(C)]
pub struct __CGFont;
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum __CGFont {}

pub type CGFontRef = *const __CGFont;

Expand Down

0 comments on commit b0b6dcd

Please sign in to comment.