Commit Graph

22955 Commits

Author SHA1 Message Date
Erick Tryzelaar
0bdc99d81f std: removed some warnings in tests. 2013-09-26 22:20:39 -07:00
Erick Tryzelaar
4834661c66 std and rustc: Convert users of c_str to use .with_c_str 2013-09-26 22:20:39 -07:00
bors
eb3ebb7ebd auto merge of #9525 : klutzy/rust/obsolete-span-fix, r=alexcrichton 2013-09-26 22:11:14 -07:00
Steven Fackler
fe9b1e29fc Visibility fixes 2013-09-26 22:01:33 -07:00
blake2-ppc
c0e1c09783 std::vec: Use a valid value as lifetime dummy in iterator
The current implementation uses `&v[0]` for the lifetime struct field,
but that is a dangling pointer for iterators derived from zero-length
slices.

Example:

    let v: [int, ..0] = [];  println!("{:?}", v.iter())

    std::vec::VecIterator<,int>{ptr: (0x7f3768626100 as *()), end: (0x7f3768626100 as *()), lifetime: &139875951207128}

To replace this parameter, use a field of type `Option<&'self ()>`
that is simply initialized with `None`, but still allows the iterator to
have a lifetime parameter.
2013-09-27 06:06:13 +02:00
Alex Crichton
5fe09563ac Remove @mut Resolver
Instead use &mut everywhere as much as possible and then reorganize lots of code
to get past the borrow checker.
2013-09-26 20:12:55 -07:00
bors
fcd3776e82 auto merge of #9523 : huonw/rust/kud1ing-docs, r=huonw
Collation of @kud1ing's work in #9511, #9512, #9513 and #9518.
2013-09-26 20:06:09 -07:00
bors
a94158ce64 auto merge of #9504 : brson/rust/continue, r=alexcrichton 2013-09-26 18:46:10 -07:00
Brian Anderson
25bc6b6283 Remove a little bit of unused C++ 2013-09-26 18:40:13 -07:00
Brian Anderson
99c1fb8c66 Update version numbers to 0.9-pre 2013-09-26 18:18:42 -07:00
bors
1434b4bfca auto merge of #9261 : alexcrichton/rust/logging, r=huonw
This lifts various restrictions on the runtime, for example the character limit
when logging a message. Right now the old debug!-style macros still involve
allocating (because they use fmt! syntax), but the new debug2! macros don't
involve allocating at all (unless the formatter for a type requires allocation.
2013-09-26 17:11:13 -07:00
Alex Crichton
409182de6d Update the compiler to not use printf/printfln 2013-09-26 17:05:59 -07:00
Alex Crichton
09a5338197 Remove the printf{,ln}! macros
These are deprecated in favor of print{,ln}!
2013-09-26 17:03:31 -07:00
Daniel Micay
2aadd3652d mark globals as internal when not building a library
Closes #9494
2013-09-26 19:21:22 -04:00
bors
48499c7494 auto merge of #9484 : alexcrichton/rust/fix-cfg-inner-item, r=pcwalton
If an item is skipped due to it being unreachable or for some optimization, then
it shouldn't be encoded into the metadata (because it wasn't present in the
first place).
2013-09-26 15:36:10 -07:00
Brian Anderson
c1d64297f0 Add 'continue' keyword to emacs, vim, gedit, kate 2013-09-26 15:04:43 -07:00
Brian Anderson
88272a4f24 Add 'continue' as a synonym for 'loop' 2013-09-26 15:04:13 -07:00
Felix S. Klock II
2835df2db6 Fix for make -j race from #9531 injected by cleanup in b1a22518f0. 2013-09-26 23:56:53 +02:00
Daniel Micay
c3e4e06841 remove type_use
This is broken, and results in poor performance due to the undefined
behaviour in the LLVM IR. LLVM's `mergefunc` is a *much* better way of
doing this since it merges based on the equality of the bytecode.

For example, consider `std::repr`. It generates different code per
type, but is not included in the type bounds of generics.

The `mergefunc` pass works for most of our code but currently hits an
assert on libstd. It is receiving attention upstream so it will be
ready soon, but I don't think removing this broken code should wait any
longer. I've opened #9536 about enabling it by default.

Closes #8651
Closes #3547
Closes #2537
Closes #6971
Closes #9222
2013-09-26 17:27:23 -04:00
Alex Crichton
daee1b4d5c Ensure that skipped items aren't encoded
If an item is skipped due to it being unreachable or for some optimization, then
it shouldn't be encoded into the metadata (because it wasn't present in the
first place).
2013-09-26 13:54:50 -07:00
Alex Crichton
42bcf638b0 rustdoc: Render stability attributes
Closes #8965
2013-09-26 13:39:06 -07:00
bors
f210a16718 auto merge of #9520 : blake2-ppc/rust/ringbuf-swap, r=thestinger
extra::ringbuf: Implement method `.swap(uint, uint)` just like vector

