]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #9459 : eliovir/rust/patch-1, r=bstrie
bors [Sat, 28 Sep 2013 12:26:04 +0000 (05:26 -0700)]
auto merge of #9459 : eliovir/rust/patch-1, r=bstrie

change formula (other solution could be using abs()).

10 years agoauto merge of #9574 : FlaPer87/rust/suppress_warnings, r=metajack
bors [Sat, 28 Sep 2013 06:51:03 +0000 (23:51 -0700)]
auto merge of #9574 : FlaPer87/rust/suppress_warnings, r=metajack

Small change that suppresses a warning because of an unused import.

10 years agoauto merge of #9562 : alexcrichton/rust/snapshots, r=thestinger
bors [Sat, 28 Sep 2013 04:56:04 +0000 (21:56 -0700)]
auto merge of #9562 : alexcrichton/rust/snapshots, r=thestinger

10 years agoauto merge of #9559 : sfackler/rust/more-visibility, r=alexcrichton
bors [Sat, 28 Sep 2013 03:31:05 +0000 (20:31 -0700)]
auto merge of #9559 : sfackler/rust/more-visibility, r=alexcrichton

10 years agoauto merge of #9557 : blake2-ppc/rust/vec-lifetime-token, r=thestinger
bors [Sat, 28 Sep 2013 02:16:05 +0000 (19:16 -0700)]
auto merge of #9557 : blake2-ppc/rust/vec-lifetime-token, r=thestinger

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.

10 years agoauto merge of #9556 : alexcrichton/rust/less-at-mut, r=luqmana
bors [Sat, 28 Sep 2013 00:56:06 +0000 (17:56 -0700)]
auto merge of #9556 : alexcrichton/rust/less-at-mut, r=luqmana

Instead use &mut everywhere as much as possible and then reorganize lots of code
to get past the borrow checker.

10 years agoauto merge of #9553 : brson/rust/lesscxx, r=thestinger
bors [Fri, 27 Sep 2013 23:16:03 +0000 (16:16 -0700)]
auto merge of #9553 : brson/rust/lesscxx, r=thestinger

10 years agoauto merge of #9552 : brson/rust/0.9-pre, r=alexcrichton
bors [Fri, 27 Sep 2013 20:51:07 +0000 (13:51 -0700)]
auto merge of #9552 : brson/rust/0.9-pre, r=alexcrichton

10 years agoSuppress warning by removing unused import
Flavio Percoco [Fri, 27 Sep 2013 19:36:14 +0000 (21:36 +0200)]
Suppress warning by removing unused import

10 years agoauto merge of #9549 : catamorphism/rust/rustpkg-test-command, r=catamorphism,metajack
bors [Fri, 27 Sep 2013 19:31:04 +0000 (12:31 -0700)]
auto merge of #9549 : catamorphism/rust/rustpkg-test-command, r=catamorphism,metajack

r? @metajack Towards #7401

10 years agoauto merge of #9544 : alexcrichton/rust/clean-docs, r=pnkfelix
bors [Fri, 27 Sep 2013 18:11:06 +0000 (11:11 -0700)]
auto merge of #9544 : alexcrichton/rust/clean-docs, r=pnkfelix

This purges doc/{std,extra} entirely during a `make clean` instead of just the
html files in some top level directories. This should help old documentation
from showing up on static.rust-lang.org

10 years agomk: Fully clean out old documentation
Alex Crichton [Thu, 26 Sep 2013 22:13:03 +0000 (15:13 -0700)]
mk: Fully clean out old documentation

This purges doc/{std,extra} entirely during a `make clean` instead of just the
html files in some top level directories. This should help old documentation
from showing up on static.rust-lang.org

10 years agoauto merge of #9535 : alexcrichton/rust/no-format-default, r=thestinger
bors [Fri, 27 Sep 2013 16:41:07 +0000 (09:41 -0700)]
auto merge of #9535 : alexcrichton/rust/no-format-default, r=thestinger

As mentioned in #9456, the format! syntax extension would previously consider an
empty format as a 'Unknown' format which could then also get coerced into a
different style of format on another argument.

This is unusual behavior because `{}` is a very common format and if you have
`{0} {0:?}` you wouldn't expect them both to be coereced to the `Poly`
formatter. This commit removes this coercion, but still retains the requirement
that each argument has exactly one format specified for it (an empty format now
counts as well).

Perhaps at a later date we can add support for multiple formats of one argument,
but this puts us in at least a backwards-compatible situation if we decide to do
that.

