From 886eab5c7ee26cb2535b7a46050a628411561ae9 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Sat, 1 Jul 2017 16:47:53 +1000 Subject: [PATCH] Fix build on nightly Nightly recently fixed some soundness issues related to `Sized`. This had to be fixed in the cocoa crates as well, and also affects our ios bindings. --- Cargo.toml | 6 +++--- src/platform/ios/ffi.rs | 2 +- src/platform/macos/window.rs | 18 +++++++----------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 174936f4..022c0fd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,9 +24,9 @@ objc = "0.2" [target.'cfg(target_os = "macos")'.dependencies] objc = "0.2" cgl = "0.2" -cocoa = "=0.5.2" -core-foundation = "0.2" -core-graphics = "0.4" +cocoa = "0.9" +core-foundation = "0.4" +core-graphics = "0.8" [target.'cfg(target_os = "windows")'.dependencies] winapi = "0.2" diff --git a/src/platform/ios/ffi.rs b/src/platform/ios/ffi.rs index 42a946d9..cadc5623 100644 --- a/src/platform/ios/ffi.rs +++ b/src/platform/ios/ffi.rs @@ -66,7 +66,7 @@ extern { pub fn longjmp(env: *mut libc::c_void, val: libc::c_int); } -pub trait NSString { +pub trait NSString: Sized { unsafe fn alloc(_: Self) -> id { msg_send![class("NSString"), alloc] } diff --git a/src/platform/macos/window.rs b/src/platform/macos/window.rs index 8ea04a76..cbd66056 100644 --- a/src/platform/macos/window.rs +++ b/src/platform/macos/window.rs @@ -338,21 +338,17 @@ impl Window { let masks = if screen.is_some() { // Fullscreen window - appkit::NSBorderlessWindowMask as NSUInteger | - appkit::NSResizableWindowMask as NSUInteger | - appkit::NSTitledWindowMask as NSUInteger + appkit::NSBorderlessWindowMask | appkit::NSResizableWindowMask | + appkit::NSTitledWindowMask } else if attrs.decorations { // Window with a titlebar - appkit::NSClosableWindowMask as NSUInteger | - appkit::NSMiniaturizableWindowMask as NSUInteger | - appkit::NSResizableWindowMask as NSUInteger | - appkit::NSTitledWindowMask as NSUInteger + appkit::NSClosableWindowMask | appkit::NSMiniaturizableWindowMask | + appkit::NSResizableWindowMask | appkit::NSTitledWindowMask } else { // Window without a titlebar - appkit::NSClosableWindowMask as NSUInteger | - appkit::NSMiniaturizableWindowMask as NSUInteger | - appkit::NSResizableWindowMask as NSUInteger | - appkit::NSFullSizeContentViewWindowMask as NSUInteger + appkit::NSClosableWindowMask | appkit::NSMiniaturizableWindowMask | + appkit::NSResizableWindowMask | + appkit::NSFullSizeContentViewWindowMask }; let window = IdRef::new(NSWindow::alloc(nil).initWithContentRect_styleMask_backing_defer_(