RingBuf::swap(&mut self, i, j) swaps the element at indices `i` and `j`
if both elements are in bounds, otherwise it fails.
2013-09-26 13:21:08 -07:00
Alex Crichton
6a277dc4ba rustdoc: Strip implementations of private traits
Closes #5416
2013-09-26 12:27:38 -07:00
bors
47f2e80b65 auto merge of #9515 : pnkfelix/rust/fsk-test-for-issue-5153, r=alexcrichton
r? anyone
2013-09-26 12:01:28 -07:00
Alex Crichton
ca697d3705 rustdoc: Generate documentation for foreign items
This slurps up everything inside of an 'extern' block into the enclosing module
in order to document them. The documentation must be on the items themselves,
and they'll show up next to everything else on the module index pages.

Closes #5953
2013-09-26 11:57:25 -07:00
Alex Crichton
c429c7c04b rustdoc: Fix broken struct field search links
Takes the same approach as variants, writes a redirect index page back to the
struct with an anchor to the field in question.

Closes #9524
2013-09-26 11:31:40 -07:00
Steve Klabnik
964da1c9fd Document std::ops.
Added an overview with a 'real' example, as well as toy implementations of all of
the traits.

Closes #9356.
2013-09-26 11:17:34 -07:00
bors
c486634118 auto merge of #9507 : brson/rust/sched, r=alexcrichton
This also includes a fix for yielding from single-threaded schedulers where the scheduler would stop working before its work queue was empty. Fixes the deadlocks that this patch had previously.
2013-09-26 10:46:15 -07:00
bors
6f991a2441 auto merge of #9506 : sfackler/rust/visibility, r=alexcrichton 2013-09-26 09:21:09 -07:00
Branimir
a4b7474461 Fix ICE caused by my previous patch, that is, if super trait had more
methods tnan subtrait, compiling would fail. I simply forgot to update
variable name. Updated test case , too.
2013-09-26 16:59:54 +02:00
bors
0f9bcaf7fe auto merge of #9503 : dcrewi/rust/fix-digest-visibility, r=alexcrichton
I really have no idea why the tests didn't fail. Maybe it's another cross-crate issue?
2013-09-26 06:56:00 -07:00
klutzy
fc44a9c7dd syntax: Fix wrong span on trait fn visibility
Fixes #9348.
2013-09-26 22:48:21 +09:00
klutzy
a56e2eecf5 syntax: Fix wrong span on ObsoleteMode 2013-09-26 22:47:43 +09:00
klutzy
d96dfc9a59 syntax: Fix wrong span on ObsoleteEmptyImpl 2013-09-26 22:47:33 +09:00
kud1ing
3165ddeb40 bitv: backticks for code in documentation 2013-09-26 23:15:42 +10:00
kud1ing
c873216ab6 bigint: backticks for code in documentation 2013-09-26 23:15:42 +10:00
kud1ing
d964f79998 base64: backticks for code in documentation 2013-09-26 23:15:42 +10:00
kud1ing
d798e00337 Enclose code in documentation in backticks 2013-09-26 23:15:42 +10:00
bors
0022f2b204 auto merge of #9500 : fhahn/rust/rename-str_from_bytes-fix, r=alexcrichton
As @Dretch pointed out [here](de39874801 (L2L526)) , from_bytes was accidentally renamed to from_utf8.
2013-09-26 05:36:01 -07:00
bors
930f7790fb auto merge of #9497 : pnkfelix/rust/fsk-7752-use-fcnptr-for-glob-errfunc, r=cmr
Fix #7752.

~~(The glob API is a little funky; I tried to make a small test for it, which I'll add to the end of this description, and its not clear whether globfree is supposed to free solely the structure allocated by glob itself, or if it is going to try to free more than that.)~~ (The previous note was a user-error: I was misusing the CString API.)

Anyway, this seems to work in terms of calling errfunc where expected.)