10 years agoRemove the notion of an "unknown format"
Alex Crichton [Thu, 26 Sep 2013 20:44:54 +0000 (13:44 -0700)]
Remove the notion of an "unknown format"

As mentioned in #9456, the format! syntax extension would previously consider an
empty format as a 'Unknown' format which could then also get coerced into a
different style of format on another argument.

This is unusual behavior because `{}` is a very common format and if you have
`{0} {0:?}` you wouldn't expect them both to be coereced to the `Poly`
formatter. This commit removes this coercion, but still retains the requirement
that each argument has exactly one format specified for it (an empty format now
counts as well).

Perhaps at a later date we can add support for multiple formats of one argument,
but this puts us in at least a backwards-compatible situation if we decide to do
that.

10 years agorustpkg: Implement `rustpkg test`
Tim Chevalier [Thu, 26 Sep 2013 23:04:49 +0000 (16:04 -0700)]
rustpkg: Implement `rustpkg test`

Towards #7401

10 years agoauto merge of #9550 : alexcrichton/rust/remove-printf, r=thestinger
bors [Fri, 27 Sep 2013 15:21:23 +0000 (08:21 -0700)]
auto merge of #9550 : alexcrichton/rust/remove-printf, r=thestinger

The 0.8 release was cut, down with printf!

10 years agoauto merge of #9548 : thestinger/rust/internal, r=alexcrichton
bors [Fri, 27 Sep 2013 13:21:22 +0000 (06:21 -0700)]
auto merge of #9548 : thestinger/rust/internal, r=alexcrichton

Closes #9494

10 years agoauto merge of #9540 : alexcrichton/rust/more-rustdoc-improvements, r=brson
bors [Fri, 27 Sep 2013 11:51:13 +0000 (04:51 -0700)]
auto merge of #9540 : alexcrichton/rust/more-rustdoc-improvements, r=brson

Commit messages have the details, mostly just knocking out more low-hanging-fruit type issues.

10 years agoauto merge of #9538 : thestinger/rust/type_use, r=pcwalton
bors [Fri, 27 Sep 2013 10:31:13 +0000 (03:31 -0700)]
auto merge of #9538 : thestinger/rust/type_use, r=pcwalton

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

10 years agoauto merge of #9527 : bmaxa/rust/master, r=alexcrichton
bors [Fri, 27 Sep 2013 08:36:15 +0000 (01:36 -0700)]
auto merge of #9527 : bmaxa/rust/master, r=alexcrichton

that is, if super trait had more methods, tnen subtrait, compiling would fail. I simply forgot to update
variable name. Updated test case , too.

10 years agoRegister new snapshots
Alex Crichton [Thu, 26 Sep 2013 22:38:54 +0000 (15:38 -0700)]
Register new snapshots

10 years agoauto merge of #9352 : erickt/rust/master, r=huonw
bors [Fri, 27 Sep 2013 06:51:13 +0000 (23:51 -0700)]
auto merge of #9352 : erickt/rust/master, r=huonw

One of the downsides with `c_str` is that it always forces an allocation, and so this could add unnecessary overhead to various calls. This PR implements one of the suggestions @graydon made in #8296 for `vec.with_c_str` in that for a short string can use a small stack array instead of a malloced array for our temporary c string. This ends up being twice as fast for small strings.

There are two things to consider before landing this commit though. First off, I arbitrarily picked the stack array as 32 bytes, and I'm not sure if this a reasonable amount or not. Second, there is a risk that someone can keep a reference to the interior stack pointer, which could cause mayhem if someone were to dereference the pointer. Since we also can easily grab and return interior pointers to vecs though, I don't think this is that much of an issue.

10 years agostd: simplify vec.with_c_str
Erick Tryzelaar [Fri, 27 Sep 2013 05:49:10 +0000 (22:49 -0700)]
std: simplify vec.with_c_str

This also fixes a bug in `vec.with_c_str_unchecked` where we
were not calling `.to_c_str_unchecked()` for long strings.

10 years agostd: add micro optimization to vec.with_c_str_unchecked
Erick Tryzelaar [Fri, 20 Sep 2013 23:48:07 +0000 (16:48 -0700)]
std: add micro optimization to vec.with_c_str_unchecked

before:

test c_str::bench::bench_with_c_str_unchecked_long ... bench: 361 ns/iter (+/- 9)
test c_str::bench::bench_with_c_str_unchecked_medium ... bench: 75 ns/iter (+/- 2)
test c_str::bench::bench_with_c_str_unchecked_short ... bench: 60 ns/iter (+/- 9)

