Commit Graph

28860 Commits

Author SHA1 Message Date
Huon Wilson
2f0f017d3e test: implement a no-alloc -> &str method for TestName.
This is far cheaper than the `.to_str` technique that was used previously.
2014-05-15 21:17:35 +10:00
bors
fedffa785e auto merge of #14145 : pnkfelix/rust/fsk-better-svh-via-visitor, r=alexcrichton
Teach SVH computation to ignore more implementation artifacts.

In particular, this version of strict version hash (SVH) works much
like the deriving(Hash)-based implementation did, except that it
deliberately:

  1. skips over content known not affect the generated crates, and,

  2. uses a content-based hash for names instead of using the value of
     the `Name` index itself, which can differ depending on the order
     in which strings are interned (which in turn is affected by
     e.g. the presence of `--cfg` options on the command line).

Fix #14132.
2014-05-15 02:41:50 -07:00
Felix S. Klock II
5236af8c0f Added tests checking that changes in type sig are recognized in SVH.
(Only after adding the tests did I realize that this is not really a
special case at the AST level; as far as the visitor is concerned,
`int` and `i32` and `i64` are just idents.)
2014-05-15 11:09:26 +02:00
Felix S. Klock II
930308b16e A test case for a bug I found in the new SVH while reviewing it.
Namely: non-pub `use` declarations *are* significant to the SVH
computation, since they can change which traits are part of the method
resolution step, and thus affect which methods get called from the
(potentially inlined) code.
2014-05-15 11:09:26 +02:00
Felix S. Klock II
a92d162026 Some basic acceptance tests for better SVH. 2014-05-15 11:09:26 +02:00
Felix S. Klock II
b9ed9ed5ad Teach SVH computation to ignore more implementation artifacts.
In particular, this version of strict version hash (SVH) works much
like the deriving(Hash)-based implementation did, except that uses a
content-based hash that filters rustc implementation artifacts and
surface syntax artifacts.

Fix #14132.
2014-05-15 11:09:18 +02:00
Felix S. Klock II
d6cf0dfbab syntax::visit: pub walk_explicit_self so impls can call it as defaults do.
drive-by: added some doc.
2014-05-15 10:55:02 +02:00
bors
579e0a5f55 auto merge of #14162 : brson/rust/fixvercmd, r=brson
Instead of just blindly printing arg[0], use a constant string.

Partial fix for #13582
2014-05-15 01:02:11 -07:00
bors
73a68cdba0 auto merge of #14133 : db48x/rust/ord-for-mut-refs, r=alexcrichton
Also Show, which is useful in assertions. Fixes #14074
2014-05-14 22:06:50 -07:00
bors
e10fd31721 auto merge of #14170 : pcwalton/rust/detildestr-misclibs, r=alexcrichton
r? @brson
2014-05-14 19:31:52 -07:00
Patrick Walton
351a564df5 libnum: Remove all uses of ~str from libnum 2014-05-14 18:29:14 -07:00
Patrick Walton
1ef8246946 libcollections: Remove most uses of ~str from libcollections 2014-05-14 18:29:14 -07:00
Patrick Walton
dfe021625a liburl: Remove all uses of ~str from liburl 2014-05-14 18:29:14 -07:00
Patrick Walton
ded860c0e8 libterm: Remove all uses of ~str from libterm 2014-05-14 18:29:13 -07:00
Patrick Walton
93499b1eaf libtest: Remove all uses of ~str from libtest. 2014-05-14 18:29:13 -07:00
Patrick Walton
1440e09839 libsync: Remove all uses of ~str from libsync 2014-05-14 18:29:13 -07:00
Patrick Walton
7abf6f1346 librand: Remove all uses of ~str from librand 2014-05-14 18:29:13 -07:00
Patrick Walton
6415d06616 libtime: Remove all uses of ~str from libtime 2014-05-14 18:29:13 -07:00
Patrick Walton
5a93b4f192 libsemver: Remove all uses of ~str from libsemver 2014-05-14 18:29:12 -07:00
Patrick Walton
30dbcf5f88 libglob: Remove all uses of ~str from libglob 2014-05-14 18:29:12 -07:00
Patrick Walton
8a1aaac396 liblog: Remove all uses of ~str from liblog 2014-05-14 18:29:12 -07:00
Patrick Walton
e786a745b5 libgraphviz: Remove all uses of ~str from libgraphviz. 2014-05-14 18:29:12 -07:00
Patrick Walton
ec5911b2a6 libregex: Remove all uses of ~str from libregex 2014-05-14 18:29:12 -07:00
Brian Anderson
67fa90e48a Print 'rustc' and 'rustdoc' as the command name for --version
Instead of just blindly printing arg[0], use a constant string.
Partial fix for #13582
2014-05-14 15:34:14 -07:00
Patrick Walton
62cf95f674 libarena: Remove all uses of ~str from libarena 2014-05-14 14:58:01 -07:00
Patrick Walton
bf249b4411 libhexfloat: Remove all uses of ~str from libhexfloat 2014-05-14 14:58:01 -07:00
Patrick Walton
27977e41fc libuuid: Remove all uses of ~str from libuuid. 2014-05-14 14:58:01 -07:00
Patrick Walton
504335ae5a libworkcache: Remove all uses of ~str from libworkcache. 2014-05-14 14:58:00 -07:00
Patrick Walton
95e310abdc test: Remove all uses of ~str from the test suite. 2014-05-14 14:58:00 -07:00
bors
2a7a39191a auto merge of #14086 : Ryman/rust/resolve_error_suggestions, r=alexcrichton
Provides better help for the resolve failures inside an `impl` if the name matches:
- a field on the self type
- a method on the self type
- a method on the current trait ref (in a trait impl)

