Skip to content

Commit 6477053

Browse files
committed
---
yaml --- r: 123511 b: refs/heads/auto c: 0e80dbe h: refs/heads/master i: 123509: 735b740 123507: 6293999 123503: 08fc44c v: v3
1 parent 7ddc610 commit 6477053

File tree

18 files changed

+193
-83
lines changed

18 files changed

+193
-83
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 9b9cce2316119a2ffdc9556d410e464b7542d64d
16+
refs/heads/auto: 0e80dbe59ea986ea53cc3caabffd40b2eaee4dc6
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/compiletest/procsrv.rs

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

11-
use std::os;
1211
use std::str;
1312
use std::io::process::{ProcessExit, Command, Process, ProcessOutput};
1413
use std::dynamic_lib::DynamicLibrary;
1514

16-
fn target_env(lib_path: &str, aux_path: Option<&str>) -> Vec<(String, String)> {
15+
fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {
1716
// Need to be sure to put both the lib_path and the aux path in the dylib
1817
// search path for the child.
1918
let mut path = DynamicLibrary::search_path();
@@ -23,19 +22,11 @@ fn target_env(lib_path: &str, aux_path: Option<&str>) -> Vec<(String, String)> {
2322
}
2423
path.insert(0, Path::new(lib_path));
2524

26-
// Remove the previous dylib search path var
27-
let var = DynamicLibrary::envvar();
28-
let mut env: Vec<(String,String)> = os::env();
29-
match env.iter().position(|&(ref k, _)| k.as_slice() == var) {
30-
Some(i) => { env.remove(i); }
31-
None => {}
32-
}
33-
3425
// Add the new dylib search path var
26+
let var = DynamicLibrary::envvar();
3527
let newpath = DynamicLibrary::create_path(path.as_slice());
3628
let newpath = str::from_utf8(newpath.as_slice()).unwrap().to_string();
37-
env.push((var.to_string(), newpath));
38-
return env;
29+
cmd.env(var.to_string(), newpath);
3930
}
4031

4132
pub struct Result {pub status: ProcessExit, pub out: String, pub err: String}
@@ -47,8 +38,14 @@ pub fn run(lib_path: &str,
4738
env: Vec<(String, String)> ,
4839
input: Option<String>) -> Option<Result> {
4940

50-
let env = env.clone().append(target_env(lib_path, aux_path).as_slice());
51-
match Command::new(prog).args(args).env(env.as_slice()).spawn() {
41+
let mut cmd = Command::new(prog);
42+
cmd.args(args);
43+
add_target_env(&mut cmd, lib_path, aux_path);
44+
for (key, val) in env.move_iter() {
45+
cmd.env(key, val);
46+
}
47+
48+
match cmd.spawn() {
5249
Ok(mut process) => {
5350
for input in input.iter() {
5451
process.stdin.get_mut_ref().write(input.as_bytes()).unwrap();
@@ -73,8 +70,14 @@ pub fn run_background(lib_path: &str,
7370
env: Vec<(String, String)> ,
7471
input: Option<String>) -> Option<Process> {
7572

76-
let env = env.clone().append(target_env(lib_path, aux_path).as_slice());
77-
match Command::new(prog).args(args).env(env.as_slice()).spawn() {
73+
let mut cmd = Command::new(prog);
74+
cmd.args(args);
75+
add_target_env(&mut cmd, lib_path, aux_path);
76+
for (key, val) in env.move_iter() {
77+
cmd.env(key, val);
78+
}
79+
80+
match cmd.spawn() {
7881
Ok(mut process) => {
7982
for input in input.iter() {
8083
process.stdin.get_mut_ref().write(input.as_bytes()).unwrap();

branches/auto/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path)
574574
cmd.arg("./src/etc/lldb_batchmode.py")
575575
.arg(test_executable)
576576
.arg(debugger_script)
577-
.env([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);
577+
.env_set_all([("PYTHONPATH", config.lldb_python_dir.clone().unwrap().as_slice())]);
578578

579579
let (status, out, err) = match cmd.spawn() {
580580
Ok(process) => {

branches/auto/src/libcore/num/f32.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
//! Operations and constants for 32-bits floats (`f32` type)
1212
1313
#![doc(primitive = "f32")]
14+
// FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353
15+
#![allow(type_overflow)]
1416

1517
use intrinsics;
1618
use mem;

branches/auto/src/libcore/num/f64.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
//! Operations and constants for 64-bits floats (`f64` type)
1212
1313
#![doc(primitive = "f64")]
14+
// FIXME: MIN_VALUE and MAX_VALUE literals are parsed as -inf and inf #14353
15+
#![allow(type_overflow)]
1416

1517
use intrinsics;
1618
use mem;

branches/auto/src/libnative/io/process.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ fn with_argv<T>(prog: &CString, args: &[CString],
729729
}
730730

731731
#[cfg(unix)]
732-
fn with_envp<T>(env: Option<&[(CString, CString)]>,
732+
fn with_envp<T>(env: Option<&[(&CString, &CString)]>,
733733
cb: proc(*const c_void) -> T) -> T {
734734
// On posixy systems we can pass a char** for envp, which is a
735735
// null-terminated array of "k=v\0" strings. Since we must create
@@ -762,7 +762,7 @@ fn with_envp<T>(env: Option<&[(CString, CString)]>,
762762
}
763763

764764
#[cfg(windows)]
765-
fn with_envp<T>(env: Option<&[(CString, CString)]>, cb: |*mut c_void| -> T) -> T {
765+
fn with_envp<T>(env: Option<&[(&CString, &CString)]>, cb: |*mut c_void| -> T) -> T {
766766
// On win32 we pass an "environment block" which is not a char**, but
767767
// rather a concatenation of null-terminated k=v\0 sequences, with a final
768768
// \0 to terminate.

branches/auto/src/librustc/lint/builtin.rs

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,7 @@ use lint::{Context, LintPass, LintArray};
3737

3838
use std::cmp;
3939
use std::collections::HashMap;
40-
use std::i16;
41-
use std::i32;
42-
use std::i64;
43-
use std::i8;
44-
use std::u16;
45-
use std::u32;
46-
use std::u64;
47-
use std::u8;
40+
use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
4841
use std::gc::Gc;
4942
use syntax::abi;
5043
use syntax::ast_map;
@@ -214,7 +207,21 @@ impl LintPass for TypeLimits {
214207
"literal out of range for its type");
215208
}
216209
},
217-
210+
ty::ty_float(t) => {
211+
let (min, max) = float_ty_range(t);
212+
let lit_val: f64 = match lit.node {
213+
ast::LitFloat(ref v, _) |
214+
ast::LitFloatUnsuffixed(ref v) => match from_str(v.get()) {
215+
Some(f) => f,
216+
None => return
217+
},
218+
_ => fail!()
219+
};
220+
if lit_val < min || lit_val > max {
221+
cx.span_lint(TYPE_OVERFLOW, e.span,
222+
"literal out of range for its type");
223+
}
224+
},
218225
_ => ()
219226
};
220227
},
@@ -265,6 +272,13 @@ impl LintPass for TypeLimits {
265272
}
266273
}
267274

275+
fn float_ty_range(float_ty: ast::FloatTy) -> (f64, f64) {
276+
match float_ty {
277+
ast::TyF32 => (f32::MIN_VALUE as f64, f32::MAX_VALUE as f64),
278+
ast::TyF64 => (f64::MIN_VALUE, f64::MAX_VALUE)
279+
}
280+
}
281+
268282
fn check_limits(tcx: &ty::ctxt, binop: ast::BinOp,
269283
l: &ast::Expr, r: &ast::Expr) -> bool {
270284
let (lit, expr, swap) = match (&l.node, &r.node) {

branches/auto/src/librustc/middle/typeck/check/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,13 @@ fn check_cast(fcx: &FnCtxt,
12191219
actual,
12201220
fcx.infcx().ty_to_string(t_1))
12211221
}, t_e, None);
1222+
} else if ty::type_is_unsafe_ptr(t_e) && t_1_is_float {
1223+
fcx.type_error_message(span, |actual| {
1224+
format!("cannot cast from pointer to float directly: `{}` as `{}`; cast through an \
1225+
integer first",
1226+
actual,
1227+
fcx.infcx().ty_to_string(t_1))
1228+
}, t_e, None);
12221229
}
12231230

12241231
fcx.write_ty(id, t_1);

branches/auto/src/librustdoc/test.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -176,26 +176,15 @@ fn runtest(test: &str, cratename: &str, libs: HashSet<Path>, should_fail: bool,
176176
// environment to ensure that the target loads the right libraries at
177177
// runtime. It would be a sad day if the *host* libraries were loaded as a
178178
// mistake.
179-
let exe = outdir.path().join("rust_out");
180-
let env = {
179+
let mut cmd = Command::new(outdir.path().join("rust_out"));
180+
let newpath = {
181181
let mut path = DynamicLibrary::search_path();
182182
path.insert(0, libdir.clone());
183-
184-
// Remove the previous dylib search path var
185-
let var = DynamicLibrary::envvar();
186-
let mut env: Vec<(String,String)> = os::env().move_iter().collect();
187-
match env.iter().position(|&(ref k, _)| k.as_slice() == var) {
188-
Some(i) => { env.remove(i); }
189-
None => {}
190-
};
191-
192-
// Add the new dylib search path var
193-
let newpath = DynamicLibrary::create_path(path.as_slice());
194-
env.push((var.to_string(),
195-
str::from_utf8(newpath.as_slice()).unwrap().to_string()));
196-
env
183+
DynamicLibrary::create_path(path.as_slice())
197184
};
198-
match Command::new(exe).env(env.as_slice()).output() {
185+
cmd.env(DynamicLibrary::envvar(), newpath.as_slice());
186+
187+
match cmd.output() {
199188
Err(e) => fail!("couldn't run the test: {}{}", e,
200189
if e.kind == io::PermissionDenied {
201190
" - maybe your tempdir is mounted with noexec?"

branches/auto/src/librustrt/c_str.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ use core::prelude::*;
6969

7070
use alloc::libc_heap::malloc_raw;
7171
use collections::string::String;
72+
use collections::hash;
7273
use core::kinds::marker;
7374
use core::mem;
7475
use core::ptr;
@@ -116,6 +117,22 @@ impl PartialEq for CString {
116117
}
117118
}
118119

120+
impl PartialOrd for CString {
121+
#[inline]
122+
fn partial_cmp(&self, other: &CString) -> Option<Ordering> {
123+
self.as_bytes().partial_cmp(&other.as_bytes())
124+
}
125+
}
126+
127+
impl Eq for CString {}
128+
129+
impl<S: hash::Writer> hash::Hash<S> for CString {
130+
#[inline]
131+
fn hash(&self, state: &mut S) {
132+
self.as_bytes().hash(state)
133+
}
134+
}
135+
119136
impl CString {
120137
/// Create a C String from a pointer.
121138
pub unsafe fn new(buf: *const libc::c_char, owns_buffer: bool) -> CString {

branches/auto/src/librustrt/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
html_root_url = "http://doc.rust-lang.org/0.11.0/")]
1818

1919
#![feature(macro_rules, phase, globs, thread_local, managed_boxes, asm)]
20-
#![feature(linkage, lang_items, unsafe_destructor)]
20+
#![feature(linkage, lang_items, unsafe_destructor, default_type_params)]
2121
#![no_std]
2222
#![experimental]
2323

branches/auto/src/librustrt/rtio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub struct ProcessConfig<'a> {
7575

7676
/// Optional environment to specify for the program. If this is None, then
7777
/// it will inherit the current process's environment.
78-
pub env: Option<&'a [(CString, CString)]>,
78+
pub env: Option<&'a [(&'a CString, &'a CString)]>,
7979

8080
/// Optional working directory for the new process. If this is None, then
8181
/// the current directory of the running process is inherited.

branches/auto/src/librustuv/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ fn with_argv<T>(prog: &CString, args: &[CString],
193193
}
194194

195195
/// Converts the environment to the env array expected by libuv
196-
fn with_env<T>(env: Option<&[(CString, CString)]>,
196+
fn with_env<T>(env: Option<&[(&CString, &CString)]>,
197197
cb: |*const *const libc::c_char| -> T) -> T {
198198
// We can pass a char** for envp, which is a null-terminated array
199199
// of "k=v\0" strings. Since we must create these strings locally,

0 commit comments

Comments
 (0)