after:

test c_str::bench::bench_with_c_str_unchecked_long ... bench: 362 ns/iter (+/-
test c_str::bench::bench_with_c_str_unchecked_medium ... bench: 30 ns/iter (+/- 7)
test c_str::bench::bench_with_c_str_unchecked_short ... bench: 12 ns/iter (+/- 4)

10 years agostd: Up vec.with_c_str's stack buffer to 128
Erick Tryzelaar [Fri, 20 Sep 2013 20:25:02 +0000 (13:25 -0700)]
std: Up vec.with_c_str's stack buffer to 128

This matches @graydon's recommendation.

10 years agostd: Remove an unnecessary comment from c_str
Erick Tryzelaar [Fri, 20 Sep 2013 20:24:23 +0000 (13:24 -0700)]
std: Remove an unnecessary comment from c_str

The documentation for `.with_c_str()` already says that the pointer
will be deallocated before returning from the function.

10 years agostd: Micro-optimize vec.with_c_str for short vectors
Erick Tryzelaar [Wed, 18 Sep 2013 19:32:35 +0000 (12:32 -0700)]
std: Micro-optimize vec.with_c_str for short vectors

This now makes it unsafe to save the pointer returned by .with_c_str
as that pointer now may be pointing at a stack allocated array.

I arbitrarily chose 32 bytes as the length of the stack vector, and
so it might not be the most optimal size.

before:

test c_str::bench::bench_with_c_str_long ... bench: 539 ns/iter (+/- 91)
test c_str::bench::bench_with_c_str_medium ... bench: 97 ns/iter (+/- 2)
test c_str::bench::bench_with_c_str_short ... bench: 70 ns/iter (+/- 5)

after:

test c_str::bench::bench_with_c_str_long ... bench: 542 ns/iter (+/- 13)
test c_str::bench::bench_with_c_str_medium ... bench: 53 ns/iter (+/- 6)
test c_str::bench::bench_with_c_str_short ... bench: 19 ns/iter (+/- 0)

10 years agostd: Add benchmarks to c_str
Erick Tryzelaar [Wed, 18 Sep 2013 19:32:45 +0000 (12:32 -0700)]
std: Add benchmarks to c_str

10 years agostd: implement Container for CString
Erick Tryzelaar [Wed, 18 Sep 2013 19:21:30 +0000 (12:21 -0700)]
std: implement Container for CString

10 years agostd: removed some warnings in tests.
Erick Tryzelaar [Wed, 18 Sep 2013 18:45:17 +0000 (11:45 -0700)]
std: removed some warnings in tests.

10 years agostd and rustc: Convert users of c_str to use .with_c_str
Erick Tryzelaar [Wed, 18 Sep 2013 17:54:43 +0000 (10:54 -0700)]
std and rustc: Convert users of c_str to use .with_c_str

10 years agoauto merge of #9525 : klutzy/rust/obsolete-span-fix, r=alexcrichton
bors [Fri, 27 Sep 2013 05:11:14 +0000 (22:11 -0700)]
auto merge of #9525 : klutzy/rust/obsolete-span-fix, r=alexcrichton

10 years agoVisibility fixes
Steven Fackler [Fri, 27 Sep 2013 04:22:22 +0000 (21:22 -0700)]
Visibility fixes

10 years agostd::vec: Use a valid value as lifetime dummy in iterator
blake2-ppc [Fri, 27 Sep 2013 03:50:33 +0000 (05:50 +0200)]
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.

10 years agoRemove `@mut Resolver`
Alex Crichton [Fri, 27 Sep 2013 02:10:16 +0000 (19:10 -0700)]
Remove `@mut Resolver`

Instead use &mut everywhere as much as possible and then reorganize lots of code
to get past the borrow checker.

10 years agoauto merge of #9523 : huonw/rust/kud1ing-docs, r=huonw
bors [Fri, 27 Sep 2013 03:06:09 +0000 (20:06 -0700)]
auto merge of #9523 : huonw/rust/kud1ing-docs, r=huonw

Collation of @kud1ing's work in #9511, #9512, #9513 and #9518.

10 years agoauto merge of #9504 : brson/rust/continue, r=alexcrichton
bors [Fri, 27 Sep 2013 01:46:10 +0000 (18:46 -0700)]
auto merge of #9504 : brson/rust/continue, r=alexcrichton

10 years agoRemove a little bit of unused C++
Brian Anderson [Fri, 27 Sep 2013 01:40:13 +0000 (18:40 -0700)]
Remove a little bit of unused C++

10 years agoUpdate version numbers to 0.9-pre
Brian Anderson [Fri, 27 Sep 2013 01:18:42 +0000 (18:18 -0700)]
Update version numbers to 0.9-pre

10 years agoauto merge of #9261 : alexcrichton/rust/logging, r=huonw
bors [Fri, 27 Sep 2013 00:11:13 +0000 (17:11 -0700)]
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.

10 years agoUpdate the compiler to not use printf/printfln
Alex Crichton [Wed, 25 Sep 2013 05:16:43 +0000 (22:16 -0700)]
Update the compiler to not use printf/printfln

10 years agoRemove the printf{,ln}! macros
Alex Crichton [Wed, 25 Sep 2013 01:32:56 +0000 (18:32 -0700)]
Remove the printf{,ln}! macros

These are deprecated in favor of print{,ln}!

10 years agomark globals as internal when not building a library
Daniel Micay [Thu, 26 Sep 2013 22:43:21 +0000 (18:43 -0400)]
mark globals as internal when not building a library

Closes #9494

10 years agoauto merge of #9484 : alexcrichton/rust/fix-cfg-inner-item, r=pcwalton
bors [Thu, 26 Sep 2013 22:36:10 +0000 (15:36 -0700)]
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).