Not handling trait method suggestions if in a regular `impl` (as you can see on line 69 of the test), I believe it is possible though.

Also, provides a better message when `self` fails to resolve due to being a static method.

It's using some unsafe pointers to skip copying the larger structures (which are only used in error conditions); it's likely possible to get it working with lifetimes (all the useful refs should outlive the visitor calls) but I haven't really figured that out for this case. (can switch to copying code if wanted)

Closes #2356.
2014-05-14 12:06:29 -07:00
Kevin Butler
595e2910d8 rustc: Improve error messages for resolve failures. 2014-05-14 19:18:18 +01:00
bors
1a1645d3b1 auto merge of #14009 : jcmoyer/rust/bitflags-complement, r=alexcrichton
I feel that this is a very vital, missing piece of functionality. This adds on to #13072.

Only bits used in the definition of the bitflag are considered for the universe set. This is a bit safer than simply inverting all of the bits in the wrapped value.

```rust
bitflags!(flags Flags: u32 {
    FlagA       = 0x00000001,
    FlagB       = 0x00000010,
    FlagC       = 0x00000100,
    FlagABC     = FlagA.bits
                | FlagB.bits
                | FlagC.bits
})

...

// `Not` implements set complement
assert!(!(FlagB | FlagC) == FlagA);
// `all` and `is_all` are the inverses of `empty` and `is_empty`
assert!(Flags::all() - FlagA == !FlagA);
assert!(FlagABC.is_all());
```
2014-05-14 09:21:25 -07:00
bors
96bcadc181 auto merge of #14192 : pongad/rust/walkcleanup, r=pcwalton
Fixes #14134
2014-05-14 07:31:45 -07:00
bors
d78718ad63 auto merge of #14191 : luqmana/rust/eu, r=alexcrichton
We were correctly determining the attributes needed for the parameters for extern fns, but when that extern fn was from another crate we never bothered to pass that information along to LLVM. (i.e never called `foreign::add_argument_attributes`).

I've just changed both local and non-local (crate) extern fn's to be dealt with together (through `foreign::register_foreign_item_fn`) so we don't run into something like again.

Fixes #14177.
2014-05-14 05:56:18 -07:00
bors
d9906813c8 auto merge of #14186 : omasanori/rust/suppress-warnings, r=alexcrichton 2014-05-14 04:06:26 -07:00
bors
03053580ca auto merge of #14179 : luqmana/rust/acp, r=alexcrichton
It's a bit odd to single out just android when we don't do this for any other cross compiling targets. Android builds will still work since we just pass the full path for gcc and ar with `-C linker` and `-C ar`.

I did add the flag to compiletest though so it can find gdb. Though, i'm pretty sure we don't run debuginfo tests on android anyways right now.

