Skip to content

Commit ff53ac9

Browse files
committed
---
yaml --- r: 152505 b: refs/heads/try2 c: b7af250 h: refs/heads/master i: 152503: bf98088 v: v3
1 parent ffe88d5 commit ff53ac9

File tree

10 files changed

+38
-23
lines changed

10 files changed

+38
-23
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: f907d9772c55d942fb178622b0b2b5a8ca103c11
8+
refs/heads/try2: b7af25060a1b0451cb06085ba5893980bc4e5333
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libnative/io/c_win32.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,20 @@ pub mod compat {
7777
fn GetProcAddress(hModule: HMODULE, lpProcName: LPCSTR) -> LPVOID;
7878
}
7979

80-
// store_func() is idempotent, so using relaxed ordering for the atomics should be enough.
81-
// This way, calling a function in this compatibility layer (after it's loaded) shouldn't
82-
// be any slower than a regular DLL call.
83-
unsafe fn store_func<T: Copy>(ptr: *mut T, module: &str, symbol: &str, fallback: T) {
80+
// store_func() is idempotent, so using relaxed ordering for the atomics
81+
// should be enough. This way, calling a function in this compatibility
82+
// layer (after it's loaded) shouldn't be any slower than a regular DLL
83+
// call.
84+
unsafe fn store_func(ptr: *mut uint, module: &str, symbol: &str, fallback: uint) {
8485
let module = module.to_utf16().append_one(0);
8586
symbol.with_c_str(|symbol| {
8687
let handle = GetModuleHandleW(module.as_ptr());
87-
let func: Option<T> = transmute(GetProcAddress(handle, symbol));
88-
atomic_store_relaxed(ptr, func.unwrap_or(fallback))
88+
let func: uint = transmute(GetProcAddress(handle, symbol));
89+
atomic_store_relaxed(ptr, if func == 0 {
90+
fallback
91+
} else {
92+
func
93+
})
8994
})
9095
}
9196

@@ -109,10 +114,10 @@ pub mod compat {
109114

110115
extern "system" fn thunk($($argname: $argtype),*) -> $rettype {
111116
unsafe {
112-
::io::c::compat::store_func(&mut ptr,
113-
stringify!($module),
114-
stringify!($symbol),
115-
fallback);
117+
::io::c::compat::store_func(&mut ptr as *mut _ as *mut uint,
118+
stringify!($module),
119+
stringify!($symbol),
120+
fallback as uint);
116121
::std::intrinsics::atomic_load_relaxed(&ptr)($($argname),*)
117122
}
118123
}

branches/try2/src/libstd/dynamic_lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ mod test {
158158
use super::*;
159159
use prelude::*;
160160
use libc;
161+
use mem;
161162

162163
#[test]
163164
#[ignore(cfg(windows))] // FIXME #8818
@@ -174,7 +175,7 @@ mod test {
174175
let cosine: extern fn(libc::c_double) -> libc::c_double = unsafe {
175176
match libm.symbol("cos") {
176177
Err(error) => fail!("Could not load function cos: {}", error),
177-
Ok(cosine) => cosine
178+
Ok(cosine) => mem::transmute::<*u8, _>(cosine)
178179
}
179180
};
180181

branches/try2/src/libstd/io/fs.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,9 @@ mod test {
977977
let result = File::open_mode(filename, Open, Read);
978978

979979
error!(result, "couldn't open file");
980-
error!(result, "no such file or directory");
980+
if cfg!(unix) {
981+
error!(result, "no such file or directory");
982+
}
981983
error!(result, format!("path={}; mode=open; access=read", filename.display()));
982984
})
983985

@@ -988,7 +990,9 @@ mod test {
988990
let result = unlink(filename);
989991

990992
error!(result, "couldn't unlink path");
991-
error!(result, "no such file or directory");
993+
if cfg!(unix) {
994+
error!(result, "no such file or directory");
995+
}
992996
error!(result, format!("path={}", filename.display()));
993997
})
994998

branches/try2/src/libstd/rt/backtrace.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -873,12 +873,12 @@ mod imp {
873873
Err(..) => return Ok(()),
874874
};
875875

876-
macro_rules! sym( ($e:expr, $t:ident) => (
877-
match unsafe { lib.symbol::<$t>($e) } {
878-
Ok(f) => f,
876+
macro_rules! sym( ($e:expr, $t:ident) => (unsafe {
877+
match lib.symbol($e) {
878+
Ok(f) => mem::transmute::<*u8, $t>(f),
879879
Err(..) => return Ok(())
880880
}
881-
) )
881+
}) )
882882

883883
// Fetch the symbols necessary from dbghelp.dll
884884
let SymFromAddr = sym!("SymFromAddr", SymFromAddrFn);

branches/try2/src/test/compile-fail/issue-14845.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn main() {
1717
let x = X { a: [0] };
1818
let _f = &x.a as *mut u8;
1919
//~^ ERROR mismatched types: expected `*mut u8` but found `&[u8, .. 1]`
20-
20+
2121
let local = [0u8];
2222
let _v = &local as *mut u8;
2323
//~^ ERROR mismatched types: expected `*mut u8` but found `&[u8, .. 1]`

branches/try2/src/test/compile-fail/transmute-different-sizes.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// Tests that `transmute` cannot be called on types of different size.
1212

13+
#![allow(warnings)]
14+
1315
use std::mem::transmute;
1416

1517
unsafe fn f() {

branches/try2/src/test/pretty/path-type-bounds.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
trait Tr { }
1515
impl Tr for int { }
1616

17-
fn foo(x: Box<Tr: Share>) -> Box<Tr: Share> { x }
17+
fn foo(x: Box<Tr+ Share>) -> Box<Tr+ Share> { x }
1818

1919
fn main() {
20-
let x: Box<Tr: Share>;
20+
let x: Box<Tr+ Share>;
2121

22-
box() 1 as Box<Tr: Share>;
22+
box() 1 as Box<Tr+ Share>;
2323
}
2424

branches/try2/src/test/run-pass-fulldeps/quote-tokens.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
// ignore-android
12+
// ignore-pretty: does not work well with `--test`
13+
1114
#![feature(quote)]
1215
#![feature(managed_boxes)]
1316

branches/try2/src/test/run-pass/issue-14837.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
// except according to those terms.
1010

1111
#![feature(struct_variant)]
12-
#![deny(warnings)]
1312

13+
#[deny(dead_code)]
1414
pub enum Foo {
1515
Bar {
1616
pub baz: int

0 commit comments

Comments
 (0)