Commit Graph

22776 Commits

Author SHA1 Message Date
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
Steven Fackler
d8957e6332 Some struct visibility fixes 2013-09-25 19:42:02 -07:00
bors
00db6f6e7b auto merge of #9502 : brson/rust/fix-logo-icon, r=brson 2013-09-25 17:55:53 -07:00
David Creswick
252c6dbe85 Fix visibility of digest implementations 2013-09-25 19:39:17 -05:00
Alex Crichton
eb2b25dd6d Refactor the logging system for fewer allocations
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-25 16:30:05 -07:00
bors
41826c48ed auto merge of #9475 : alexcrichton/rust/rustdoc++, r=cmr
The commit messages are a good technical summary, a good visual summary (contrib is this version):

Pub use statements now rendered. Notice how almost all components are also clickable!
* http://static.rust-lang.org/doc/master/std/prelude/index.html
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/prelude/index.html

Private things hidden by default (for at least some approximation of privacy). I hope to improve this once privacy is totally ironed out.
* http://static.rust-lang.org/doc/master/std/hashmap/struct.HashMap.html
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/std/hashmap/struct.HashMap.html

Unindentation now works properly:
* http://static.rust-lang.org/doc/master/extra/getopts/index.html
* http://www.contrib.andrew.cmu.edu/~acrichto/doc/extra/getopts/index.html

Also sundown has massively reduced compilation time (of docs, not the of the crates)
2013-09-25 15:40:52 -07:00
Brian Anderson
e82db13760 Fix the rust logo icon 2013-09-25 15:21:37 -07:00
Felix S. Klock II
ee74ccb101 stop fighting with rust logo filetype. 2013-09-25 23:52:08 +02:00
Felix S. Klock II
48b4b1f52c errfunc ptr is nullable, so use Option as part of interface to glob (#7752). 2013-09-25 23:38:59 +02:00
Alex Crichton
3d5873fa42 rustdoc: Fix merge fallout 2013-09-25 14:28:20 -07:00
Alex Crichton
38eab97d16 rustdoc: Fix an unindentation bug when collapsing
Turns out eagerly trimming comes back to bite you :(
2013-09-25 14:27:43 -07:00
Alex Crichton
bcb8657842 rustdoc: Collapse before unindenting
Doesn't make much sense to unindent each line individually and *then* collapse
them all together.
2013-09-25 14:27:43 -07:00
Alex Crichton
e7fa081c18 rustdoc: Reduce ambiguity with clean::Type
The "Unresolved" variant could be completely removed becuase it turns out that
the interim state only very briefly lives.
2013-09-25 14:27:43 -07:00
Alex Crichton
f648690234 rustdoc: Strip hidden docs by default. 2013-09-25 14:27:43 -07:00
Alex Crichton
c4219a4783 rustdoc: Highlight function names
Closes #9460
2013-09-25 14:27:42 -07:00
Alex Crichton
5636ca625e rustdoc: Start rendering variants (redirect to enum)
This allows reasonable behavior when an enum is clicked in an import.
2013-09-25 14:27:42 -07:00
Alex Crichton
5c6f8a976f rustdoc: Linkify all reexports.
This way each component of a reexport path is click-able to the destination that
it's referencing.
2013-09-25 14:27:42 -07:00
Alex Crichton
c838351ba6 rustdoc: Implement stripping based on privacy
This will probably need to get tweaked once the privacy rules have been fully
agreed on, but for now this has all of the infrastructure necessary for
filtering out private items.

Closes #9410
2013-09-25 14:27:42 -07:00
Alex Crichton
acab4a8c8e rustdoc: Emit purity to function dox for traits
Closes #3804
2013-09-25 14:27:42 -07:00
Alex Crichton
eaaf2bd41f rustdoc: Add the ability to list all passes
In doing so, also remove the collapse-privacy pass because it's a little
over-zealous and may not be right 100% of the time (not used right now as well)
2013-09-25 14:27:42 -07:00
Alex Crichton
bcc7daa6bc rustdoc: Improve comment stripping
There is less implicit removal of various comment styles, and it also removes
extraneous stars occasionally found in docblock comments. It turns out that the
bug for getops was just a differently formatted block.

Closes #9425
Closes #9417
2013-09-25 14:27:42 -07:00
Alex Crichton
35c0cdff5a rustdoc: Enable various useful markdown extensions 2013-09-25 14:27:42 -07:00
Alex Crichton
3585c64d09 rustdoc: Change all code-blocks with a script
find src -name '*.rs' | xargs sed -i '' 's/~~~.*{\.rust}/```rust/g'
    find src -name '*.rs' | xargs sed -i '' 's/ ~~~$/ ```/g'
    find src -name '*.rs' | xargs sed -i '' 's/^~~~$/ ```/g'
2013-09-25 14:27:42 -07:00
Alex Crichton
db28c29980 rustdoc: Use sundown for markdown highlighting
This takes rendering times of documentation down from 30s to 0.5s. Kinda sad
that none of the parallelism is needed, but oh well!

Closes #7380
cc #3546
2013-09-25 14:27:42 -07:00
Alex Crichton
6aba140fa7 rustdoc: Add sundown to src/rt/
This also starts compiling it in the same manner as linenoise, it's just bundled
with librustrt directly, and we export just a few symbols out of it.
2013-09-25 14:27:41 -07:00
bors
24d46a0f45 auto merge of #9345 : Dretch/rust/digest-result-bytes, r=cmr
I would find this function useful.
2013-09-25 14:25:52 -07:00
Florian Hahn
23a067dc2c Rename from_utf8 to from_bytes again 2013-09-25 22:58:57 +02:00
bors
af25f58ac3 auto merge of #9498 : catamorphism/rust/rust-path-hack-fix, r=cmr,metajack
r? @metajack
2013-09-25 12:45:54 -07:00
Alex Crichton
324418f32b Don't die in try_unsafe_borrow if tls isn't ready
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
2013-09-25 11:40:30 -07:00
Brian Anderson
a05de31ae9 0.8 will be in September 2013-09-25 11:38:44 -07:00