10 years agoAdd 'continue' keyword to emacs, vim, gedit, kate
Brian Anderson [Thu, 26 Sep 2013 22:04:43 +0000 (15:04 -0700)]
Add 'continue' keyword to emacs, vim, gedit, kate

10 years agoAdd 'continue' as a synonym for 'loop'
Brian Anderson [Thu, 26 Sep 2013 00:56:54 +0000 (17:56 -0700)]
Add 'continue' as a synonym for 'loop'

10 years agoremove type_use
Daniel Micay [Thu, 26 Sep 2013 20:54:15 +0000 (16:54 -0400)]
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

10 years agoEnsure that skipped items aren't encoded
Alex Crichton [Wed, 25 Sep 2013 01:18:40 +0000 (18:18 -0700)]
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).

10 years agorustdoc: Render stability attributes
Alex Crichton [Thu, 26 Sep 2013 19:53:06 +0000 (12:53 -0700)]
rustdoc: Render stability attributes

Closes #8965

10 years agoauto merge of #9520 : blake2-ppc/rust/ringbuf-swap, r=thestinger
bors [Thu, 26 Sep 2013 20:21:08 +0000 (13:21 -0700)]
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.

10 years agorustdoc: Strip implementations of private traits
Alex Crichton [Thu, 26 Sep 2013 19:27:38 +0000 (12:27 -0700)]
rustdoc: Strip implementations of private traits

Closes #5416

10 years agoauto merge of #9515 : pnkfelix/rust/fsk-test-for-issue-5153, r=alexcrichton
bors [Thu, 26 Sep 2013 19:01:28 +0000 (12:01 -0700)]
auto merge of #9515 : pnkfelix/rust/fsk-test-for-issue-5153, r=alexcrichton

r? anyone

10 years agorustdoc: Generate documentation for foreign items
Alex Crichton [Thu, 26 Sep 2013 18:57:25 +0000 (11:57 -0700)]
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

10 years agorustdoc: Fix broken struct field search links
Alex Crichton [Thu, 26 Sep 2013 18:09:47 +0000 (11:09 -0700)]
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

10 years agoauto merge of #9507 : brson/rust/sched, r=alexcrichton
bors [Thu, 26 Sep 2013 17:46:15 +0000 (10:46 -0700)]
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.

10 years agoauto merge of #9506 : sfackler/rust/visibility, r=alexcrichton
bors [Thu, 26 Sep 2013 16:21:09 +0000 (09:21 -0700)]
auto merge of #9506 : sfackler/rust/visibility, r=alexcrichton

10 years agoFix ICE caused by my previous patch, that is, if super trait had more
Branimir [Thu, 26 Sep 2013 14:59:54 +0000 (16:59 +0200)]
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.

10 years agoauto merge of #9503 : dcrewi/rust/fix-digest-visibility, r=alexcrichton
bors [Thu, 26 Sep 2013 13:56:00 +0000 (06:56 -0700)]
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?

