Commit Graph

23237 Commits

Author SHA1 Message Date
bors
acf9783879 auto merge of #9733 : catamorphism/rust/issues-7246-and-7573, r=alexcrichton
r? anybody Closes #7246
Closes #7573
2013-10-05 18:41:34 -07:00
Tim Chevalier
310c0e3d4b testsuite: Two tests for fixed bugs
Closes #7246
Closes #7573
2013-10-05 20:36:14 -04:00
David Renshaw
3b26bb9022 remove duplicate statement 2013-10-05 20:28:09 -04:00
bors
549f70989e auto merge of #9734 : luisbg/rust/master, r=alexcrichton
These formats are already covered with 'T' | 'X' in line 571 and 'D' | 'x' in
line 446.
2013-10-05 17:26:35 -07:00
bors
bf416e7daf auto merge of #9713 : sfackler/rust/dynamic_lib, r=alexcrichton
The root issue is that dlerror isn't reentrant or even thread safe.

The solution implemented here is to make a yielding spin lock over an
AtomicFlag. This is pretty hacky, but the best we can do at this point.
As far as I can tell, it isn't possible to create a global mutex without
having to initialize it in a single threaded context.

The Windows code isn't affected since errno is thread-local on Windows
and it's running in an atomically block to ensure there isn't a green
thread context switch.

Closes #8156
2013-10-05 15:41:35 -07:00
Luis de Bethencourt
72490c9d48 extra: remove commented out 'X' and 'x' formats
These formats are already covered with 'T' | 'X' in line 571 and 'D' | 'x' in
line 446.
2013-10-05 17:30:26 -04:00
bors
2733b189ac auto merge of #9250 : erickt/rust/num, r=erickt
This PR solves one of the pain points with c-style enums. Simplifies writing a fn to convert from an int/uint to an enum. It does this through a `#[deriving(FromPrimitive)]` syntax extension.

