Commit Graph

23884 Commits

Author SHA1 Message Date
bors
32f6c11dfa auto merge of #10557 : huonw/rust/inline-deriving, r=pcwalton
ToStr, Encodable and Decodable are not marked as such, since they're
already expensive, and lead to large methods, so inlining will bloat the
metadata & the binaries.

This means that something like

    #[deriving(Eq)]
    struct A { x: int }

creates an instance like

    #[doc = "Automatically derived."]
    impl ::std::cmp::Eq for A {
        #[inline]
        fn eq(&self, __arg_0: &A) -> ::bool {
            match *__arg_0 {
                A{x: ref __self_1_0} =>
                match *self {
                    A{x: ref __self_0_0} => true && __self_0_0.eq(__self_1_0)
                }
            }
        }
        #[inline]
        fn ne(&self, __arg_0: &A) -> ::bool {
            match *__arg_0 {
                A{x: ref __self_1_0} =>
                match *self {
                    A{x: ref __self_0_0} => false || __self_0_0.ne(__self_1_0)
                }
            }
        }
    }

(The change being the `#[inline]` attributes.)
2013-11-19 04:06:25 -08:00
bors
c4e28ae068 auto merge of #10542 : huonw/rust/open01, r=alexcrichton
Provide `Closed01` and `Open01` that generate directly from the
closed/open intervals from 0 to 1, in contrast to the plain impls for
f32 and f64 which generate the half-open [0,1).

Fixes #7755.
2013-11-19 00:26:27 -08:00
bors
f4c22f75d4 auto merge of #10561 : pcwalton/rust/procify, r=alexcrichton
r? @alexcrichton
2013-11-18 23:06:29 -08:00
bors
f5f5d5aac7 auto merge of #10479 : alexcrichton/rust/native-mutex.rs, r=cmr
This adds a new `std::unstable::mutex` module which contains bindings to the platform-provided mutexes. This module is pretty much entirely unsafe to use, but is critical for the runtime and dropping our C++ dependency.

The actual implementation is to do a compare-and-swap on an initially uninitialized pointer. Pthreads does allow for static initialization, so this wouldn't be necessary if we had all the proper headers and whatnot, but windows it looks like will always require some sort of compare-and-swap operation. For now, I didn't want to have to define all the pthreads headers, so I continue to just malloc the pthreads lock/cvar.

After this, there's only one remaining C++ component of rust, and that's unwinding.
2013-11-18 21:51:31 -08:00
Alex Crichton
508b7b996e Move runtime files to C instead of C++
Explicitly have the only C++ portion of the runtime be one file with exception
handling. All other runtime files must now live in C and be fully defined in C.
2013-11-18 21:45:58 -08:00
Alex Crichton
e8bf078802 Remove the C++ lock_and_signal type
A the same time this purges all runtime support needed for statically
initialized mutexes, moving all users over to the new Mutex type instead.
2013-11-18 20:06:40 -08:00
Alex Crichton
24eb1b445d Implement a native mutex type
This mutex is built on top of pthreads for unix and the related windows apis on
windows. This is a straight port of the lock_and_signal type from C++ to rust.
Almost all operations on the type are unsafe, and it's definitely not
recommended for general use.

Closes #9105
2013-11-18 20:06:39 -08:00
bors
ab7fe9dd06 auto merge of #10458 : yichoi/rust/make_check_pass_android2, r=brson
To enable test on android bot #9120

 workcache::test disabled and run-pass/core-run-destroy.rs fixed on android
2013-11-18 18:56:31 -08:00
Patrick Walton
f977bedafd libsyntax: Remove ~fn() from the language 2013-11-18 18:28:10 -08:00
Patrick Walton
ba739b2135 librustc: Convert ~fn() to proc() everywhere. 2013-11-18 18:27:31 -08:00
Patrick Walton
77f621bff4 librustc: Remove the one use of ~fn() 2013-11-18 18:27:30 -08:00
Patrick Walton
6a5736d704 libextra: Remove ~fn() from libextra. 2013-11-18 18:27:30 -08:00
Patrick Walton
500a8f15c9 libstd: Change all ~fn()s to procs in the standard library.
This makes `Cell`s no longer necessary in most cases.
2013-11-18 18:27:30 -08:00
bors
2a984c92a8 auto merge of #10440 : brson/rust/cnamespace, r=bstrie 2013-11-18 17:46:32 -08:00
bors
7fc3e82aae auto merge of #10366 : brson/rust/ignore-patterns, r=alexcrichton
This replaces `*` with `..` in enums, `_` with `..` in structs, and `.._` with `..` in vectors. It adds obsolete syntax warnings for the old forms but doesn't turn them on yet because we need a snapshot.

