From 1965d9f1a0c2762668d072eba095d50913f1b14c Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Wed, 2 Apr 2014 22:41:45 +0200 Subject: [PATCH] Automated fixes to follow Rust development Applied fixes: *attribute fix (cf mozilla/rust#2569) *New vec library (cf mozilla/rust#12771) --- src/OpenCL/CL.rs | 2 +- src/OpenCL/array.rs | 6 +++--- src/OpenCL/hl.rs | 10 +++++----- src/OpenCL/lib.rs | 14 +++++++------- src/OpenCL/main.rs | 2 +- src/OpenCL/mem.rs | 4 ++-- src/OpenCL/test.rs | 8 ++++---- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/OpenCL/CL.rs b/src/OpenCL/CL.rs index 1479270..348e016 100644 --- a/src/OpenCL/CL.rs +++ b/src/OpenCL/CL.rs @@ -1,4 +1,4 @@ -#[allow(non_camel_case_types)]; +#![allow(non_camel_case_types)] extern crate std; diff --git a/src/OpenCL/array.rs b/src/OpenCL/array.rs index 17c174e..5b94e14 100644 --- a/src/OpenCL/array.rs +++ b/src/OpenCL/array.rs @@ -4,7 +4,7 @@ use CL::*; use CL::ll::*; use mem::*; use std::mem; -use std::vec; +use std::vec::Vec; use std::libc::{size_t, c_void}; use hl::KernelArg; @@ -85,7 +85,7 @@ impl Get, Array3D> for Array3D { fn get(arr: &Array3DCL, f: |offset: size_t, ptr: *mut c_void, size: size_t|) -> Array3D { - let mut v: ~[T] = vec::with_capacity(arr.len()); + let mut v: ~[T] = Vec::with_capacity(arr.len()); unsafe { v.set_len(arr.len()); } @@ -206,7 +206,7 @@ impl Get, Array2D> for Array2D { fn get(arr: &Array2DCL, f: |offset: size_t, ptr: *mut c_void, size: size_t|) -> Array2D { - let mut v: ~[T] = vec::with_capacity(arr.len()); + let mut v: ~[T] = Vec::with_capacity(arr.len()); unsafe { v.set_len(arr.len()) } diff --git a/src/OpenCL/hl.rs b/src/OpenCL/hl.rs index 39f4a93..a0efc60 100644 --- a/src/OpenCL/hl.rs +++ b/src/OpenCL/hl.rs @@ -5,7 +5,7 @@ use CL::*; use CL::ll::*; use error::check; use std::libc; -use std::vec; +use std::vec::Vec; use std::str; use std::mem; use std::cast; @@ -40,7 +40,7 @@ impl Platform { clGetDeviceIDs(self.id, dtype, 0, ptr::null(), (&num_devices)); - let ids = vec::from_elem(num_devices as uint, 0 as cl_device_id); + let ids = Vec::from_elem(num_devices as uint, 0 as cl_device_id); clGetDeviceIDs(self.id, dtype, ids.len() as cl_uint, ids.as_ptr(), (&num_devices)); ids.map(|id| { Device {id: *id }}) @@ -128,7 +128,7 @@ pub fn get_platforms() -> ~[Platform] // unlock this before the check in case the check fails check(status, "could not get platform count."); - let ids = vec::from_elem(num_platforms as uint, 0 as cl_platform_id); + let ids = Vec::from_elem(num_platforms as uint, 0 as cl_platform_id); let status = clGetPlatformIDs(ids.len() as cl_uint, ids.as_ptr(), @@ -157,7 +157,7 @@ impl Device { (&mut size)); check(status, "Could not determine name length"); - let mut buf = vec::from_elem(size as uint, 0); + let mut buf = Vec::from_elem(size as uint, 0); let status = clGetDeviceInfo( self.id, @@ -478,7 +478,7 @@ impl Program (&mut size)); check(status, "Could not get build log"); - let mut buf = vec::from_elem(size as uint, 0u8); + let mut buf = Vec::from_elem(size as uint, 0u8); let status = clGetProgramBuildInfo( self.prg, device.id, diff --git a/src/OpenCL/lib.rs b/src/OpenCL/lib.rs index c72f867..13cb208 100644 --- a/src/OpenCL/lib.rs +++ b/src/OpenCL/lib.rs @@ -1,10 +1,10 @@ -#[crate_id = "OpenCL#0.2"]; -#[crate_type = "lib"]; -#[feature(macro_rules)]; -#[feature(globs)]; -#[feature(managed_boxes)]; -#[feature(link_args)]; -#[feature(phase)]; +#![crate_id = "OpenCL#0.2"] +#![crate_type = "lib"] +#![feature(macro_rules)] +#![feature(globs)] +#![feature(managed_boxes)] +#![feature(link_args)] +#![feature(phase)] //! OpenCL bindings for Rust. diff --git a/src/OpenCL/main.rs b/src/OpenCL/main.rs index 3f08428..164d74f 100644 --- a/src/OpenCL/main.rs +++ b/src/OpenCL/main.rs @@ -1,4 +1,4 @@ -#[feature(link_args)]; +#![feature(link_args)] extern crate OpenCL; use std::io::fs::File; diff --git a/src/OpenCL/mem.rs b/src/OpenCL/mem.rs index 77b6838..f2cd90c 100644 --- a/src/OpenCL/mem.rs +++ b/src/OpenCL/mem.rs @@ -3,7 +3,7 @@ use std::libc::{size_t, c_void}; use std::mem; use std::ptr; -use std::vec; +use std::vec::Vec; use std::num::zero; use CL::*; @@ -127,7 +127,7 @@ impl Get, T> for ~[T] { fn get(mem: &CLBuffer, f: |offset: size_t, ptr: *mut c_void, size: size_t|) -> ~[T] { - let mut v: ~[T] = vec::with_capacity(mem.len()); + let mut v: ~[T] = Vec::with_capacity(mem.len()); unsafe { v.set_len(mem.len()); } diff --git a/src/OpenCL/test.rs b/src/OpenCL/test.rs index ab00657..ec3b4f2 100644 --- a/src/OpenCL/test.rs +++ b/src/OpenCL/test.rs @@ -1,6 +1,6 @@ -#[feature(link_args)]; -#[feature(macro_rules)]; -#[feature(globs)]; +#![feature(link_args)] +#![feature(macro_rules)] +#![feature(globs)] extern crate std; extern crate OpenCL = "OpenCL#0.2"; @@ -43,7 +43,7 @@ pub fn test_all_platforms_devices(test: |Device, Context, CommandQueue|) } mod mem { - use std::vec; + use std::vec::Vec; use OpenCL::mem::{Read, Write}; fn read_write(src: &W, dst: &mut R)