Before this is committed though, we need to discuss if `ToPrimitive`/`FromPrimitive` has the right design (cc #4819). I've changed all the `.to_int()` and `from_int()` style functions to return `Option<int>` so we can handle partial functions. For this PR though only enums and `extra::num::bigint::*` take advantage of returning None for unrepresentable values. In the long run it'd be better if `i64.to_i8()` returned `None` if the value was too large, but I'll save this for a future PR.

Closes #3868.
2013-10-05 14:26:44 -07:00
Erick Tryzelaar
0e8ad4d8a2 extra: fix BigInt on 32bit machines 2013-10-05 13:59:06 -07:00
Erick Tryzelaar
efae73d95a test: fix the tests for windows 2013-10-05 13:59:06 -07:00
Erick Tryzelaar
41f9deb2ee std: add Primitive.is_signed 2013-10-05 13:59:06 -07:00
Erick Tryzelaar
50fde8c024 std: ToPrimitive's default impls should use .to_*()
This allows the default methods to be properly range checked.
2013-10-05 13:59:06 -07:00
Erick Tryzelaar
da145b2372 std: fix some warnings 2013-10-05 13:59:05 -07:00
Erick Tryzelaar
e323749397 extra: Don't truncate {u64,i64} when converting to BigInts 2013-10-05 13:59:05 -07:00
Erick Tryzelaar
cb24019744 std: check bounds for ints/uints in {To,From}Primitive 2013-10-05 13:59:05 -07:00
bors
0c388be8d1 auto merge of #9731 : Kimundi/rust/SendStrTaskName, r=alexcrichton
This resolves a FIXME in `std::rt::task`.
2013-10-05 13:11:54 -07:00
Marvin Löbel
517298de48 Implemented IntoSendStr on SendStr to allow naming a
task with a `SendStr` directly
2013-10-05 21:28:04 +02:00
Marvin Löbel
49ac6baa72 Make a task name use a SendStr, allowing for either
static or owned strings
2013-10-05 21:01:58 +02:00
Steven Fackler
1d19ad9787 Fix thread safety issues in dynamic_lib
The root issue is that dlerror isn't reentrant or even thread safe.

The Windows code isn't affected since errno is thread-local on Windows
and it's running in an atomically block to ensure there isn't a green
thread context switch.

Closes #8156
2013-10-05 10:37:11 -07:00
Florian Hahn
b7b4f7a5e2 Add code for older crate map versions, bumped crate map version number 2013-10-05 12:09:30 +02:00
Florian Hahn
5dd1145c9b Use &'self str instead of raw char pointer in ModEntry 2013-10-05 12:09:30 +02:00
Florian Hahn
9ef4463b2a Use slice representation for module entries in CrateMap
Relaxe lifetime of CrateMap as well.
2013-10-05 12:09:30 +02:00
Florian Hahn
787f20a255 Use slice representation for child crate maps 2013-10-05 12:09:30 +02:00
bors
1506dac10f auto merge of #9727 : Valloric/rust/doc-fixes, r=catamorphism 2013-10-04 23:51:32 -07:00
bors
bae0ce2a69 auto merge of #9726 : Valloric/rust/typo_fix, r=alexcrichton 2013-10-04 22:36:33 -07:00
Strahinja Val Markovic
03099e5678 Fixed another minor typo in std::str docs 2013-10-04 22:07:57 -07:00
Strahinja Val Markovic
d629aca81a Fix minor typo in std::str module docs 2013-10-04 21:24:29 -07:00
bors
5a1073fbab auto merge of #9722 : alexcrichton/rust/less-mem, r=sanxiyn
According to http://huonw.github.io/isrustfastyet/mem/#012f909, the "const
marking" pass generates about 400MB of extra memory during compilation. It
appears that this is due to two different factors:

    1. There is a `ccache` map in the ty::ctxt which is only ever used in this
       pass, so this commit moves the map out of the ty::ctxt struct and into
       just this pass's visitor. This turned out to not benefit that much in
       memory (as indicated by http://i.imgur.com/Eo4iOzK.png), but it's helpful
       to do nonetheless.

    2. During const_eval, there are a lot of lookups into decoding inlined items
       from external crates. There is no caching involved here, so the same
       static or variant could be re-translated many times. After adding
       separate caches for variants and statics, the memory peak of compiling
       rustc decreased by 200MB (as evident by http://i.imgur.com/ULAUMtq.png)

The culmination of this is basically a slight reorganization of a caching map
for the const_eval pass along with a 200MB decrease in peak memory usage when
compiling librustc.
2013-10-04 21:21:31 -07:00
Alex Crichton
19e9766c29 Don't fail when unpacking the windows snapshot
Newly having a third-party directory was throwing off the unpack script
2013-10-04 21:16:54 -07:00
bors
1a3141b7c5 auto merge of #9718 : alexcrichton/rust/snapshots, r=sanxiyn
Now that #9662 is merged, we should be much more easily bootstrappable on
windows now.
2013-10-04 18:36:32 -07:00
Alex Crichton
1996a11bb2 Cache more results of const_eval
According to http://huonw.github.io/isrustfastyet/mem/#012f909, the "const
marking" pass generates about 400MB of extra memory during compilation. It
appears that this is due to two different factors:

    1. There is a `ccache` map in the ty::ctxt which is only ever used in this
       pass, so this commit moves the map out of the ty::ctxt struct and into
       just this pass's visitor. This turned out to not benefit that much in
       memory (as indicated by http://i.imgur.com/Eo4iOzK.png), but it's helpful
       to do nonetheless.

    2. During const_eval, there are a lot of lookups into decoding inlined items
       from external crates. There is no caching involved here, so the same
       static or variant could be re-translated many times. After adding
       separate caches for variants and statics, the memory peak of compiling
       rustc decreased by 200MB (as evident by http://i.imgur.com/ULAUMtq.png)

The culmination of this is basically a slight reorganization of a caching map
for the const_eval pass along with a 200MB decrease in peak memory usage when
compiling librustc.
2013-10-04 17:41:15 -07:00
bors
8cb3426f16 auto merge of #9723 : blake2-ppc/rust/trans-no-push-ctxt-clone, r=alexcrichton
Avoid cloning the stack on every `push_ctxt` call in trans

Rewrite the use of TLS variable for `push_ctxt` so that it uses a ~[]
instead of a @~[]. Before it cloned the whole vector on each push and
pop, which is unnecessary.
2013-10-04 16:21:36 -07:00
blake2-ppc
87294c23ba Avoid cloning the stack on every push_ctxt call in trans
Rewrite the use of TLS variable for `push_ctxt` so that it uses a ~[]
instead of a @~[]. Before it cloned the whole vector on each push and
pop, which is unnecessary.
2013-10-05 01:10:27 +02:00
klutzy
ade57d9f58 rt::io::net::tcp: Fix eof_twice tests on Win32
cc #8811
2013-10-05 07:37:19 +09:00
klutzy
8aadcd4851 std::rt: Add NotConnected to IoErrorKind 2013-10-05 07:37:18 +09:00
klutzy
a402fb27fa std::rt::uv::net: Handle read_start error
cc #9605
2013-10-05 07:37:18 +09:00
bors
c5295f9c47 auto merge of #9717 : blake2-ppc/rust/rustc-static-str, r=alexcrichton
rustc: Use static strings in a few literals

Avoid allocating extra copies of strings by using "" instead of ~"" for
the debug options list and for the `time` function. This is a small
change, but it is in a path that's always executed.
2013-10-04 12:36:36 -07:00
Alex Crichton
4cc925a5f4 Register new snapshots
Now that #9662 is merged, we should be much more easily bootstrappable on
windows now.
2013-10-04 11:24:18 -07:00
bors
a9d54acc3e auto merge of #9715 : flo-l/rust/doc-fixes, r=alexcrichton 2013-10-04 11:01:41 -07:00
blake2-ppc
9ac175c503 rustc: Use static strings in a few literals
Avoid allocating extra copies of strings by using "" instead of ~"" for
the debug options list and for the `time` function. This is a small
change, but it is in a path that's always executed.
2013-10-04 19:46:53 +02:00
flo-l
bf6b198c7e fix some examples in std::rand::Rng 2013-10-04 16:38:05 +02:00
bors
8bb55dbf21 auto merge of #9662 : vadimcn/rust/package-runtime-deps, r=brson
This will make sure that system files that rust binaries depend on in Windows get packaged into stage0 snapshots as well as into Windows installer.
Currently these include `libgcc_s_dw2-1.dll`, `libstdc++-6.dll` and `libpthread-2.dll`.   Note that the latter will need to be changed to `pthreadGC2.dll` once Windows build bots get upgraded to mingw 4.0

Closes #9252
Closes #5878
Closes #9218
Closes #5712
2013-10-04 07:11:37 -07:00
bors
dfe29e2211 auto merge of #9704 : alexcrichton/rust/rustdoc-comments, r=huonw
This addresses some of @huonw's in #9691 about the startling lack of
documentation guiding one throughout the innards of rustdoc::html

r? @huonw
2013-10-04 05:51:35 -07:00
bors
e44b40ca3a auto merge of #9712 : ben0x539/rust/obsolete-syntax, r=pcwalton
Mostly as per a short discussion on irc. (@cmr)

    08:46 < cmr> so I'm thinking
    Obsolete{Let,With,FieldTerminator,ClassTraits,ModeInFnType,MoveInit,BinaryMove,I
    mplSyntax,MutOwnedPointer,MutVector,RecordType,RecordPattern,PostFnTySigil,Newty
    pEnum,Mode,ImplicitSelf,LifetimeNotation,Purity,StaticMethod,ConstItem,FixedLeng
    thVectorType}
    08:46 < cmr> Those are the ones that are older than 0.6
    08:46 < cmr> (at least!)

This PR removes these specific "obsolete syntax"/"suggestion for change" errors and just lets the parser run into regular parser errors for long-invalid syntax. I also removed `ObsoletePrivSection` which apparently dates further back than cmr or I could recall and `ObsoleteUnenforcedBound` which seemed unused. Also I removed `ObsoleteNewtypeEnum`.
2013-10-03 22:56:33 -07:00
Benjamin Herr
fa411500f9 Remove specific errors for very old obsolete syntax
Replaces existing tests for removed obsolete-syntax errors with tests
for the resulting regular errors, adds a test for each of the removed
parser errors to make sure that obsolete forms don't start working
again, removes some obsolete/superfluous tests that were now failing.

Deletes some amount of dead code in the parser, also includes some small
changes to parser error messages to accomodate new tests.
2013-10-04 07:09:28 +02:00
bors
3f32898a7b auto merge of #9711 : sanxiyn/rust/ambiguous-default-method, r=alexcrichton
Fix #8808.
2013-10-03 20:21:31 -07:00
bors
4bae639d86 auto merge of #9705 : luisbg/rust/strptime, r=alexcrichton
do_strptime() and do_strftime()

I don't see any reason why src/libextra/time.rs has two functions that just call a very similar function, which only use is to be called by them.
strftime() just calls do_strftime()
strptime() just calls do_strptime()
and the do_functions aren't called by anyone else.
the parameters and return types are exactly the same in both levels, so I just have removed the second layer.

Unless there is a need for that second level.
2013-10-03 14:01:41 -07:00
Luis de Bethencourt
a0c59941e3 extra: remove unnecessary second level functions
do_strptime() and do_strftime()
2013-10-03 16:01:42 -04:00
bors
012f909f35 auto merge of #9522 : steveklabnik/rust/doc_std_opts, r=alexcrichton
Added an overview with a 'real' example, as well as toy implementations of all of
the traits.

Closes #9356.
2013-10-03 12:46:32 -07:00
Steve Klabnik
28e88b4c6f Update std::ops docs as per feedback
from @chris-morgan
2013-10-03 12:37:33 -07:00
bors
9344e2a866 auto merge of #9686 : alexcrichton/rust/lint, r=thestinger
This purges about 500 lines of visitor cruft from lint passes. All lints are
handled in a much more sane way at this point. The other huge bonus of this
commit is that there are no more @-boxes in the lint passes, fixing the 500MB
memory regression seen when the lint passes were refactored.

Closes #8589
2013-10-03 10:31:33 -07:00