#5830
2013-11-18 16:36:33 -08:00
Brian Anderson
85f107d8cb Use '..' as slice wildcard in vectors 2013-11-18 16:19:48 -08:00
Brian Anderson
35e6c02524 Use '..' as multi-field wildcard in enums and structs. 2013-11-18 16:19:46 -08:00
Huon Wilson
df0f50381c Mark some derived methods as #[inline].
ToStr, Encodable and Decodable are not marked as such, since they're
already expensive, and lead to large methods, so inlining will bloat the
metadata & the binaries.

This means that something like

    #[deriving(Eq)]
    struct A { x: int }

creates an instance like

    #[doc = "Automatically derived."]
    impl ::std::cmp::Eq for A {
        #[inline]
        fn eq(&self, __arg_0: &A) -> ::bool {
            match *__arg_0 {
                A{x: ref __self_1_0} =>
                match *self {
                    A{x: ref __self_0_0} => true && __self_0_0.eq(__self_1_0)
                }
            }
        }
        #[inline]
        fn ne(&self, __arg_0: &A) -> ::bool {
            match *__arg_0 {
                A{x: ref __self_1_0} =>
                match *self {
                    A{x: ref __self_0_0} => false || __self_0_0.ne(__self_1_0)
                }
            }
        }
    }

(The change being the `#[inline]` attributes.)
2013-11-19 11:18:34 +11:00
Brian Anderson
f4c222f7a3 rt: Namespace all C functions under rust_ 2013-11-18 16:17:43 -08:00
Young-il Choi
68024eb4eb android support added to test case 2013-11-19 09:08:47 +09:00
Young-il Choi
093757ca80 add path environments 2013-11-19 09:08:47 +09:00
Young-il Choi
c45870b85e fix #10450 2013-11-19 09:08:47 +09:00
Young-il Choi
88831383b4 temporarily disable tests on android and tagging issue number #10455 2013-11-19 09:08:47 +09:00
bors
9062988610 auto merge of #10552 : michaelwoerister/rust/ifstepping, r=brson
This PR improves the single-stepping experience for if-expression (no more jumping into the *else* branch before entering the *then* branch, no more jumping to the end of the *else* branch after finishing the *then* branch). Unfortunately I don't know of a straight-forward way of writing automated tests for this. Suggestions welcome!
2013-11-18 15:26:29 -08:00
bors
3d569df41d auto merge of #10555 : TeXitoi/rust/pidigits-resurected, r=alexcrichton
Changes:
* default value when no args
* license
* removed libc printing
* use extra::bigint instead of handmade gmp binding

The drawback is that it's 2 order of magnitude slower, the good news is that there is a good bench for extra::bigint.
2013-11-18 13:46:55 -08:00
Guillaume Pinot
ec27c09bdf pidigits resurected
Changes:
* default value when no args
* license
* removed libc printing
* use extra::bigint instead of handmade gmp binding
2013-11-18 22:23:38 +01:00
bors
6c8b702cf7 auto merge of #10539 : alexcrichton/rust/external-linkage, r=pcwalton
If a function is marked as external, then it's likely desired for use with some
native library, so we're not really accomplishing a whole lot by internalizing
all of these symbols.
2013-11-18 10:26:49 -08:00
Alex Crichton
4ddeef35e5 Don't mark reachable extern fns as internal
If a function is marked as external, then it's likely desired for use with some
native library, so we're not really accomplishing a whole lot by internalizing
all of these symbols.
2013-11-18 10:21:58 -08:00
Michael Woerister
d0872eb692 debuginfo: Improved stepping for if-expressions 2013-11-18 16:56:44 +01:00
Huon Wilson
e6fb622af1 std::rand: wrappers for floats from [0,1] and (0,1).
Provide `Closed01` and `Open01` that generate directly from the
closed/open intervals from 0 to 1, in contrast to the plain impls for
f32 and f64 which generate the half-open [0,1).

Fixes #7755.
2013-11-18 23:12:01 +11:00
bors
4dded4345f auto merge of #10508 : chris-morgan/rust/tags-improvements, r=cmr
Largely, this is just being more specific about where tags get searched
for to remove external dependencies like src/llvm, which reduces the
number of tags *enormously* and significantly increases the usefulness
of the tags file as it is then focusing on 240K lines of Rust code
and 4.5K of C++ rather than just shy of 1M lines of C++ code (mostly
from LLVM) and another 100K lines of Rust tests and a diverse collection
of other languages.

src/rustllvm/RustWrapper.cpp and src/rustllvm/PassWrapper.cpp are
getting tags made, but I'm not sure if that's desirable or not. At
worst, it's not a significant wrong.

