Commit Graph

22944 Commits

Author SHA1 Message Date
Alex Crichton
252d17a07c Allow attributes on macros
It's unclear to me why these currently aren't allowed, and my best guess is that
a long time ago we didn't strip the ast of cfg nodes before syntax expansion.
Now that this is done, I'm not certain that we should continue to prohibit this
functionality.

This is a step in the right direction towards #5605, because now we can add an
empty `std::macros` module to the documentation with a bunch of empty macros
explaining how they're supposed to be used.
2013-10-08 19:12:30 -07:00
bors
8eb28bb7dc auto merge of #9703 : alexcrichton/rust/compiler-features, r=cmr
This implements the necessary logic for gating particular features off by default in the compiler. There are a number of issues which have been wanting this form of mechanism, and this initially gates features which we have open issues for.

Additionally, this should unblock #9255
2013-10-06 14:41:28 -07:00
Alex Crichton
3396365cab Add appropriate #[feature] directives to tests 2013-10-06 14:39:25 -07:00
bors
4db6eba3a2 auto merge of #9741 : catamorphism/rust/rustpkg-remotes, r=cmr
r? @cmr Closes #9193
2013-10-06 09:16:30 -07:00
bors
c05fbc5a2c auto merge of #9593 : fhahn/rust/logging-unsafe-removal, r=alexcrichton
This pull request changes to memory layout of the `CrateMap` struct to use static slices instead of raw pointers. Most of the discussion took place [here](63b5975efa (L1R92)) .

The memory layout of CrateMap changed, without bumping the version number in the struct. Another, more backward compatible, solution would be to keep the old code and increase the version number in the new struct. On the other hand, the `annihilate_fn` pointer was removed without bumping the version number recently.

At the moment, the stage0 compiler does not use the new memory layout, which would lead the segfaults during stage0 compilation, so I've added a dummy `iter_crate_map` function for stage0, which does nothing. Again, this could be avoided if we'd bump the version number in the struct and keep the old code.

I'd like to use a normal `for` loop [here](https://github.com/fhahn/rust/compare/logging-unsafe-removal?expand=1#L1R109), 

        for child in children.iter() {
            do_iter_crate_map(child, |x| f(x), visited);
        }


but for some reason this only yields `error: unresolved enum variant, struct or const 'Some'` and I have no idea why.
2013-10-06 03:21:32 -07:00
Florian Hahn
23176fc567 get_crate_map returns an Option 2013-10-06 11:40:26 +02:00
bors
a623fd339b auto merge of #9682 : skade/rust/clearer-error-message-for-external-type-and-trait, r=alexcrichton
The old error message implied that external traits could never
be implemented locally.
2013-10-06 02:06:32 -07:00
Florian Gilcher
8154d23e44 Clearer error message for external trait and type
The old error message implied that external traits could never
be implemented locally.
2013-10-06 09:56:46 +02:00
Huon Wilson
c5c980ac2a Fix a typo in std::ops documentation 2013-10-06 18:51:58 +11:00
bors
d5e5d22bdb auto merge of #9738 : catamorphism/rust/rustpkg-test-docs-need-to-submit, r=alexcrichton
r? anybody Talk about `rustpkg test` in the tutorial, and update its usage message.

@steveklabnik, it would be great if you could look this over :-)
2013-10-05 22:46:34 -07:00
Tim Chevalier
d7b2c70a13 rustpkg: Fix fetching remote packages
Closes #9193
2013-10-06 00:49:11 -04:00
Alex Crichton
dd98f7089f Implement feature-gating for the compiler
A few features are now hidden behind various #[feature(...)] directives. These
include struct-like enum variants, glob imports, and macro_rules! invocations.

Closes #9304
Closes #9305
Closes #9306
Closes #9331
2013-10-05 20:19:33 -07:00
Tim Chevalier
8ba148b295 docs / rustpkg: Document rustpkg test more
Talk about `rustpkg test` in the tutorial, and update its usage message.
2013-10-05 23:17:23 -04:00
bors
0114ab631d auto merge of #9729 : dwrensha/rust/regionmanip-cleanup, r=catamorphism 2013-10-05 19:56:32 -07:00
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
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