Commit graph

20542 commits

Author SHA1 Message Date
Björn Steinbrink
7078ab7324 Generate branchless code when "if" can be evaluated at compile time
We already avoid the conditional branch, but still have an
unconditional branch in the generated code. Remove it.
2013-07-25 17:03:46 +02:00
Etienne Millon
f929a49d9c NaN patterns: indicate that is_NaN is a method 2013-07-25 16:40:59 +02:00
bors
baa649ede6 auto merge of #8027 : nikomatsakis/rust/issue-4846-multiple-lifetime-parameters-1, r=pcwalton
Small step towards #4846. r? @msullivan
2013-07-25 07:37:45 -07:00
bors
4cf30729f0 auto merge of #8026 : poiru/rust/issue-8024, r=alexcrichton
Closes #8024.
2013-07-25 05:22:44 -07:00
Björn Steinbrink
e0685e22a3 Make omission of impossible if-else branches work with constants
Until now, we only optimized away impossible branches when there is a
literal true/false in the code. But since the LLVM IR builder already does
constant folding for us, we can trivially expand that to work with
constants as well.

Refs #7834
2013-07-25 12:17:31 +02:00
bors
906264b50f auto merge of #8015 : msullivan/rust/default-methods, r=nikomatsakis
Lots of changes to vtable resolution, handling of super/self method calls in default methods. Fix a lot of trait inheritance bugs.

r? @nikomatsakis
2013-07-25 03:07:44 -07:00
Björn Steinbrink
75a08622e8 Add a function to check whether a ValueRef is a constant 2013-07-25 12:06:57 +02:00
Luqman Aden
e2bb32bea1 libstd: Handle IPv4-Mapped/Compatible IPv6 addresses. 2013-07-25 05:57:52 -04:00
Luqman Aden
ac40d5323d libstd: Fix errors when rtdebug! is not a noop. 2013-07-25 05:57:52 -04:00
Luqman Aden
61e741cf71 libstd: Implement {peer, socket}_name for new rt tcp & udp. 2013-07-25 05:57:52 -04:00
Gábor Horváth
7cc8f4bae0 Added some more atomic operations. 2013-07-25 10:46:31 +02:00
Graydon Hoare
c3417b88aa syntax: Fix #6416 by aborting on errors after test parse. 2013-07-25 01:06:38 -07:00
bors
b30a16c9ae auto merge of #8020 : pnkfelix/rust/fsk-issue7898-dont-propagate-cfg-debug-to-tests, r=huonw
Remove directive, if present, from CFG_RUSTC_FLAGS.

r? @huonw 

Fix #7898.

(One alternative tack is to build up distinct CFG_TEST_RUSTC_FLAGS
alongside CFG_RUSTC_FLAGS; but currently debug is the only --cfg flag
ever added to CFG_RUSTC_FLAGS; the other contents of CFG_RUSTC_FLAGS
are a mix of -Z flags and a few other switches like O, which seem to
make sense to propogate to the tests.)
2013-07-25 00:46:37 -07:00
Alex Crichton
7fd23e4fe2 Convert uses of transmute which don't need it 2013-07-24 23:12:28 -07:00
bors
ba9c3ebc02 auto merge of #8000 : kemurphy/rust/enum-intvar, r=huonw 2013-07-24 22:04:38 -07:00
Kevin Murphy
6f253419ee Move/delete old tests that change behavior 2013-07-25 00:00:56 -04:00
Kevin Murphy
e9233d55c8 Add test for uint and negative literals as discriminants 2013-07-24 23:54:40 -04:00
Kevin Murphy
1c3dc294ce Allow uint discriminants and store them as such
Infers type of constants used as discriminants and ensures they are
integral, instead of forcing them to be a signed integer.

Also, stores discriminant values as uint instead of int interally and
deals with related fallout.

Fixes issue #7994
2013-07-24 23:54:40 -04:00
Michael Sullivan
f37c7cd306 Fix vtable resolution for self to search supertraits. Closes #7661. 2013-07-24 20:07:51 -07:00
bors
467d381d3a auto merge of #7931 : blake2-ppc/rust/chain-mut-ref, r=pcwalton
First, clean up the uses of "None" and "Some" to always use consistent title case matching the variant names.

Add .chain_mut_ref() which is a missing method. A use case example for this method is extraction of an optional value from an Option\<Container\> value.
2013-07-24 19:25:38 -07:00
Tim Chevalier
bfac584a03 rustpkg: Handle non-numeric versions; some cleanup
Package IDs can now be of the form a/b/c#FOO, where (if a/b/c is
a git repository) FOO is any tag in the repository. Non-numeric
tags only match against package IDs with the same tag, and aren't
compared linearly like numeric versions.

While I was at it, refactored the code that calls `git clone`,
and segregated build output properly for different packages.
2013-07-24 18:42:14 -07:00
Tim Chevalier
d7c4a10fba rustpkg: Clean up usage messages for install 2013-07-24 18:39:25 -07:00
Graydon Hoare
581b3db3b3 rewrite rust-mode to use font-lock-mode and emacs builtin syntax analysis 2013-07-24 17:11:04 -07:00
bors
4a726f0573 auto merge of #8006 : emillon/rust/issue-6060, r=pcwalton
Hello,

I made a tiny change to `tidy.py` so that it uses a regexp to find `// NOTE` comments. I could not find an easy way to write an automated test for this but if this is needed and possible I'd be happy to write one.
Please note that it also removes extra empty lines that appear after each of these warnings (I believe that there were not wanted).

