Skip to content

Commit fe68a11

Browse files
committed
---
yaml --- r: 227510 b: refs/heads/try c: 52862e4 h: refs/heads/master v: v3
1 parent 31e5102 commit fe68a11

File tree

179 files changed

+743
-1061
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+743
-1061
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 0d82fb55dbb9b28798ea7c2004fa91fe3ae23b86
4+
refs/heads/try: 52862e4cda1ff72e52dfaea21cf82ae93725b3be
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/configure

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,6 @@ fi
521521
DEFAULT_BUILD="${CFG_CPUTYPE}-${CFG_OSTYPE}"
522522

523523
CFG_SRC_DIR="$(abs_path $(dirname $0))/"
524-
CFG_SRC_DIR_RELATIVE="$(dirname $0)/"
525524
CFG_BUILD_DIR="$(pwd)/"
526525
CFG_SELF="$0"
527526
CFG_CONFIGURE_ARGS="$@"
@@ -1559,7 +1558,6 @@ done
15591558
step_msg "writing configuration"
15601559

15611560
putvar CFG_SRC_DIR
1562-
putvar CFG_SRC_DIR_RELATIVE
15631561
putvar CFG_BUILD_DIR
15641562
putvar CFG_OSTYPE
15651563
putvar CFG_CPUTYPE

branches/try/mk/crates.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ DOC_CRATES := std alloc collections core libc rustc_unicode
134134
#
135135
# $(1) is the crate to generate variables for
136136
define RUST_CRATE
137-
CRATEFILE_$(1) := $$(SREL)src/lib$(1)/lib.rs
137+
CRATEFILE_$(1) := $$(S)src/lib$(1)/lib.rs
138138
RSINPUTS_$(1) := $$(call rwildcard,$(S)src/lib$(1)/,*.rs)
139139
RUST_DEPS_$(1) := $$(filter-out native:%,$$(DEPS_$(1)))
140140
NATIVE_DEPS_$(1) := $$(patsubst native:%,%,$$(filter native:%,$$(DEPS_$(1))))