10 years agosyntax: Fix wrong span on trait fn visibility
klutzy [Thu, 26 Sep 2013 13:44:45 +0000 (22:44 +0900)]
syntax: Fix wrong span on trait fn visibility

Fixes #9348.

10 years agosyntax: Fix wrong span on ObsoleteMode
klutzy [Thu, 26 Sep 2013 13:35:41 +0000 (22:35 +0900)]
syntax: Fix wrong span on ObsoleteMode

10 years agosyntax: Fix wrong span on ObsoleteEmptyImpl
klutzy [Thu, 26 Sep 2013 13:24:27 +0000 (22:24 +0900)]
syntax: Fix wrong span on ObsoleteEmptyImpl

10 years agobitv: backticks for code in documentation
kud1ing [Thu, 26 Sep 2013 08:33:02 +0000 (10:33 +0200)]
bitv: backticks for code in documentation

10 years agobigint: backticks for code in documentation
kud1ing [Thu, 26 Sep 2013 06:12:30 +0000 (08:12 +0200)]
bigint: backticks for code in documentation

10 years agobase64: backticks for code in documentation
kud1ing [Thu, 26 Sep 2013 05:57:26 +0000 (07:57 +0200)]
base64: backticks for code in documentation

10 years agoEnclose code in documentation in backticks
kud1ing [Thu, 26 Sep 2013 05:51:19 +0000 (07:51 +0200)]
Enclose code in documentation in backticks

10 years agoauto merge of #9500 : fhahn/rust/rename-str_from_bytes-fix, r=alexcrichton
bors [Thu, 26 Sep 2013 12:36:01 +0000 (05:36 -0700)]
auto merge of #9500 : fhahn/rust/rename-str_from_bytes-fix, r=alexcrichton

As @Dretch pointed out [here](https://github.com/fhahn/rust/commit/de39874801761197bf10bf8d04bde1aa2bd82e15#L2L526) , from_bytes was accidentally renamed to from_utf8.

10 years agoauto merge of #9497 : pnkfelix/rust/fsk-7752-use-fcnptr-for-glob-errfunc, r=cmr
bors [Thu, 26 Sep 2013 11:16:03 +0000 (04:16 -0700)]
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");

}