On the performance side, `make tidy` is now a bit slower (running it 10 times in a row takes 71s on my machine, 65s before) but I don't think that it is performance sensitive.

Thanks!
2013-07-24 16:49:36 -07:00
Daniel Micay
ba41755069 improve container/iterator tutorial 2013-07-24 18:44:16 -04:00
Daniel Micay
4517e39125 rm default method lint
default methods are enabled by default, so there's not much point in
keeping around a lint to report them as being experimental
2013-07-24 18:44:16 -04:00
Daniel Micay
ce1db94647 rm unused upcall_exchange_free 2013-07-24 18:44:16 -04:00
Etienne Millon
fdd71bece2 Generalize NaN pattern detection using walk_pat 2013-07-24 23:20:57 +02:00
Etienne Millon
5c729c0dca Check for comparisons to NaN in patterns
For every pattern that refers to a static value, evaluate it and emit a warning
if it is a NaN.

Fixes #6804
2013-07-24 23:20:57 +02:00
Niko Matsakis
dc38e1616a Generalize the ty::substs struct so that it can represent
multiple lifetime parameters, and not just one. Also add an option
for erasing lifetimes, which makes trans code somewhat simpler
and cleaner.
2013-07-24 16:52:57 -04:00
bors
330378d1a1 auto merge of #7996 : erickt/rust/cleanup-strs, r=erickt
This is a cleanup pull request that does:

* removes `os::as_c_charp`
* moves `str::as_buf` and `str::as_c_str` into `StrSlice`
* converts some functions from `StrSlice::as_buf` to `StrSlice::as_c_str`
* renames `StrSlice::as_buf` to `StrSlice::as_imm_buf` (and adds `StrSlice::as_mut_buf` to match `vec.rs`.
* renames `UniqueStr::as_bytes_with_null_consume` to `UniqueStr::to_bytes`
* and other misc cleanups and minor optimizations
2013-07-24 13:25:36 -07:00
Birunthan Mohanathas
f73bb2bfe6 Implement std::num::Zero for bool
Closes #8024.
2013-07-24 22:54:32 +03:00
Erick Tryzelaar
9a950802ed std: str.as_bytes_with_null_consume() => str.to_bytes_with_null() 2013-07-24 12:33:49 -07:00
bors
766eb950c6 auto merge of #7997 : omasanori/rust/cleanup, r=cmr
Just an minor cleanup.
2013-07-24 11:16:33 -07:00
bors
f132401a0b auto merge of #7982 : thestinger/rust/iterator, r=thestinger
f0f4dcc r=huonw
25e9c4c r=graydon
a87c2d1 r=brson
16f369d r=cmr
9f05cc8 r=bstrie
e858055 r=huonw
5d80938 r=thestinger
05d03e7 r=cmr
8f86fa3 r=thestinger
2013-07-24 08:52:36 -07:00
blake2-ppc
8f86fa3b31 rc: Use ~T for allocation
Simplify Rc<T>/RcMut<T> by using ~T when allocating a reference counted
box.
2013-07-24 10:22:55 -04:00
Daniel Micay
4a2d22bdb1 fix compilation on macos/windows 2013-07-24 09:45:21 -04:00
Stepan Koltsov
c50d3e3fca ToStr for HashMap does not need value to implement Eq or Hash 2013-07-24 09:45:21 -04:00
Brian Anderson
8d3bb7eb30 rustc: Remove some dead code from method resolution 2013-07-24 09:45:21 -04:00
Björn Steinbrink
7fbe8002d5 Fix a crash when transmuting non-immediate to immediate types
The code to build the transmute intrinsic currently makes the invalid
assumption that if the in-type is non-immediate, the out-type is
non-immediate as well. But this is wrong, for example when transmuting
[int, ..1] to int. So we need to handle this fourth case as well.

Fixes #7988
2013-07-24 09:45:21 -04:00
Daniel Micay
254339fd39 fix fmt! usage 2013-07-24 09:45:20 -04:00
Birunthan Mohanathas
5afb3d20aa Disallow non-comma-delimited arguments to fmt! and bytes!
Closes #4982.
2013-07-24 09:45:20 -04:00
Brian Anderson
6c88e46d4d std:rt: args module is not used by win/mac. #7951 2013-07-24 09:45:20 -04:00
Birunthan Mohanathas
206ae5752e Change 'print(fmt!(...))' to printf!/printfln! in src/test/ 2013-07-24 09:45:20 -04:00
Birunthan Mohanathas
d047cf1ec6 Change 'print(fmt!(...))' to printf!/printfln! in src/lib* 2013-07-24 09:45:20 -04:00
Daniel Micay
af5a17b7d0 document random-access iterators 2013-07-24 09:45:20 -04:00
Daniel Micay
8c02272512 expand on double-ended iterators in the tutorial 2013-07-24 09:45:20 -04:00
Daniel Micay
626bb5a866 add a RandomAccessIterator trait 2013-07-24 09:45:20 -04:00
bors
51028532d7 auto merge of #7993 : Xazax-hun/rust/master, r=bblum
Added missing memory orderings for atomic types. https://github.com/mozilla/rust/issues/7422
2013-07-24 06:37:36 -07:00
bors
3ee423858a auto merge of #7992 : huonw/rust/un-xfail, r=z0w0
...(they still don't work).
2013-07-24 04:22:36 -07:00