[breaking-change]
2014-05-14 02:36:23 -07:00
J.C. Moyer
1595885501 Implement set complement and universe for bitflags 2014-05-14 04:37:06 -04:00
bors
db5ca23118 auto merge of #14169 : alexcrichton/rust/atomics, r=sanxiyn
This module is a foundation on which many other algorithms are built. When hardware support is missing, stubs are provided in libcompiler-rt.a, so this should be available on all platforms.
2014-05-14 01:06:24 -07:00
Daniel Brooks
9eb723d000 define Eq,TotalEq,Ord,TotalOrd for &mut T
Also Show, which is useful in assertions. Fixes #14074
2014-05-14 00:48:02 -07:00
Alex Crichton
949443eff6 core: Allow using failure outside of libcore
Due to our excellent macro hygiene, this involves having a global path and a
hidden module in libcore itself.
2014-05-13 23:59:03 -07:00
Alex Crichton
82a8a5ebb3 core: Document should_not_exist's existence
Explain why it should not exist, and the plan of attack for removing it.
2014-05-13 23:59:03 -07:00
Alex Crichton
57f3b6ee5c core: Add a crate doc block 2014-05-13 23:59:03 -07:00
Alex Crichton
325cc51502 core: Inherit the atomics module 2014-05-13 23:59:03 -07:00
Michael Darakananda
fdb30cd22c Removed unnecessary arguments for walk_* functions 2014-05-14 02:20:25 -04:00
Luqman Aden
589f447299 librustc: Make sure to add argument attributes to extern fns from non-local crates. 2014-05-14 02:18:42 -04:00
Luqman Aden
d0d800f125 Get rid of the android-cross-path flag to rustc.
There's no need to include this specific flag just for android. We can
already deal with what it tries to solve by using -C linker=/path/to/cc
and -C ar=/path/to/ar. The Makefiles for rustc already set this up when
we're crosscompiling.

I did add the flag to compiletest though so it can find gdb. Though, I'm
pretty sure we don't run debuginfo tests on android anyways right now.

[breaking-change]
2014-05-14 02:16:14 -04:00
bors
2e02f6ef00 auto merge of #14178 : alexcrichton/rust/more-ignores, r=brson
It was thought that these failures only happened on windows, turns out they
happen on any 32-bit machine.

cc #14064
2014-05-13 21:41:25 -07:00
bors
e4414739a5 auto merge of #13127 : kballard/rust/read_at_least, r=alexcrichton
Reader.read_at_least() ensures that at least a given number of bytes
have been read. The most common use-case for this is ensuring at least 1
byte has been read. If the reader returns 0 enough times in a row, a new
error kind NoProgress will be returned instead of looping infinitely.

This change is necessary in order to properly support Readers that
repeatedly return 0, either because they're broken, or because they're
attempting to do a non-blocking read on some resource that never becomes
available.

Also add .push() and .push_at_least() methods. push() is like read() but
the results are appended to the passed Vec.

Remove Reader.fill() and Reader.push_exact() as they end up being thin
wrappers around read_at_least() and push_at_least().

[breaking-change]
2014-05-13 20:01:28 -07:00
Kevin Ballard
972f2e5855 io: Add .read_at_least() to Reader
Reader.read_at_least() ensures that at least a given number of bytes
have been read. The most common use-case for this is ensuring at least 1
byte has been read. If the reader returns 0 enough times in a row, a new
error kind NoProgress will be returned instead of looping infinitely.

This change is necessary in order to properly support Readers that
repeatedly return 0, either because they're broken, or because they're
attempting to do a non-blocking read on some resource that never becomes
available.

Also add .push() and .push_at_least() methods. push() is like read() but
the results are appended to the passed Vec.

Remove Reader.fill() and Reader.push_exact() as they end up being thin
wrappers around read_at_least() and push_at_least().

[breaking-change]
2014-05-13 18:45:20 -07:00
bors
b2b383cab5 auto merge of #14187 : alexcrichton/rust/rollup, r=alexcrichton
Closes #14184 (std: Move the owned module from core to std)
Closes #14183 (Allow blocks in const expressions)
Closes #14176 (Add tests for from_bits.)
Closes #14175 (Replaced ~T by Box<T> in manual)
Closes #14173 (Implements Default trait for BigInt and BigUint)
Closes #14171 (Fix #8391)
Closes #14159 (Clean up unicode code in libstd)
Closes #14126 (docs: Add a not found page)
Closes #14123 (add a line to the example to clarify semantics)
Closes #14106 (Pretty printer improvements)
Closes #14083 (rustllvm: Add LLVMRustArrayType)
Closes #13957 (io: Implement process wait timeouts)
2014-05-13 18:31:51 -07:00