```

10 years agoauto merge of #9464 : bmaxa/rust/master, r=cmr
bors [Thu, 26 Sep 2013 09:56:03 +0000 (02:56 -0700)]
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

10 years ago fix for issue #9394
Branimir [Wed, 25 Sep 2013 21:55:38 +0000 (23:55 +0200)]
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.

10 years agoauto merge of #9490 : alexcrichton/rust/issue-9487, r=cmr
bors [Thu, 26 Sep 2013 07:30:57 +0000 (00:30 -0700)]
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

10 years agoRegression test for ICE. Fix #5153.
Felix S. Klock II [Thu, 26 Sep 2013 07:29:43 +0000 (09:29 +0200)]
Regression test for ICE.  Fix #5153.

10 years agoextra::ringbuf: Implement method `.swap(uint, uint)` just like vector
blake2-ppc [Thu, 26 Sep 2013 07:19:26 +0000 (09:19 +0200)]
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.

10 years agoauto merge of #9404 : blake2-ppc/rust/result-map-opt, r=cmr
bors [Thu, 26 Sep 2013 05:30:53 +0000 (22:30 -0700)]
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.

10 years agoauto merge of #9392 : Kimundi/rust/str_docs, r=cmr
bors [Thu, 26 Sep 2013 04:10:57 +0000 (21:10 -0700)]
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.

10 years agostd::rt: Implement task yielding. Fix a starvation problem
Brian Anderson [Sat, 21 Sep 2013 01:49:31 +0000 (18:49 -0700)]
std::rt: Implement task yielding. Fix a starvation problem

10 years agoauto merge of #9499 : brson/rust/relnotes, r=cmr
bors [Thu, 26 Sep 2013 02:50:56 +0000 (19:50 -0700)]
auto merge of #9499 : brson/rust/relnotes, r=cmr

10 years agoMoved StrSlice doc comments from impl to trait.
Marvin Löbel [Wed, 25 Sep 2013 23:18:50 +0000 (01:18 +0200)]
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.

10 years agoSome struct visibility fixes
Steven Fackler [Thu, 26 Sep 2013 02:42:02 +0000 (19:42 -0700)]
Some struct visibility fixes

10 years agoauto merge of #9502 : brson/rust/fix-logo-icon, r=brson
bors [Thu, 26 Sep 2013 00:55:53 +0000 (17:55 -0700)]
auto merge of #9502 : brson/rust/fix-logo-icon, r=brson

10 years agoFix visibility of digest implementations
David Creswick [Wed, 25 Sep 2013 23:34:09 +0000 (18:34 -0500)]
Fix visibility of digest implementations

10 years agoRefactor the logging system for fewer allocations
Alex Crichton [Wed, 28 Aug 2013 08:33:48 +0000 (01:33 -0700)]
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.

10 years agoauto merge of #9475 : alexcrichton/rust/rustdoc++, r=cmr
bors [Wed, 25 Sep 2013 22:40:52 +0000 (15:40 -0700)]
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)

10 years agoFix the rust logo icon
Brian Anderson [Wed, 25 Sep 2013 22:21:37 +0000 (15:21 -0700)]
Fix the rust logo icon

10 years agostop fighting with rust logo filetype.
Felix S. Klock II [Wed, 25 Sep 2013 21:51:33 +0000 (23:51 +0200)]
stop fighting with rust logo filetype.

10 years agoerrfunc ptr is nullable, so use Option as part of interface to glob (#7752).
Felix S. Klock II [Wed, 25 Sep 2013 21:38:59 +0000 (23:38 +0200)]
errfunc ptr is nullable, so use Option as part of interface to glob (#7752).

10 years agorustdoc: Fix merge fallout
Alex Crichton [Wed, 25 Sep 2013 21:28:20 +0000 (14:28 -0700)]
rustdoc: Fix merge fallout

10 years agorustdoc: Fix an unindentation bug when collapsing
Alex Crichton [Tue, 24 Sep 2013 23:53:21 +0000 (16:53 -0700)]
rustdoc: Fix an unindentation bug when collapsing

Turns out eagerly trimming comes back to bite you :(

10 years agorustdoc: Collapse before unindenting
Alex Crichton [Tue, 24 Sep 2013 23:08:07 +0000 (16:08 -0700)]
rustdoc: Collapse before unindenting

Doesn't make much sense to unindent each line individually and *then* collapse
them all together.

10 years agorustdoc: Reduce ambiguity with clean::Type
Alex Crichton [Tue, 24 Sep 2013 20:53:09 +0000 (13:53 -0700)]
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.

10 years agorustdoc: Strip hidden docs by default.
Alex Crichton [Tue, 24 Sep 2013 21:09:11 +0000 (14:09 -0700)]
rustdoc: Strip hidden docs by default.

10 years agorustdoc: Highlight function names
Alex Crichton [Tue, 24 Sep 2013 21:07:13 +0000 (14:07 -0700)]
rustdoc: Highlight function names

Closes #9460

10 years agorustdoc: Start rendering variants (redirect to enum)
Alex Crichton [Tue, 24 Sep 2013 20:57:31 +0000 (13:57 -0700)]
rustdoc: Start rendering variants (redirect to enum)

This allows reasonable behavior when an enum is clicked in an import.

10 years agorustdoc: Linkify all reexports.
Alex Crichton [Tue, 24 Sep 2013 20:56:52 +0000 (13:56 -0700)]
rustdoc: Linkify all reexports.

This way each component of a reexport path is click-able to the destination that
it's referencing.

10 years agorustdoc: Implement stripping based on privacy
Alex Crichton [Tue, 24 Sep 2013 20:55:22 +0000 (13:55 -0700)]
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

10 years agorustdoc: Emit purity to function dox for traits
Alex Crichton [Tue, 24 Sep 2013 03:38:17 +0000 (20:38 -0700)]
rustdoc: Emit purity to function dox for traits

Closes #3804

10 years agorustdoc: Add the ability to list all passes
Alex Crichton [Mon, 23 Sep 2013 23:25:58 +0000 (16:25 -0700)]
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)

10 years agorustdoc: Improve comment stripping
Alex Crichton [Mon, 23 Sep 2013 21:18:26 +0000 (14:18 -0700)]
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

10 years agorustdoc: Enable various useful markdown extensions
Alex Crichton [Tue, 24 Sep 2013 00:52:57 +0000 (17:52 -0700)]
rustdoc: Enable various useful markdown extensions

10 years agorustdoc: Change all code-blocks with a script
Alex Crichton [Tue, 24 Sep 2013 00:20:36 +0000 (17:20 -0700)]
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'

10 years agorustdoc: Use sundown for markdown highlighting
Alex Crichton [Mon, 23 Sep 2013 23:55:48 +0000 (16:55 -0700)]
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