```rust
#[allow(unused_imports)];
use std::libc::types::os::arch::c95::{c_char, c_int, size_t};
use std::libc::funcs::posix01::glob;
use std::libc::types::os::common::posix01::glob_t;
use std::libc::consts::os::posix01::{GLOB_APPEND, GLOB_DOOFFS, GLOB_ERR,
                                     GLOB_MARK, GLOB_NOCHECK, GLOB_NOSORT,
                                     GLOB_NOESCAPE, GLOB_NOSPACE,
                                     GLOB_ABORTED, GLOB_NOMATCH};
use std::ptr;
use std::c_str;

#[fixed_stack_segment]
fn main() {
    let mut g = glob_t {
        gl_pathc:  0, // size_t,
        __unused1: 0, // c_int,
        gl_offs:   2, // size_t,
        __unused2: 0, // c_int,
        gl_pathv:  ptr::null(), // **c_char,

        __unused3: ptr::null(), // *c_void,

        __unused4: ptr::null(), // *c_void,
        __unused5: ptr::null(), // *c_void,
        __unused6: ptr::null(), // *c_void,
        __unused7: ptr::null(), // *c_void,
        __unused8: ptr::null(), // *c_void,
    };

    extern "C" fn errfunc(_epath: *c_char, _errno: int) -> int {
        println!("errfunc called");
        return 0;
    }

    struct Reduced { pathc: size_t, offs: size_t, pathv: **c_char, }
    impl Reduced {
        fn from(g: &glob_t) -> Reduced {
            Reduced {pathc: g.gl_pathc, offs: g.gl_offs, pathv: g.gl_pathv}
        }
    }

    do ("*.rs/*").with_c_str |pat| {
        println!("calling glob");
        unsafe { glob::glob(pat, GLOB_DOOFFS, errfunc, &mut g); }
        println!("After glob call");

        println!("g: {:?}", Reduced::from(&g));
        for i in range(0, g.gl_pathc as int) {
            unsafe {
                let p : **c_char = ptr::offset(g.gl_pathv, g.gl_offs as int + i);
                let x = c_str::CString::new(*p, false);
                match x.as_str() {
                    Some(s) => {
                        println!("gl_pathc[{:d}]: {:?}", i, s);
                    }
                    None => {
                        println!("gl_pathc[{:d}]: unvalid", i);
                    }
                }
            }
        }
    }

    println!("calling globfree on g: {:?}", g);
    unsafe { glob::globfree(&mut g); }
    println!("after globfree call");

}

```
2013-09-26 04:16:03 -07:00
bors
a8a69ec15d auto merge of #9464 : bmaxa/rust/master, r=cmr
I have tried this fix and it seems to work either with single or multiple trait inheritance.

trait Base:Base2 + Base3{
fn foo(&self);
}

trait Base2 {
fn baz(&self);
}

trait Base3{
fn root(&self);
}

trait Super: Base{
fn bar(&self);
}

struct X;

impl Base for X {
fn foo(&self) {
println("base foo");
}

}
impl Base2 for X {
fn baz(&self) {
println("base2 baz");
}

}
impl Base3 for X {
fn root(&self) {
println("base3 root");
}

}
impl Super for X {
fn bar(&self) {
println("super bar");
}
}

fn main() {
let n = X;
let s = &n as &Super;
s.bar();
s.foo(); // super bar
s.baz();
s.root();
}

bmaxa@maxa:~/examples/rust$ rustc error.rs
bmaxa@maxa:~/examples/rust$ ./error 
super bar
base foo
base2 baz
base3 root
2013-09-26 02:56:03 -07:00
Branimir
56d415aa60 fix for issue #9394
This solves problem of incorrect indexing into vtable
    when method from super trait was called through pointer
    to derived trait.
    Problem was that offset of super trait vtables
    was not calculated at all.
    Now it works, correct offset is calculated by
    traversing all super traits up to super trait
    where method belongs. That is how it is
    intended to work.
2013-09-26 11:14:18 +02:00
bors
a268a1c4bb auto merge of #9490 : alexcrichton/rust/issue-9487, r=cmr
If there's no TLS key just yet, then there's nothing to unsafely borrow, so
continue returning None. This prevents causing the runtime to abort itself when
logging before the runtime is fully initialized.

Closes #9487

r? @brson
2013-09-26 00:30:57 -07:00
Felix S. Klock II
32911f6df5 Regression test for ICE. Fix #5153. 2013-09-26 09:29:43 +02:00
blake2-ppc
57757a8051 extra::ringbuf: Implement method .swap(uint, uint) just like vector
RingBuf::swap(&mut self, i, j) swaps the element at indices `i` and `j`
if both elements are in bounds, otherwise it fails.
2013-09-26 09:25:32 +02:00
bors
5adfa10387 auto merge of #9404 : blake2-ppc/rust/result-map-opt, r=cmr
std::result: Remove function `map_opt`.

This function has never had any users in the tree, so this is my
initiative to remove this function.
2013-09-25 22:30:53 -07:00
bors
33fef9934b auto merge of #9392 : Kimundi/rust/str_docs, r=cmr
Moved `StrSlice` doc comments from impl to trait.
Moved `OwnedStr` doc comments from impl to trait.
Normalized a few `StrSlice` method names from `FOO_reverse`, `FOO_rev` and `rFOO` to `FOO_rev`.
Added a few `#[inline]` hints.

The doc comment changes make the source a bit harder to read, as documentation and implementation no longer live right next to each other. But this way they at least appear in the docs.
2013-09-25 21:10:57 -07:00
Brian Anderson
d209717ddd std::rt: Implement task yielding. Fix a starvation problem 2013-09-25 20:05:56 -07:00
bors
8a4f0fa6c5 auto merge of #9499 : brson/rust/relnotes, r=cmr 2013-09-25 19:50:56 -07:00
Marvin Löbel
e94b3fae39 Moved StrSlice doc comments from impl to trait.
Moved OwnedStr doc comments from impl to trait.
Added a few #[inline] hints.

The doc comment changes make the source a bit harder to read, as
documentation and implementation no longer live right next to each
other. But this way they at least appear in the docs.
2013-09-26 04:44:36 +02:00