Commit Graph

20071 Commits

Author SHA1 Message Date
bors
8a1002fbd9 auto merge of #7827 : jdm/rust/enumlength, r=graydon
Allowing them in type signatures is a significant amount of extra work, unfortunately. This also doesn't apply to static values, which takes a different code path.
2013-07-16 16:19:37 -07:00
bors
53e934c2ab auto merge of #7684 : pnkfelix/rust/fsk-invert-range-rev-halfclosedness-issue5270-2ndpr, r=cmr
Changes int/uint range_rev to iterate over range `(hi,lo]` instead of `[hi,lo)`.

Fix #5270.

Also:
* Adds unit tests for int/uint range functions
* Updates the uses of `range_rev` to account for the new semantics.  (Note that pretty much all of the updates there were strict improvements to the code in question; yay!)
* Exposes new function, `range_step_inclusive`, which does the range `[hi,lo]`, (at least when `hi-lo` is a multiple of the `step` parameter).
* Special-cases when `|step| == 1` removing unnecessary bounds-check.  (I did not check whether LLVM was already performing this optimization; I figure it would be a net win to not leave that analysis to the compiler.  If reviewer objects, I can easily remove that from the refactored code.)

(This pull request is a rebased version of PR #7524, which went stale due to recent unrelated changes to num libraries.)
2013-07-16 14:37:34 -07:00
bors
9db190305f auto merge of #7823 : pnkfelix/rust/issue7821-document-lint-attributes, r=graydon
r? anyone

Fix #7821.
2013-07-16 12:58:31 -07:00
bors
ad212ecee4 auto merge of #7822 : huonw/rust/cond-debug, r=graydon
As per @pcwalton's request, `debug!(..)` is only activated when the `debug` cfg is set; that is, for `RUST_LOG=some_module=4 ./some_program` to work, it needs to be compiled with `rustc --cfg debug some_program.rs`. (Although, there is the sneaky `__debug!(..)` macro that is always active, if you *really* need it.)

It functions by making `debug!` expand to `if false { __debug!(..) }` (expanding to an `if` like this is required to make sure `debug!` statements are typechecked and to avoid unused variable warnings), and adjusting trans to skip the pointless branches in `if true ...` and `if false ...`.

The conditional expansion change also required moving the inject-std-macros step into a new pass, and makes it actually insert them at the top of the crate; this means that the cfg stripping traverses over the macros and so filters out the unused ones.

This appears to takes an unoptimised build of `librustc` from 65s to 59s; and the full bootstrap from 18m41s to 18m26s on my computer (with general background use).

`./configure --enable-debug` will enable `debug!` statements in the bootstrap build.
2013-07-16 11:19:20 -07:00
Huon Wilson
4797dd4087 rustc: selectively trans branches for if <literal-bool>.
That is, the `b` branch in `if true { a } else { b }` will not be
trans'd, and that expression will be exactly the same as `a`. This
means that, for example, macros conditionally expanding to `if false
{ .. }` (like debug!) will not waste time in LLVM (or trans).
2013-07-17 03:13:41 +10:00
Huon Wilson
e252277fe9 rustc: handle allocas and LoadRangeAsserts in unreachable blocks correctly.
An alloca in an unreachable block would shortcircuit with Undef, but with type
`Type`, rather than type `*Type` (i.e. a plain value, not a pointer) but it is
expected to return a pointer into the stack, leading to confusion and LLVM
asserts later.

Similarly, attaching the range metadata to a Load in an unreachable block
makes LLVM unhappy, since the Load returns Undef.

Fixes #7344.
2013-07-17 03:13:23 +10:00
Huon Wilson
e4f7561bcd Clean-up tests after debug!/std-macros change.
The entire testsuite is converted to using info! rather than debug!
because some depend on the code within the debug! being trans'd.
2013-07-17 03:10:13 +10:00
bors
a317584e4f auto merge of #7726 : omasanori/rust/semver-2.0.0, r=graydon
The Ord impl of Version refered to the algorithm in release candidate versions of semver. [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html) says, "Build metadata SHOULD be ignored when determining version precedence."

Note that Version's `le` is not "less than or equal to" now, since `lt` ignores build metadata. I think the new ordering algorithm satisfies strict weak ordering which C++ STL requires, instead of strict total ordering.

BTW, is `a || b || ... || x`-style code better or idiomatic in Rust than `if a { return true; } if b { return true; } ... if x { return true; } return false;`-style one?
2013-07-16 09:31:28 -07:00
Felix S. Klock II
8515abe0d9 Add doc and examples for attributes allow/warn/deny/forbid.
Fix #7821.
2013-07-16 18:20:49 +02:00
Josh Matthews
877bba91d5 Permit C-style enums in vector repeat length expressions (N.B. values only, not type signatures) 2013-07-16 12:05:24 -04:00
OGINO Masanori
31d29d394f Add more tests for build metadata. 2013-07-16 20:53:25 +09:00
OGINO Masanori
9ba32f306a Update the ordering algorithm to semver 2.0.0.
Note that Version's `le` is not "less than or equal to" now, since `lt`
ignores build metadata. I think the new ordering algorithm satisfies
strict weak ordering which C++ STL requires, instead of strict total
ordering.
2013-07-16 20:53:25 +09:00
Huon Wilson
b48e37e8ee syntax: make a macros-injection pass; conditionally define debug! to a noop based on cfg(debug).
Macros can be conditionally defined because stripping occurs before macro
expansion, but, the built-in macros were only added as part of the actual
expansion process and so couldn't be stripped to have definitions conditional
on cfg flags.

debug! is defined conditionally in terms of the debug config, expanding to
nothing unless the --cfg debug flag is passed (to be precise it expands to
`if false { normal_debug!(...) }` so that they are still type checked, and
to avoid unused variable lints).
2013-07-16 15:05:50 +10:00
bors
274e7a4e49 auto merge of #7816 : thestinger/rust/header, r=huonw
Note that the headers are still on `~[T]` when `T` is managed. This is continued from #7605, which removed all the code relying on the headers and removed them from `~T` for non-managed `T`.
2013-07-15 21:01:20 -07:00
Daniel Micay
e118555ce6 remove headers from unique vectors 2013-07-15 23:57:27 -04:00
bors
47ba4583db auto merge of #7815 : blake2-ppc/rust/hashmap-iterators, r=huonw
Implement set difference, sym. difference, intersection and union using Iterators.

The set methods are left since they are part of the Set trait. A grep over the tree indicates that the four hashset operations have no users at all.

Also remove HashMap::mutate_values since it is unused, replaced by .mut_iter(), and not part of a trait.
2013-07-15 19:19:21 -07:00
blake2-ppc
750f32dbb5 hashmap: Iterators for hashset diff, sym. diff, intersec, union
Implement the difference, union, etc iterators with the help of a custom
iterator combinator with explicit closure environment. Reported issue #7814
to be able to use the std::iterator filter combinator.
2013-07-16 04:09:41 +02:00
blake2-ppc
cf4127f503 hashmap: Remove .mutate_values() which is replaced by .mut_iter() 2013-07-16 03:55:52 +02:00
bors
98c16549cb auto merge of #7808 : blake2-ppc/rust/ringbuf, r=thestinger 2013-07-15 17:04:20 -07:00
blake2-ppc
3385e795c5 ringbuf: Implement DoubleEndedIterator 2013-07-16 01:13:26 +02:00
bors
e844b524ed auto merge of #7806 : apasel422/rust/hash_consume, r=catamorphism
This partially addresses #7719.
2013-07-15 15:22:19 -07:00
Andrew Paseltiner
faa280cee6 std: add consuming iterators for HashMap and HashSet 2013-07-15 17:32:53 -04:00
bors
04f9ce0ae3 auto merge of #7681 : catamorphism/rust/rustpkg-local-repos, r=catamorphism
r? @graydon rustpkg can now build code from a local git repository. In the
case where the local repo is in a directory not in the RUST_PATH,
it checks out the repository into a directory in the first workspace
in the RUST_PATH.

The tests no longer try to connect to github.com, which should
solve some of the sporadic failures we've been seeing.
2013-07-15 13:40:21 -07:00
Tim Chevalier
0fa9ad8673 rustpkg: Handle local git repositories
rustpkg can now build code from a local git repository. In the
case where the local repo is in a directory not in the RUST_PATH,
it checks out the repository into a directory in the first workspace
in the RUST_PATH.

The tests no longer try to connect to github.com, which should
solve some of the sporadic failures we've been seeing.
2013-07-15 12:59:48 -07:00
bors
9d7e01bb39 auto merge of #7802 : catamorphism/rust/issue-6128, r=catamorphism 2013-07-15 11:16:25 -07:00
Tim Chevalier
600e40f503 testsuite: Add xfailed test case for #6128 2013-07-15 11:12:56 -07:00
bors
9c22f65870 auto merge of #7799 : blake2-ppc/rust/eq-default, r=sanxiyn
Let Eq::ne be implemented to the inverse of eq by default.
2013-07-15 05:01:19 -07:00
blake2-ppc
6999b5332f cmp: Use default methods in trait Eq, require only Eq::eq 2013-07-15 13:24:35 +02:00
bors
60d5bb9413 auto merge of #7796 : thomaslee/rust/issue-6247, r=z0w0
This closes #6247 by simply ensuring librustllvm.so gets installed to the target lib directory in addition to the host lib directory.
2013-07-14 23:40:19 -07:00
bors
fd80291cdc auto merge of #7795 : sp3d/rust/master, r=z0w0
This should be pretty self-explanatory. The most important component is region/lifetime annotation highlighting, as previously they were interpreted as character literals and would ruin the rest of the line. The attribute regex is fairly crude, but it gets the job done and there's not much within attributes that would benefit from individual highlighting, so fancier handling didn't seem worth the trouble.

The ident regex was copied from the vim highlighter.
2013-07-14 21:58:19 -07:00
Tom Lee
27435c081f Install librustllvm.so to target lib directory 2013-07-14 21:53:47 -07:00
sp3d
9adad222a6 add regions, unicode idents, attributes to GtkSourceView language-spec 2013-07-14 23:44:55 -05:00
bors
db438ad786 auto merge of #7792 : ozten/rust/master, r=huonw
Minor tweak, but I was confused when first digging into json.rs docs.

I think it's clearer to say the module provides parsing and serialization.
2013-07-14 18:58:19 -07:00
Austin King
b7e4b88c4a Noting that json.rs provides parsing as well 2013-07-14 18:26:45 -07:00
bors
68a32aad1a auto merge of #7716 : kballard/rust/term-attr, r=cmr
Teach `extra::term` to support more terminal attributes than just color.

Fix the compiler diagnostic messages to print in bold instead of bright white. This matches Clang's output.

Cache the term::Terminal instead of re-parsing for every diagnostic (fixes #6827).
2013-07-14 15:55:20 -07:00
Kevin Ballard
1d4c3146f5 Don't re-parse terminfo (twice!) on every compiler diagnostic
Stuff the term::Terminal into TLS to avoid re-parsing for every single
message we want to color.

Fixes #6827.
2013-07-14 15:01:50 -07:00
Kevin Ballard
69da380844 Highlight rustc's warnings/errors in bold instead of bright white
Clang actually highlights using bold, not using bright white. Match
clang on this so our diagnostics are still readable on terminals with a
white background.
2013-07-14 14:37:29 -07:00
Kevin Ballard
690495de03 term: Add new function .attr() to toggle terminal attributes
Also add .supports_attr() to test for attribute support without writing
anything to output.

Update .reset() to use sgr0 instead of op.
2013-07-14 14:37:29 -07:00
Kevin Ballard
7d8a0fdb7d Give term.fg() and term.bg() a bool return value 2013-07-14 14:37:29 -07:00
bors
4f333023e9 auto merge of #7790 : blake2-ppc/rust/dlist-ringbuf-small-changes, r=thestinger
Implement size_hint for the ringbuf iterators.

Do small cleanups in dlist, use Option's .map and .map_mut properly, and put inline on all the small methods.
2013-07-14 14:13:21 -07:00
blake2-ppc
961184f852 dlist: Use inline on very small functions and iterator functions 2013-07-14 23:03:54 +02:00
blake2-ppc
7681cf62e3 dlist: Simplify by using Option::{map, map_mut}
These methods were fixed or just added so they can now be used.
2013-07-14 22:59:15 +02:00
blake2-ppc
9ccf443088 ringbuf: Implement .size_hint() for iterators 2013-07-14 22:30:22 +02:00
bors
0cb1ac0f9f auto merge of #7788 : MarkJr94/rust/from_iter, r=cmr
Added Iterators for HashMap/Set, TreeMap/Set, TrieMap/Set, and PriorityQueue as per Issue #7626
2013-07-14 12:01:22 -07:00
bors
1c35ab322f auto merge of #7751 : alexcrichton/rust/finish-tls, r=pcwalton
This changes the interface to `get`, and it also changes the keys to be static slices instead of static functions.

This allows the removal of the `unsafe` interface because while functions can monomorphize from different types to the same actual function, static slices cannot do this.

From at least what I can tell, we don't need to worry about LLVM coalescing these addresses. If we ever use the `unnamed_addr` it looks like there's cause for worry, but there doesn't appear to be any coalescing atm.
2013-07-14 10:19:21 -07:00
=Mark Sinclair
bbe03da9c6 Stripped trailing spaces; Implemented FromIterator for TreeMap and PriorityQueue 2013-07-14 13:18:50 -04:00
Alex Crichton
9fd2ac7428 Make TLS keys actually take up space
If the TLS key is 0-sized, then the linux linker is apparently smart enough to
put everything at the same pointer. OSX on the other hand, will reserve some
space for all of them. To get around this, the TLS key now actuall consumes
space to ensure that it gets a unique pointer
2013-07-14 10:15:07 -07:00
Alex Crichton
e3211fa1f1 Purge the last remnants of the old TLS api
Closes #3273
2013-07-14 09:29:12 -07:00
Alex Crichton
242606c793 Clean up various warnings throughout the codebase 2013-07-14 09:29:12 -07:00
Alex Crichton
23fbe936bf Allow non-uppercase-statics by default
I think of this as a stylistic opinion which shouldn't necessarily be enforced
by default on all users of rust, but that's just my opinion.
2013-07-14 09:29:12 -07:00