Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 5910 dyna freeze #6283

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
202b8dc
adapt to snapshot
nikomatsakis Apr 17, 2013
b5a7e8b
desnapshot
nikomatsakis Apr 22, 2013
a896440
new borrow checker (mass squash)
nikomatsakis Mar 15, 2013
aa48a17
dataflow: fix flow of information through pattern variants
nikomatsakis Apr 30, 2013
7a0c1ea
correct used_mut annotations for args, inherited case
nikomatsakis Apr 30, 2013
545d51c
rustc: remove modes
nikomatsakis Apr 30, 2013
70b9ad1
rustc: work around issue with default-method-simple, fix some rebase
nikomatsakis Apr 30, 2013
418f991
allover: numerous unused muts etc
nikomatsakis Apr 30, 2013
dc21dae
borrowck: fix critical bug prevent us from ever using write guards :)
nikomatsakis Apr 30, 2013
f236b85
remove some unused mut decls
nikomatsakis Apr 30, 2013
5ab33a2
correct incorrect handling of overloaded operators, exposing various …
nikomatsakis May 1, 2013
d96c65a
keep old sort for stage0
nikomatsakis May 1, 2013
8486110
rustc: print out filename/line-number when a borrow fails
nikomatsakis May 1, 2013
4af2d90
add an option to debug borrows (RUST_DEBUG_BORROW) so you can
nikomatsakis May 1, 2013
3159335
avoid broken += operator, bogus use of const
nikomatsakis May 1, 2013
38f93f2
wip---work on making rooting work properly
nikomatsakis May 1, 2013
14bf5c4
rustc: adjust total number of lang items
nikomatsakis May 2, 2013
ef6b24d
rustc: fix the fact that trans_lvalue rooted twice
nikomatsakis May 2, 2013
d231c42
core: add more debugging printouts to borrowing
nikomatsakis May 2, 2013
6210de9
lang: fix code for maintaining borrow list
nikomatsakis May 2, 2013
fbaf839
rustc: more fix for trans_lvalue rooted twice
nikomatsakis May 2, 2013
5f88634
syntax: fix up dynamic borrow errors in libsyntax
nikomatsakis May 2, 2013
88ec89d
fix numerous dynamic borrow failures
nikomatsakis May 2, 2013
4999d44
trans: fix borrow violation
nikomatsakis May 2, 2013
cc62680
free the borrow list propertly instead of crashing
nikomatsakis May 2, 2013
9bded76
move @mut into scope_info
nikomatsakis May 3, 2013
3402435
Change borrow debugging so it is disabled by -O
nikomatsakis May 3, 2013
e7d9693
Correct mismatch between the way that pattern ids and expression ids …
nikomatsakis May 3, 2013
f3a6ea2
lang: um, actually set locking bits! this code got lost.
nikomatsakis May 3, 2013
be08c3e
rustc: add rooting, write-guards to slices etc
nikomatsakis May 3, 2013
0ff8200
factor code for write guards into its own module; add neglected resol…
nikomatsakis May 4, 2013
bf2d3c7
improve DEBUG_BORROW printouts
nikomatsakis May 4, 2013
ccf2f7b
make asm_comments something that you opt in to
nikomatsakis May 4, 2013
989d008
separate out write_guard code into its own module
nikomatsakis May 4, 2013
6806900
disable lang debug for perf
nikomatsakis May 5, 2013
0b0b801
add warning for #6248 and remove instances of it
nikomatsakis May 5, 2013
6cb273e
Address all FIXMEs from #5562
nikomatsakis May 5, 2013
4300d4d
Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-…
nikomatsakis May 5, 2013
7b36e34
Fix two more write guard failures
nikomatsakis May 6, 2013
4dc62df
do not run regionck if there have been type errors
nikomatsakis May 6, 2013
e235f6c
remove some unused mut decls and vars
nikomatsakis May 6, 2013
2ea52a3
refinement to technique used to not run regionck
nikomatsakis May 6, 2013
6c0c3a4
Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-…
nikomatsakis May 6, 2013
84f7ecc
Adust arena test: can no longer allocate recursively
nikomatsakis May 6, 2013
c50a9d5
Use rust_try_get_task for compat with new rt, and strenghten assumpti…
nikomatsakis May 6, 2013
0ef4e86
Replace NOTE with FIXME
nikomatsakis May 6, 2013
2e4790c
Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-…
nikomatsakis May 6, 2013
8b32bde
add rust_take_task_borrow_list and rust_set_task_borrow_list to rustr…
nikomatsakis May 7, 2013
ce45f39
Remove debug_mem since @graydon said it conflicted with GC changes
nikomatsakis May 7, 2013
cd164cf
Merge remote-tracking branch 'mozilla/incoming' into issue-5910-dyna-…
nikomatsakis May 7, 2013
39a1190
appease the tidy gods with respect to a FIXME
nikomatsakis May 7, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ endif
ifdef SAVE_TEMPS
CFG_RUSTC_FLAGS += --save-temps
endif
ifdef ASM_COMMENTS
CFG_RUSTC_FLAGS += -z asm-comments
endif
ifdef TIME_PASSES
CFG_RUSTC_FLAGS += -Z time-passes
endif
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn empty_cell<T>() -> Cell<T> {
pub impl<T> Cell<T> {
/// Yields the value, failing if the cell is empty.
fn take(&self) -> T {
let mut self = unsafe { transmute_mut(self) };
let self = unsafe { transmute_mut(self) };
if self.is_empty() {
fail!(~"attempt to take an empty cell");
}
Expand All @@ -54,7 +54,7 @@ pub impl<T> Cell<T> {

/// Returns the value, failing if the cell is full.
fn put_back(&self, value: T) {
let mut self = unsafe { transmute_mut(self) };
let self = unsafe { transmute_mut(self) };
if !self.is_empty() {
fail!(~"attempt to put a value back into a full cell");
}
Expand Down
5 changes: 5 additions & 0 deletions src/libcore/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use ptr::mut_null;
use repr::BoxRepr;
use sys::TypeDesc;
use cast::transmute;
#[cfg(notest)] use unstable::lang::clear_task_borrow_list;

#[cfg(notest)] use ptr::to_unsafe_ptr;

Expand Down Expand Up @@ -179,6 +180,10 @@ pub unsafe fn annihilate() {
n_bytes_freed: 0
};

// Quick hack: we need to free this list upon task exit, and this
// is a convenient place to do it.
clear_task_borrow_list();

// Pass 1: Make all boxes immortal.
//
// In this pass, nothing gets freed, so it does not matter whether
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/comm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ impl<T: Owned> Selectable for Port<T> {
fn header(&self) -> *PacketHeader {
unsafe {
match self.endp {
Some(ref endp) => endp.header(),
None => fail!(~"peeking empty stream")
Some(ref endp) => endp.header(),
None => fail!(~"peeking empty stream")
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/libcore/flate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ pub mod rustrt {
pub extern {
unsafe fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void,
src_buf_len: size_t,
pout_len: *size_t,
pout_len: *mut size_t,
flags: c_int)
-> *c_void;

unsafe fn tinfl_decompress_mem_to_heap(psrc_buf: *const c_void,
src_buf_len: size_t,
pout_len: *size_t,
pout_len: *mut size_t,
flags: c_int)
-> *c_void;
}
Expand All @@ -52,11 +52,11 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
let res =
rustrt::tdefl_compress_mem_to_heap(b as *c_void,
len as size_t,
&outsz,
&mut outsz,
lz_norm);
assert!(res as int != 0);
let out = vec::raw::from_buf_raw(res as *u8,
outsz as uint);
outsz as uint);
libc::free(res);
out
}
Expand All @@ -66,11 +66,11 @@ pub fn deflate_bytes(bytes: &const [u8]) -> ~[u8] {
pub fn inflate_bytes(bytes: &const [u8]) -> ~[u8] {
do vec::as_const_buf(bytes) |b, len| {
unsafe {
let outsz : size_t = 0;
let mut outsz : size_t = 0;
let res =
rustrt::tinfl_decompress_mem_to_heap(b as *c_void,
len as size_t,
&outsz,
&mut outsz,
0);
assert!(res as int != 0);
let out = vec::raw::from_buf_raw(res as *u8,
Expand Down
13 changes: 13 additions & 0 deletions src/libcore/hashmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use rand;
use uint;
use vec;
use util::unreachable;
use kinds::Copy;

static INITIAL_CAPACITY: uint = 32u; // 2^5

Expand Down Expand Up @@ -529,6 +530,18 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
}
}

pub impl<K: Hash + Eq, V: Copy> HashMap<K, V> {
/// Like `find`, but returns a copy of the value.
fn find_copy(&self, k: &K) -> Option<V> {
self.find(k).map_consume(|v| copy *v)
}

/// Like `get`, but returns a copy of the value.
fn get_copy(&self, k: &K) -> V {
copy *self.get(k)
}
}

impl<K:Hash + Eq,V:Eq> Eq for HashMap<K, V> {
fn eq(&self, other: &HashMap<K, V>) -> bool {
if self.len() != other.len() { return false; }
Expand Down
14 changes: 7 additions & 7 deletions src/libcore/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ pub enum WriterType { Screen, File }
pub trait Writer {

/// Write all of the given bytes.
fn write(&self, v: &const [u8]);
fn write(&self, v: &[u8]);

/// Move the current position within the stream. The second parameter
/// determines the position that the first parameter is relative to.
Expand All @@ -1039,23 +1039,23 @@ pub trait Writer {
}

impl Writer for @Writer {
fn write(&self, v: &const [u8]) { self.write(v) }
fn write(&self, v: &[u8]) { self.write(v) }
fn seek(&self, a: int, b: SeekStyle) { self.seek(a, b) }
fn tell(&self) -> uint { self.tell() }
fn flush(&self) -> int { self.flush() }
fn get_type(&self) -> WriterType { self.get_type() }
}

impl<W:Writer,C> Writer for Wrapper<W, C> {
fn write(&self, bs: &const [u8]) { self.base.write(bs); }
fn write(&self, bs: &[u8]) { self.base.write(bs); }
fn seek(&self, off: int, style: SeekStyle) { self.base.seek(off, style); }
fn tell(&self) -> uint { self.base.tell() }
fn flush(&self) -> int { self.base.flush() }
fn get_type(&self) -> WriterType { File }
}

impl Writer for *libc::FILE {
fn write(&self, v: &const [u8]) {
fn write(&self, v: &[u8]) {
unsafe {
do vec::as_const_buf(v) |vbuf, len| {
let nout = libc::fwrite(vbuf as *c_void,
Expand Down Expand Up @@ -1105,7 +1105,7 @@ pub fn FILE_writer(f: *libc::FILE, cleanup: bool) -> @Writer {
}

impl Writer for fd_t {
fn write(&self, v: &const [u8]) {
fn write(&self, v: &[u8]) {
unsafe {
let mut count = 0u;
do vec::as_const_buf(v) |vbuf, len| {
Expand Down Expand Up @@ -1262,7 +1262,7 @@ pub fn u64_to_be_bytes<T>(n: u64, size: uint,
}
}

pub fn u64_from_be_bytes(data: &const [u8],
pub fn u64_from_be_bytes(data: &[u8],
start: uint,
size: uint)
-> u64 {
Expand Down Expand Up @@ -1497,7 +1497,7 @@ pub struct BytesWriter {
}

impl Writer for BytesWriter {
fn write(&self, v: &const [u8]) {
fn write(&self, v: &[u8]) {
let v_len = v.len();
let bytes_len = vec::uniq_len(&const self.bytes);

Expand Down
3 changes: 1 addition & 2 deletions src/libcore/libc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,7 @@ pub mod types {
pub type ssize_t = i32;
}
pub mod posix01 {
use libc::types::os::arch::c95::{c_int, c_short, c_long,
time_t};
use libc::types::os::arch::c95::{c_short, c_long, time_t};
use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t};
use libc::types::os::arch::posix88::{mode_t, off_t};
use libc::types::os::arch::posix88::{uid_t};
Expand Down
14 changes: 7 additions & 7 deletions src/libcore/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,13 @@ pub fn fsync_fd(fd: c_int, _l: io::fsync::Level) -> c_int {
}
}

pub struct Pipe { mut in: c_int, mut out: c_int }
pub struct Pipe { in: c_int, out: c_int }

#[cfg(unix)]
pub fn pipe() -> Pipe {
unsafe {
let mut fds = Pipe {in: 0 as c_int,
out: 0 as c_int };
out: 0 as c_int };
assert!((libc::pipe(&mut fds.in) == (0 as c_int)));
return Pipe {in: fds.in, out: fds.out};
}
Expand Down Expand Up @@ -1025,10 +1025,10 @@ pub fn last_os_error() -> ~str {
#[cfg(target_os = "macos")]
#[cfg(target_os = "android")]
#[cfg(target_os = "freebsd")]
fn strerror_r(errnum: c_int, buf: *c_char, buflen: size_t) -> c_int {
fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int {
#[nolink]
extern {
unsafe fn strerror_r(errnum: c_int, buf: *c_char,
unsafe fn strerror_r(errnum: c_int, buf: *mut c_char,
buflen: size_t) -> c_int;
}
unsafe {
Expand All @@ -1040,10 +1040,10 @@ pub fn last_os_error() -> ~str {
// and requires macros to instead use the POSIX compliant variant.
// So we just use __xpg_strerror_r which is always POSIX compliant
#[cfg(target_os = "linux")]
fn strerror_r(errnum: c_int, buf: *c_char, buflen: size_t) -> c_int {
fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int {
#[nolink]
extern {
unsafe fn __xpg_strerror_r(errnum: c_int, buf: *c_char,
unsafe fn __xpg_strerror_r(errnum: c_int, buf: *mut c_char,
buflen: size_t) -> c_int;
}
unsafe {
Expand All @@ -1053,7 +1053,7 @@ pub fn last_os_error() -> ~str {

let mut buf = [0 as c_char, ..TMPBUF_SZ];
unsafe {
let err = strerror_r(errno() as c_int, &buf[0],
let err = strerror_r(errno() as c_int, &mut buf[0],
TMPBUF_SZ as size_t);
if err < 0 {
fail!(~"strerror_r failure");
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,34 +296,34 @@ impl<T> Ord for *const T {

// Equality for region pointers
#[cfg(notest)]
impl<'self,T:Eq> Eq for &'self const T {
impl<'self,T:Eq> Eq for &'self T {
#[inline(always)]
fn eq(&self, other: & &'self const T) -> bool {
fn eq(&self, other: & &'self T) -> bool {
return *(*self) == *(*other);
}
#[inline(always)]
fn ne(&self, other: & &'self const T) -> bool {
fn ne(&self, other: & &'self T) -> bool {
return *(*self) != *(*other);
}
}

// Comparison for region pointers
#[cfg(notest)]
impl<'self,T:Ord> Ord for &'self const T {
impl<'self,T:Ord> Ord for &'self T {
#[inline(always)]
fn lt(&self, other: & &'self const T) -> bool {
fn lt(&self, other: & &'self T) -> bool {
*(*self) < *(*other)
}
#[inline(always)]
fn le(&self, other: & &'self const T) -> bool {
fn le(&self, other: & &'self T) -> bool {
*(*self) <= *(*other)
}
#[inline(always)]
fn ge(&self, other: & &'self const T) -> bool {
fn ge(&self, other: & &'self T) -> bool {
*(*self) >= *(*other)
}
#[inline(always)]
fn gt(&self, other: & &'self const T) -> bool {
fn gt(&self, other: & &'self T) -> bool {
*(*self) > *(*other)
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/libcore/rt/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ pub struct Environment {
argc: c_int,
/// The argv value passed to main
argv: **c_char,
/// Print GC debugging info
debug_mem: bool
/// Print GC debugging info (true if env var RUST_DEBUG_MEM is set)
debug_mem: bool,
/// Print GC debugging info (true if env var RUST_DEBUG_BORROW is set)
debug_borrow: bool,
}

/// Get the global environment settings
Expand Down
4 changes: 1 addition & 3 deletions src/libcore/rt/sched/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ pub impl Scheduler {
/// Called by a running task to end execution, after which it will
/// be recycled by the scheduler for reuse in a new task.
fn terminate_current_task(~self) {
let mut self = self;
assert!(self.in_task_context());

rtdebug!("ending running task");
Expand All @@ -153,7 +152,6 @@ pub impl Scheduler {
}

fn schedule_new_task(~self, task: ~Task) {
let mut self = self;
assert!(self.in_task_context());

do self.switch_running_tasks_and_then(task) |last_task| {
Expand Down Expand Up @@ -305,7 +303,7 @@ pub impl Scheduler {
unsafe {
let last_task = transmute::<Option<&Task>, Option<&mut Task>>(last_task);
let last_task_context = match last_task {
Some(ref t) => Some(&mut t.saved_context), None => None
Some(t) => Some(&mut t.saved_context), None => None
};
let next_task_context = match self.current_task {
Some(ref mut t) => Some(&mut t.saved_context), None => None
Expand Down
12 changes: 0 additions & 12 deletions src/libcore/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2472,9 +2472,6 @@ pub trait StrSlice<'self> {
fn any(&self, it: &fn(char) -> bool) -> bool;
fn contains<'a>(&self, needle: &'a str) -> bool;
fn contains_char(&self, needle: char) -> bool;
#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
fn char_iter(&self) -> StrCharIterator<'self>;
fn each(&self, it: &fn(u8) -> bool);
fn eachi(&self, it: &fn(uint, u8) -> bool);
Expand Down Expand Up @@ -2536,9 +2533,6 @@ impl<'self> StrSlice<'self> for &'self str {
contains_char(*self, needle)
}

#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
#[inline]
fn char_iter(&self) -> StrCharIterator<'self> {
StrCharIterator {
Expand Down Expand Up @@ -2732,17 +2726,11 @@ impl Clone for ~str {
}
}

#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
pub struct StrCharIterator<'self> {
priv index: uint,
priv string: &'self str,
}

#[cfg(stage1)]
#[cfg(stage2)]
#[cfg(stage3)]
impl<'self> Iterator<char> for StrCharIterator<'self> {
#[inline]
fn next(&mut self) -> Option<char> {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/to_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use io::Writer;
use option::{None, Option, Some};
use str;

pub type Cb<'self> = &'self fn(buf: &const [u8]) -> bool;
pub type Cb<'self> = &'self fn(buf: &[u8]) -> bool;

/**
* A trait to implement in order to make a type hashable;
Expand Down
Loading