branches/try/mk/main.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ $(foreach host,$(CFG_HOST), \
322322
# exported
323323

324324
export CFG_SRC_DIR
325-
export CFG_SRC_DIR_RELATIVE
326325
export CFG_BUILD_DIR
327326
ifdef CFG_VER_DATE
328327
export CFG_VER_DATE

branches/try/mk/reconfig.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ Makefile config.mk: config.stamp
3434

3535
config.stamp: $(S)configure $(S)Makefile.in $(S)src/snapshots.txt
3636
@$(call E, cfg: reconfiguring)
37-
$(SREL)configure $(CFG_CONFIGURE_ARGS)
37+
$(S)configure $(CFG_CONFIGURE_ARGS)

branches/try/mk/util.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ print-%:
2020
@echo $*=$($*)
2121

2222
S := $(CFG_SRC_DIR)
23-
SREL := $(CFG_SRC_DIR_RELATIVE)

branches/try/src/compiletest/common.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ pub struct Config {
124124
// Flags to pass to the compiler when building for the target
125125
pub target_rustcflags: Option<String>,
126126

127+
// Run tests using the JIT
128+
pub jit: bool,
129+
127130
// Target system to be tested
128131
pub target: String,
129132

branches/try/src/compiletest/compiletest.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
7979
optopt("", "target-rustcflags", "flags to pass to rustc for target", "FLAGS"),
8080
optflag("", "verbose", "run tests verbosely, showing all output"),
8181
optopt("", "logfile", "file to log test execution to", "FILE"),
82+
optflag("", "jit", "run tests under the JIT"),
8283
optopt("", "target", "the target to build for", "TARGET"),
8384
optopt("", "host", "the host to build for", "HOST"),
8485
optopt("", "gdb-version", "the version of GDB used", "VERSION STRING"),
@@ -145,6 +146,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
145146
runtool: matches.opt_str("runtool"),
146147
host_rustcflags: matches.opt_str("host-rustcflags"),
147148
target_rustcflags: matches.opt_str("target-rustcflags"),
149+
jit: matches.opt_present("jit"),
148150
target: opt_str2(matches.opt_str("target")),
149151
host: opt_str2(matches.opt_str("host")),
150152
gdb_version: extract_gdb_version(matches.opt_str("gdb-version")),
@@ -184,6 +186,7 @@ pub fn log_config(config: &Config) {
184186
opt_str(&config.host_rustcflags)));
185187
logv(c, format!("target-rustcflags: {}",
186188
opt_str(&config.target_rustcflags)));
189+
logv(c, format!("jit: {}", config.jit));
187190
logv(c, format!("target: {}", config.target));
188191
logv(c, format!("host: {}", config.host));
189192
logv(c, format!("android-cross-path: {:?}",

branches/try/src/compiletest/runtest.rs

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,17 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
9898
}
9999

100100
fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) {
101-
let proc_res = compile_test(config, props, testfile);
101+
let proc_res = if !config.jit {
102+
let proc_res = compile_test(config, props, testfile);
102103

103-
if !proc_res.status.success() {
104-
fatal_proc_rec("compilation failed!", &proc_res);
105-
}
104+
if !proc_res.status.success() {
105+
fatal_proc_rec("compilation failed!", &proc_res);
106+
}
106107

107-
let proc_res = exec_compiled_test(config, props, testfile);
108+
exec_compiled_test(config, props, testfile)
109+
} else {
110+
jit_test(config, props, testfile)
111+
};
108112

109113
// The value our Makefile configures valgrind to return on failure
110114
const VALGRIND_ERR: i32 = 100;
@@ -129,16 +133,24 @@ fn check_correct_failure_status(proc_res: &ProcRes) {
129133
}
130134

131135
fn run_rpass_test(config: &Config, props: &TestProps, testfile: &Path) {
132-
let proc_res = compile_test(config, props, testfile);
136+
if !config.jit {
137+
let mut proc_res = compile_test(config, props, testfile);
133138

134-
if !proc_res.status.success() {
135-
fatal_proc_rec("compilation failed!", &proc_res);
136-
}
139+
if !proc_res.status.success() {
140+
fatal_proc_rec("compilation failed!", &proc_res);
141+
}
137142

138-
let proc_res = exec_compiled_test(config, props, testfile);
143+
proc_res = exec_compiled_test(config, props, testfile);
139144

140-
if !proc_res.status.success() {
141-
fatal_proc_rec("test run failed!", &proc_res);
145+
if !proc_res.status.success() {
146+
fatal_proc_rec("test run failed!", &proc_res);
147+
}
148+
} else {
149+
let proc_res = jit_test(config, props, testfile);
150+
151+
if !proc_res.status.success() {
152+
fatal_proc_rec("jit failed!", &proc_res);
153+
}
142154
}
143155
}
144156

@@ -1129,6 +1141,10 @@ fn compile_test(config: &Config, props: &TestProps,
11291141
compile_test_(config, props, testfile, &[])
11301142
}
11311143

1144+
fn jit_test(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes {
1145+
compile_test_(config, props, testfile, &["--jit".to_string()])
1146+
}
1147+
11321148
fn compile_test_(config: &Config, props: &TestProps,
11331149
testfile: &Path, extra_args: &[String]) -> ProcRes {
11341150
let aux_dir = aux_output_dir_name(config, testfile);

branches/try/src/liballoc/heap.rs

Lines changed: 17 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -345,94 +345,47 @@ mod imp {
345345
not(jemalloc),
346346
windows))]
347347
mod imp {
348-
use core::mem::size_of;
349-
use libc::{BOOL, DWORD, HANDLE, LPVOID, SIZE_T, INVALID_HANDLE_VALUE};
350-
use libc::{WriteFile};
348+
use libc::{c_void, size_t};
349+
use libc;
351350
use super::MIN_ALIGN;
352351

353-
extern "system" {
354-
fn GetProcessHeap() -> HANDLE;
355-
fn GetStdHandle(nStdHandle: DWORD) -> HANDLE;
356-
fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) -> LPVOID;
357-
fn HeapReAlloc(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID, dwBytes: SIZE_T) -> LPVOID;
358-
fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: LPVOID) -> BOOL;
359-
fn HeapSummary(hHeap: HANDLE, dwFlags: DWORD, lpSummary: LPHEAP_SUMMARY) -> BOOL;
360-
}
361-
362-
#[repr(C)] #[allow(non_snake_case)]
363-
struct HEAP_SUMMARY {
364-
cb: DWORD,
365-
cbAllocated: SIZE_T,
366-
cbCommitted: SIZE_T,
367-
cbReserved: SIZE_T,
368-
cbMaxReserve: SIZE_T,
369-
}
370-
#[allow(non_camel_case_types)]
371-
type LPHEAP_SUMMARY = *mut HEAP_SUMMARY;
372-
373-
#[repr(C)]
374-
struct Header(*mut u8);
375-
376-
const HEAP_REALLOC_IN_PLACE_ONLY: DWORD = 0x00000010;
377-
const STD_OUTPUT_HANDLE: DWORD = -11i32 as u32;
378-
379-
#[inline]
380-
unsafe fn get_header<'a>(ptr: *mut u8) -> &'a mut Header {
381-
&mut *(ptr as *mut Header).offset(-1)
382-
}
383-
384-
#[inline]
385-
unsafe fn align_ptr(ptr: *mut u8, align: usize) -> *mut u8 {
386-
let aligned = ptr.offset((align - (ptr as usize & (align - 1))) as isize);
387-
*get_header(aligned) = Header(ptr);
388-
aligned
352+
extern {
353+
fn _aligned_malloc(size: size_t, align: size_t) -> *mut c_void;
354+
fn _aligned_realloc(block: *mut c_void, size: size_t,
355+
align: size_t) -> *mut c_void;
356+
fn _aligned_free(ptr: *mut c_void);
389357
}
390358

391359
#[inline]
392360
pub unsafe fn allocate(size: usize, align: usize) -> *mut u8 {
393361
if align <= MIN_ALIGN {
394-
HeapAlloc(GetProcessHeap(), 0, size as SIZE_T) as *mut u8
362+
libc::malloc(size as size_t) as *mut u8
395363
} else {
396-
let ptr = HeapAlloc(GetProcessHeap(), 0, (size + align) as SIZE_T) as *mut u8;
397-
if ptr.is_null() { return ptr }
398-
align_ptr(ptr, align)
364+
_aligned_malloc(size as size_t, align as size_t) as *mut u8
399365
}
400366
}
401367

402368
#[inline]
403369
pub unsafe fn reallocate(ptr: *mut u8, _old_size: usize, size: usize, align: usize) -> *mut u8 {
404370
if align <= MIN_ALIGN {
405-
HeapReAlloc(GetProcessHeap(), 0, ptr as LPVOID, size as SIZE_T) as *mut u8
371+
libc::realloc(ptr as *mut c_void, size as size_t) as *mut u8
406372
} else {
407-
let header = get_header(ptr);
408-
let new = HeapReAlloc(GetProcessHeap(), 0, header.0 as LPVOID,
409-
(size + align) as SIZE_T) as *mut u8;
410-
if new.is_null() { return new }
411-
align_ptr(new, align)
373+
_aligned_realloc(ptr as *mut c_void, size as size_t, align as size_t) as *mut u8
412374
}
413375
}
414376

415377
#[inline]
416-
pub unsafe fn reallocate_inplace(ptr: *mut u8, old_size: usize, size: usize,
417-
align: usize) -> usize {
418-
if align <= MIN_ALIGN {
419-
let new = HeapReAlloc(GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, ptr as LPVOID,
420-
size as SIZE_T) as *mut u8;
421-
if new.is_null() { old_size } else { size }
422-
} else {
423-
old_size
424-
}
378+
pub unsafe fn reallocate_inplace(_ptr: *mut u8, old_size: usize, _size: usize,
379+
_align: usize) -> usize {
380+
old_size
425381
}
426382

427383
#[inline]
428384
pub unsafe fn deallocate(ptr: *mut u8, _old_size: usize, align: usize) {
429385
if align <= MIN_ALIGN {
430-
let err = HeapFree(GetProcessHeap(), 0, ptr as LPVOID);
431-
debug_assert!(err != 0);
386+
libc::free(ptr as *mut libc::c_void)
432387
} else {
433-
let header = get_header(ptr);
434-
let err = HeapFree(GetProcessHeap(), 0, header.0 as LPVOID);
435-
debug_assert!(err != 0);
388+
_aligned_free(ptr as *mut c_void)
436389
}
437390
}
438391

@@ -441,45 +394,7 @@ mod imp {
441394
size
442395
}
443396

444-
pub fn stats_print() {
445-
use core::fmt::{Error, Result, Write};
446-
use core::ptr::null_mut;
447-
use core::raw::Repr;
448-
use core::result::Result::{Ok, Err};
449-
struct Console(HANDLE);
450-
impl Write for Console {
451-
fn write_str(&mut self, s: &str) -> Result {
452-
let repr = s.repr();
453-
let mut written = 0;
454-
let err = unsafe { WriteFile(self.0, repr.data as LPVOID, repr.len as DWORD,
455-
&mut written, null_mut()) };
456-
if written as usize != repr.len { return Err(Error) }
457-
if err == 0 { return Err(Error) }
458-
Ok(())
459-
}
460-
}
461-
let mut hs = HEAP_SUMMARY {
462-
cb: size_of::<HEAP_SUMMARY>() as DWORD,
463-
cbAllocated: 0,
464-
cbCommitted: 0,
465-
cbReserved: 0,
466-
cbMaxReserve: 0,
467-
};
468-
let err = unsafe { HeapSummary(GetProcessHeap(), 0, &mut hs) };
469-
assert!(err != 0);
470-
let handle = unsafe { GetStdHandle(STD_OUTPUT_HANDLE) };
471-
if handle.is_null() || handle == INVALID_HANDLE_VALUE { panic!("Failed to open stdout") }
472-
let mut out = Console(handle);
473-
writeln!(&mut out, "Allocated: {}", hs.cbAllocated).unwrap();
474-
writeln!(&mut out, "Committed: {}", hs.cbCommitted).unwrap();
475-
writeln!(&mut out, "Reserved: {}", hs.cbReserved).unwrap();
476-
writeln!(&mut out, "MaxReserve: {}", hs.cbMaxReserve).unwrap();
477-
}
478-
479-
#[test]
480-
fn alignment_header_size() {
481-
assert!(size_of::<Header>() <= MIN_ALIGN);
482-
}
397+
pub fn stats_print() {}
483398
}
484399

485400
#[cfg(test)]

branches/try/src/libcore/fmt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ pub trait Write {
7272
///
7373
/// # Errors
7474
///
75-
/// This function will return an instance of `Error` on error.
75+
/// This function will return an instance of `FormatError` on error.
7676
#[stable(feature = "rust1", since = "1.0.0")]
7777
fn write_str(&mut self, s: &str) -> Result;
7878

@@ -85,7 +85,7 @@ pub trait Write {
8585
///
8686
/// # Errors
8787
///
88-
/// This function will return an instance of `Error` on error.
88+
/// This function will return an instance of `FormatError` on error.
8989
#[stable(feature = "fmt_write_char", since = "1.1.0")]
9090
fn write_char(&mut self, c: char) -> Result {
9191
let mut utf_8 = [0u8; 4];

branches/try/src/libcore/result.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -731,26 +731,6 @@ impl<T, E: fmt::Debug> Result<T, E> {
731731
panic!("called `Result::unwrap()` on an `Err` value: {:?}", e)
732732
}
733733
}
734-
735-
/// Unwraps a result, yielding the content of an `Ok`.
736-
///
737-
/// Panics if the value is an `Err`, with a panic message including the
738-
/// passed message, and the content of the `Err`.
739-
///
740-
/// # Examples
741-
/// ```{.should_panic}
742-
/// #![feature(result_expect)]
743-
/// let x: Result<u32, &str> = Err("emergency failure");
744-
/// x.expect("Testing expect"); // panics with `Testing expect: emergency failure`
745-
/// ```
746-
#[inline]
747-
#[unstable(feature = "result_expect", reason = "newly introduced")]
748-
pub fn expect(self, msg: &str) -> T {
749-
match self {
750-
Ok(t) => t,
751-
Err(e) => panic!("{}: {:?}", msg, e),
752-
}
753-
}
754734
}
755735

756736
#[stable(feature = "rust1", since = "1.0.0")]

branches/try/src/libcoretest/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#![feature(cell_extras)]
2929
#![feature(iter_empty)]
3030
#![feature(iter_once)]
31-
#![feature(result_expect)]
3231

3332
extern crate core;
3433
extern crate test;

branches/try/src/libcoretest/result.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,16 +137,3 @@ pub fn test_unwrap_or_else_panic() {
137137
let bad_err: Result<isize, &'static str> = Err("Unrecoverable mess.");
138138
let _ : isize = bad_err.unwrap_or_else(handler);
139139
}
140-
141-
142-
#[test]
143-
pub fn test_expect_ok() {
144-
let ok: Result<isize, &'static str> = Ok(100);
145-
assert_eq!(ok.expect("Unexpected error"), 100);
146-
}
147-
#[test]
148-
#[should_panic(expected="Got expected error: \"All good\"")]
149-
pub fn test_expect_err() {
150-
let err: Result<isize, &'static str> = Err("All good");
151-
err.expect("Got expected error");
152-
}

branches/try/src/liblibc/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ pub use funcs::bsd43::*;
146146
#[link(name = "m")]
147147
extern {}
148148

149-
#[cfg(all(target_env = "musl", not(test)))]
149+
// When compiling rust with musl, statically include libc.a in liblibc.rlib.
150+
// A cargo build of the libc crate will therefore automatically pick up the
151+
// libc.a symbols because liblibc is transitively linked to by the stdlib.
152+
#[cfg(all(target_env = "musl", not(feature = "cargo-build"), not(test)))]
150153
#[link(name = "c", kind = "static")]
151154
extern {}
152155

0 commit comments

Comments
 (0)