A future, desirable step is producing tags for just libstd and libextra
for the use of people using Rust-the-language rather than working on
Rust itself.
2013-11-17 23:41:25 -08:00
bors
8eda5d8315 auto merge of #10443 : alexcrichton/rust/meaninless-pub-priv, r=cmr
Closes #10111
2013-11-17 22:21:23 -08:00
Alex Crichton
dab8fec4af Forbid privacy in inner functions
Closes #10111
2013-11-17 21:28:18 -08:00
bors
727b70d6ae auto merge of #10526 : itdaniher/rust/master, r=pcwalton
This commit fixes issue #10468.

It propagate optimization level from PkgSrc to compile_crate as a rustc::driver::session::OptLevel enum.

The 'opt' argument to compile_crate was previously hardcoded as boolean false, such that calls to session::options would always result in the session::No flag being used.
2013-11-17 21:11:24 -08:00
bors
15a8e6248c auto merge of #10363 : astrieanna/rust/fix-x86stdcall, r=huonw
* moved `extern` inside module
* changed `extern "stdcall"` to `extern "system"`
* changed `cfg(target_os="win32")` to `cfg(windows)`
* only run on Windows && x86, (not x86_64)
* updated copyright dates
2013-11-17 20:01:34 -08:00
Leah Hanson
69768f7c94 Fix XFailed test x86stdcall
There was a syntax error because the `extern "stdcall"` was outside the module instead of inside it.

* moved `extern` inside module
* change `extern "stdcall"` to `extern "system"`
* change `cfg(target_os="win32")` to `cfg(windows)`
* updated copyright dates
* changed log(error, ...) => info!(....)
* added `pub` keyword to kernel32 functions
2013-11-17 20:55:59 -06:00
bors
5e3123bfa7 auto merge of #10533 : tautologico/rust/fixdocs, r=huonw
This fixes a number of bugs in the doc comments for a bunch of functions in libstd/iter.rs, mostly updating to use unwrap() instead of get() on options. Also fixes the docs for advance() (trait Iterator) which was not making sense, though if it is not useful anymore maybe it should be removed.
2013-11-17 18:51:30 -08:00
Andrei Formiga
1f27512b17 Fixed docs for advance() in Iterator trait 2013-11-17 23:45:29 -03:00
Andrei Formiga
2839805b9c Fixed uses of get() to unwrap() in doc examples in std::iter 2013-11-17 23:30:57 -03:00
bors
b4197aeed6 auto merge of #10511 : cmr/rust/addtests, r=huonw
Commit messages have all
2013-11-17 16:21:32 -08:00
Corey Richardson
ed34cd1e3c Better error message when using vectors in statics
Closes #10487
2013-11-17 18:35:52 -05:00
Corey Richardson
5d466ff96e Add a test for #6976
Closes #6976
2013-11-17 18:35:47 -05:00
bors
2c9e56f0ed auto merge of #10532 : dhodder/rust/master, r=alexcrichton
Hello.  This is just a tiny doc update -- I'm new here, so apologies if I'm doing it wrong.
2013-11-17 15:11:41 -08:00
bors
60ec647b77 auto merge of #10531 : TeXitoi/rust/mandelbrot-resurected, r=cmr
Changes:
* add licence;
* remove usage of libc and unsafe;
* use BufferedWriter to improve performance;
* use a DummyWriter to cancel binary output in test.
2013-11-17 14:01:58 -08:00
Dave Hodder
48f76a0577 Add doc comment for extra::url::query_to_str 2013-11-17 16:52:14 +00:00
bors
e0943504e4 auto merge of #10523 : huonw/rust/10522, r=cmr
If any of the digits was one past the maximum (e.g. 10**9 for base 10),
then this wasn't detected correctly and so the length of the digit was
one more than expected, causing a very large allocation.

Fixes #10522.
Fixes #10288.
2013-11-17 07:32:13 -08:00
bors
5208332a1a auto merge of #10518 : huonw/rust/6911, r=alexcrichton
Bringing it into line with the unused-variable one,

    fn main() {
        let mut _a = 1;
    }

will not warn that `_a` is never used mutably.

Fixes #6911.
2013-11-17 06:21:47 -08:00
bors
6c8e33753c auto merge of #10510 : chris-morgan/rust/fix-num_lit-grammar-in-the-reference-manaul, r=cmr
- Cause `0` to be considered a valid integer literal (it is).
- Add octal literals (missed from #10243).

I have *not* modified doc/po/rust.md.pot or doc/po/ja/rust.md.po at all;
they already seem to be out of date so it's easier to ignore them for
myself. I can update them if desired, of course.
2013-11-17 04:26:37 -08:00
Guillaume Pinot
93bb99ea09 Prettier long string breaking. 2013-11-17 13:09:56 +01:00
Guillaume Pinot
0c3b04fa0f Clarrify the message for test mode and use u8 instead of i8 for storing bits 2013-11-17 12:47:47 +01:00