bors [Mon, 13 Jan 2014 17:21:41 +0000 (09:21 -0800)]
auto merge of #11513 : huonw/rust/generic-errs, r=alexcrichton
Unsuffixed literals like 1 and 1.1, and free type parameters sometimes
have to be printed in error messages, which ended up with \<V0>, \<VI0>
and \<VF0>. This change puts the words "generic" and "integer"/"float"
into the message so it's not a completely black box.
Huon Wilson [Mon, 13 Jan 2014 11:08:28 +0000 (22:08 +1100)]
rustc: make error messages containing generic more self-explanatory.
Unsuffixed literals like 1 and 1.1, and free type parameters sometimes
have to be printed in error messages, which ended up with <V0>, <VI0>
and <VF0>. This change puts the words "generic" and "integer"/"float"
into the message so it's not a completely black box.
bors [Mon, 13 Jan 2014 00:16:34 +0000 (16:16 -0800)]
auto merge of #11504 : bjz/rust/std-num-cleanups, r=brson
The gamma and bessel functions are of little utility outside a small specialized subset of use cases, and so they don't really make sense for inclusion in the standard library. The only reason they were included in the first place was to mirror libm, which is not a very good justification. If people need them for their own projects then they can make their own bindings to libm (which isn't too hard).
These functions are of little utility outside a small subset of use cases. If people need them for their own projects then they can use their own bindings for libm (which aren't hard to make).
bors [Sun, 12 Jan 2014 19:16:32 +0000 (11:16 -0800)]
auto merge of #11471 : ktt3ja/rust/issue-11380, r=alexcrichton
Dead code pass now explicitly checks for `#[allow(dead_code)]` and
`#[lang=".."]` attributes on items and marks them as live if they have
those attributes. The former is done so that if we want to suppress
warnings for a group of dead functions, we only have to annotate the
"root" of the call chain.
Kiet Tran [Sat, 11 Jan 2014 08:21:53 +0000 (03:21 -0500)]
Mark allowed dead code and lang items as live
Dead code pass now explicitly checks for `#[allow(dead_code)]` and
`#[lang=".."]` attributes on items and marks them as live if they have
those attributes. The former is done so that if we want to suppress
warnings for a group of dead functions, we only have to annotate the
"root" of the call chain.
Kevin Ballard [Sun, 12 Jan 2014 03:15:05 +0000 (19:15 -0800)]
Restore missing line breaks in doc/index.html
a30d61b05a removed all of the trailing whitespace in doc/index.md.
Unfortunately, that trailing whitespace was actually markdown syntax for
line breaks.
SiegeLord [Sat, 11 Jan 2014 18:53:06 +0000 (13:53 -0500)]
Tighten up float literal lexing.
Specifically, dissallow setting the number base for every type of float
literal, not only those that contain the decimal point. This is in line with
the description in the manual.
bors [Sat, 11 Jan 2014 18:21:22 +0000 (10:21 -0800)]
auto merge of #11470 : eminence/rust/rustpkg_help_test, r=alexcrichton
In general, you can run "rustpkg help <cmd>" to see some specific usage information for <cmd>. However, this was handled in a very ad-hoc and buggy manner. For example, running "rustpkg help prefer" would actually show you the usage information for the "uninstall" cmd. Or "rustpkg help test" would show you the usage information for the "build" command. Or "rustpkg help list" would just run the "list" command (and not show you anything usage information)
This commit attempts to fix this by making a new HelpCmd (and handling it explicitly)
bors [Sat, 11 Jan 2014 16:46:20 +0000 (08:46 -0800)]
auto merge of #11472 : kud1ing/rust/iOS, r=alexcrichton
This fixes #11336
I guess the type sizes are correct for both OS X and iOS, but i am not certain.
In any case, i'd rather have any iOS build at all, so that we have something to improve upon.
Andrew Chin [Sat, 11 Jan 2014 05:34:09 +0000 (00:34 -0500)]
Fix `rustpkg help` handling
In general, you could run "rustpkg help <cmd>" to see some specific
usage information for <cmd>. However, this was handled in a very ad-hoc
and buggy manner. For example, running "rustpkg help prefer" would
actually show you the usage information for the "uninstall" cmd.
This commit attempts to fix this by making Help a real Command, and
making the handing of it explicit.
bors [Sat, 11 Jan 2014 02:21:21 +0000 (18:21 -0800)]
auto merge of #11416 : bjz/rust/remove-print-fns, r=alexcrichton
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
Remove re-exports of std::io::stdio::{print, println} in the prelude.
The `print!` and `println!` macros are now the preferred method of printing, and so there is no reason to export the `stdio` functions in the prelude. The functions have also been replaced by their macro counterparts in the tutorial and other documentation so that newcomers don't get confused about what they should be using.
bors [Fri, 10 Jan 2014 22:01:34 +0000 (14:01 -0800)]
auto merge of #11448 : c-a/rust/u64_from_be_bytes, r=alexcrichton
Instead of reading a byte at a time in a loop we hardcode how to read each size.
We also try to do as few reads as possible by reading as big primitive types as
possible. For example if size is eight we do a single read of a u64 value and
if size is seven we read it as [u32|u16|u8].
Timings on a Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
-- Before --
running 7 tests
test io::extensions::test::test_u64_from_be_bytes ... ok
test io::extensions::bench::u64_from_be_bytes_4_aligned ... bench: 386 ns/iter (+/- 5)
test io::extensions::bench::u64_from_be_bytes_4_unaligned ... bench: 387 ns/iter (+/- 2)
test io::extensions::bench::u64_from_be_bytes_7_aligned ... bench: 628 ns/iter (+/- 1)
test io::extensions::bench::u64_from_be_bytes_7_unaligned ... bench: 637 ns/iter (+/- 3)
test io::extensions::bench::u64_from_be_bytes_8_aligned ... bench: 727 ns/iter (+/- 18)
test io::extensions::bench::u64_from_be_bytes_8_unaligned ... bench: 723 ns/iter (+/- 22)
bors [Fri, 10 Jan 2014 19:51:21 +0000 (11:51 -0800)]
auto merge of #11449 : rcatolino/rust/assign-binop-handling, r=alexcrichton
So far the following code
```
struct Foo;
fn main() {
let mut t = Foo;
let ref b = Foo;
a += *b;
}
```
errors with
```
test.rs:15:3: 13:11 error: binary operation + cannot be applied to type `Foo`
test.rs:15 *a += *b;
```
Since assignment-operators are no longer expanded to ```left = left OP right``` but are independents operators it should be
```
test.rs:15:3: 13:11 error: binary operation += cannot be applied to type `Foo`
test.rs:15 *a += *b;
```
to make it clear that implementing Add for Foo is not gonna work. (cf issues #11143, #11344)
Besides that, we also need to typecheck the rhs expression even if the operator has no implementation, or we end up with unknown types for the nodes of the rhs and an ICE later on while resolving types. (once again cf #11143 and #11344).
This probably would get fixed with #5992, but in the meantime it's a confusing error to stumble upon.
@pcwalton, you wrote the original code, what do you think?
(closes #11143 and #11344)
Instead of reading a byte at a time in a loop we copy the relevant bytes into
a temporary vector of size eight. We can then read the value from the temporary
vector using a single u64 read. LLVM seems to be able to optimize this
almost scarily good.
bors [Fri, 10 Jan 2014 11:11:17 +0000 (03:11 -0800)]
auto merge of #11441 : jld/rust/enum-nullable-const-null-with-fields, r=alexcrichton
That is, if you have an enum type that is subject to the nullable
pointer optimization, but the null variant has a nonzero number of
fields, and you declare a static whose value is of that variant, then
that used to be an ICE but this change fixes it.
Jed Davis [Fri, 10 Jan 2014 06:24:31 +0000 (22:24 -0800)]
Fix ICE on const of nullable enum with fields in null case.
That is, if you have an enum type that is subject to the nullable
pointer optimization, but the null variant has a nonzero number of
fields, and you declare a static whose value is of that variant, then
that used to be an ICE but this change fixes it.
bors [Thu, 9 Jan 2014 22:56:19 +0000 (14:56 -0800)]
auto merge of #11427 : omasanori/rust/remove-pot, r=alexcrichton
`doc/po/*.pot` files are generated automatically using `po4a` and they includes timestamps in their content. The files can cause huge conflicts unnecessarily. Also, removing them save disk space if you are not a translator.
OGINO Masanori [Thu, 9 Jan 2014 22:05:52 +0000 (07:05 +0900)]
Remove *.pot files and ignore them now.
The .pot files can be generated automatically and the files contain
timestamps in their content. They can cause huge conflicts and take huge
space even if you are not a translator.
This commit is a part of improvement discussed on
https://github.com/mozilla/rust/pull/11383 .
bors [Thu, 9 Jan 2014 17:31:36 +0000 (09:31 -0800)]
auto merge of #11376 : alexcrichton/rust/remove-eof, r=pcwalton
This is something I have been meaning to do for awhile, but upon inspection of the `eof` method on all of the `Reader` impls you may find some interesting surprises. The method returns a good answer for almost all wrapped I/O objects (buffered readers, mem readers, util readers, etc), but the actual return value on all I/O objects themselves is almost always useless.
Almost no I/O object other than a file actually knows when it's hit EOF or not. I think that pretending that all objects know when they've hit the end when almost none do is probably a bad idea. I can't really come up with a good answer to "is this file descriptor at eof" or "is this tcp stream at eof" much less "is this udp socket at eof". Due to being unable to answer these questions for *all* readers, I believe that it shouldn't be a part of the core `Reader` trait.