Skip to content

Commit 9ece22e

Browse files
committed
Test fixes and rebase conflicts
1 parent fea07cf commit 9ece22e

File tree

12 files changed

+50
-24
lines changed

12 files changed

+50
-24
lines changed

src/compiletest/util.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use common::Config;
1212

1313
#[cfg(target_os = "windows")]
14-
use std::os::getenv;
14+
use std::env;
1515

1616
/// Conversion table from triple OS name to Rust SYSNAME
1717
static OS_TABLE: &'static [(&'static str, &'static str)] = &[
@@ -40,11 +40,11 @@ pub fn make_new_path(path: &str) -> String {
4040

4141
// Windows just uses PATH as the library search path, so we have to
4242
// maintain the current value while adding our own
43-
match getenv(lib_path_env_var()) {
44-
Some(curr) => {
43+
match env::var_string(lib_path_env_var()) {
44+
Ok(curr) => {
4545
format!("{}{}{}", path, path_div(), curr)
4646
}
47-
None => path.to_string()
47+
Err(..) => path.to_string()
4848
}
4949
}
5050

src/libcore/cell.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub struct RefCell<T> {
267267
}
268268

269269
/// An enumeration of values returned from the `state` method on a `RefCell<T>`.
270-
#[derive(Copy, Clone, PartialEq)]
270+
#[derive(Copy, Clone, PartialEq, Debug)]
271271
#[unstable(feature = "std_misc")]
272272
pub enum BorrowState {
273273
/// The cell is currently being read, there is at least one active `borrow`.

src/libcore/char.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub fn from_u32(i: u32) -> Option<char> {
115115
///
116116
/// let c = char::from_digit(4, 10);
117117
///
118-
/// assert_eq!(c, '4')
118+
/// assert_eq!(c, Some('4'));
119119
/// ```
120120
#[inline]
121121
#[unstable(feature = "core", reason = "pending integer conventions")]
@@ -183,9 +183,9 @@ pub trait CharExt {
183183
/// ```
184184
/// let c = '1';
185185
///
186-
/// assert_eq!(1, c.to_digit(10));
186+
/// assert_eq!(c.to_digit(10), Some(1));
187187
///
188-
/// assert_eq!(15, 'f'.to_digit(16));
188+
/// assert_eq!('f'.to_digit(16), Some(15));
189189
/// ```
190190
#[unstable(feature = "core",
191191
reason = "pending integer conventions")]
@@ -260,7 +260,7 @@ pub trait CharExt {
260260
/// ```
261261
/// let quote: String = '"'.escape_default().collect();
262262
///
263-
/// assert_eq!(quote, r"\"");
263+
/// assert_eq!(quote, "\\\"");
264264
/// ```
265265
#[stable(feature = "rust1", since = "1.0.0")]
266266
fn escape_default(self) -> EscapeDefault;

src/libstd/sys/unix/os.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ pub fn chdir(p: &Path) -> IoResult<()> {
116116
}
117117

118118
pub struct SplitPaths<'a> {
119-
iter: iter::Map<&'a [u8], Path,
120-
slice::Split<'a, u8, fn(&u8) -> bool>,
119+
iter: iter::Map<slice::Split<'a, u8, fn(&u8) -> bool>,
121120
fn(&'a [u8]) -> Path>,
122121
}
123122

@@ -450,7 +449,16 @@ pub fn temp_dir() -> Path {
450449
}
451450

452451
pub fn home_dir() -> Option<Path> {
453-
getenv("HOME".as_os_str()).or_else(|| unsafe {
452+
return getenv("HOME".as_os_str()).or_else(|| unsafe {
453+
fallback()
454+
}).map(|os| {
455+
Path::new(os.into_vec())
456+
});
457+
458+
#[cfg(target_os = "android")]
459+
unsafe fn fallback() -> Option<OsString> { None }
460+
#[cfg(not(target_os = "android"))]
461+
unsafe fn fallback() -> Option<OsString> {
454462
let mut amt = match libc::sysconf(c::_SC_GETPW_R_SIZE_MAX) {
455463
n if n < 0 => 512 as usize,
456464
n => n as usize,
@@ -470,7 +478,5 @@ pub fn home_dir() -> Option<Path> {
470478
let bytes = ffi::c_str_to_bytes(&ptr).to_vec();
471479
return Some(OsStringExt::from_vec(bytes))
472480
}
473-
}).map(|os| {
474-
Path::new(os.into_vec())
475-
})
481+
}
476482
}

src/rustllvm/llvm-auto-clean-trigger

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# If this file is modified, then llvm will be forcibly cleaned and then rebuilt.
22
# The actual contents of this file do not matter, but to trigger a change on the
33
# build bots then the contents should be changed so git updates the mtime.
4-
2015-01-30
4+
2015-02-02

src/test/compile-fail/issue-2149.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl<A> vec_monad<A> for Vec<A> {
1616
fn bind<B, F>(&self, mut f: F) where F: FnMut(A) -> Vec<B> {
1717
let mut r = panic!();
1818
for elt in self { r = r + f(*elt); }
19-
//~^ ERROR the type of this value must be known
19+
//~^ ERROR binary operation `+` cannot be applied to type `collections::vec::Vec<B>`
2020
}
2121
}
2222
fn main() {

src/test/compile-fail/lint-unknown-feature-default.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// Tests the default for the unused_features lint
1212

13+
#![deny(warnings)]
14+
1315
#![feature(this_is_not_a_feature)] //~ ERROR: unused or unknown feature
1416

1517
fn main() { }

src/test/compile-fail/use-as-where-use-ends-with-mod-sep.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use std::any:: as foo; //~ ERROR expected identifier or `{` or `*`, found `as`
11+
use std::any:: as foo; //~ ERROR expected identifier, found keyword `as`
12+
//~^ ERROR: expected one of `::`, `;`, or `as`, found `foo`

src/test/compile-fail/use-mod-4.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use foo::self;
12+
//~^ ERROR expected identifier, found keyword `self`
13+
14+
fn main() {}
15+

src/test/compile-fail/use-mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ use foo::bar::{
1919
use {self};
2020
//~^ ERROR `self` import can only appear in an import list with a non-empty prefix
2121

22-
use foo::self;
23-
//~^ ERROR `self` imports are only allowed within a { } list
24-
2522
mod foo {
2623
pub mod bar {
2724
pub struct Bar;

src/test/run-make/tools.mk

+3-2
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@ endif
5353

5454
# Extra flags needed to compile a working executable with the standard library
5555
ifdef IS_WINDOWS
56-
EXTRACFLAGS := -lws2_32
56+
EXTRACFLAGS := -lws2_32 -luserenv
5757
else
5858
ifeq ($(shell uname),Darwin)
5959
else
6060
ifeq ($(shell uname),FreeBSD)
6161
EXTRACFLAGS := -lm -lpthread -lgcc_s
62+
else
6263
ifeq ($(shell uname),OpenBSD)
63-
EXTRACFLAGS := -lm -lpthread
64+
EXTRACFLAGS := -lm -lpthread
6465
else
6566
EXTRACFLAGS := -lm -lrt -ldl -lpthread
6667
endif

src/test/run-pass/env-home-dir.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ fn main() {
1818
assert!(home_dir() == Some(Path::new("/home/MountainView")));
1919

2020
remove_var("HOME");
21-
assert!(home_dir().is_some());
21+
if cfg!(target_os = "android") {
22+
assert!(home_dir().is_none());
23+
} else {
24+
assert!(home_dir().is_some());
25+
}
2226
}
2327

2428
#[cfg(windows)]

0 commit comments

Comments
 (0)