Commit Graph

25355 Commits

Author SHA1 Message Date
klutzy
d578ecc407 extra::workcache: Remove unused Logger 2014-01-11 15:10:28 +09:00
bors
a34727f276 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.
2014-01-10 18:21:21 -08:00
bors
5a6ca45c8a auto merge of #11415 : nick29581/rust/visit_trait_option, r=alexcrichton
...Therefore, we should not iterate over it.
2014-01-10 17:06:27 -08:00
Brendan Zabarauskas
4fc0452ace 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.
2014-01-11 10:46:00 +11:00
bors
f411b94ce1 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)

callgrind rustc -S  rust/src/test/bench/sudoku.rs
    u64_from_be_bytes self: 4.37%

-- After --
running 7 tests
test io::extensions::test::test_u64_from_be_bytes ... ok
test io::extensions::bench::u64_from_be_bytes_4_aligned         ... bench:       162 ns/iter (+/- 7)
test io::extensions::bench::u64_from_be_bytes_4_unaligned       ... bench:       164 ns/iter (+/- 7)
test io::extensions::bench::u64_from_be_bytes_7_aligned         ... bench:       201 ns/iter (+/- 7)
test io::extensions::bench::u64_from_be_bytes_7_unaligned       ... bench:       210 ns/iter (+/- 9)
test io::extensions::bench::u64_from_be_bytes_8_aligned         ... bench:       163 ns/iter (+/- 7)
test io::extensions::bench::u64_from_be_bytes_8_unaligned       ... bench:       163 ns/iter (+/- 10)

callgrind rustc -S  rust/src/test/bench/sudoku.rs
    u64_from_be_bytes self: 1.78%
2014-01-10 14:01:34 -08:00
bors
33e8663391 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)
2014-01-10 11:51:21 -08:00
Raphael Catolino
02d86216f3 Improve invalid operator assignment handling. 2014-01-10 20:46:20 +01:00
Carl-Anton Ingmarsson
0b3311c260 std::io: Optimize u64_from_be_bytes()
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.
2014-01-10 20:14:05 +01:00
bors
ff7ecca20e auto merge of #11452 : derekchiang/rust/fix-11421, r=cmr
Closes #11421.  A pretty trivial fix.
2014-01-10 08:26:24 -08:00
bors
7fe8692d33 auto merge of #11451 : kud1ing/rust/patch-1, r=cmr 2014-01-10 07:06:32 -08:00
Derek Chiang
6f875c96b3 Fix #11421 2014-01-10 22:09:59 +08:00
kud1ing
aca705cae9 "As long an iterator" => "As long as an iterator" 2014-01-10 15:05:54 +01:00
Carl-Anton Ingmarsson
326e63187f std::io: Add tests and benchmarks for u64_from_be_bytes() 2014-01-10 13:37:50 +01:00
bors
423dd84300 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.
2014-01-10 03:11:17 -08:00
bors
72a52522ca auto merge of #11437 : sfackler/rust/mem-eof, r=alexcrichton
It's easy to figure out and useful as a sanity check sometimes.
2014-01-10 01:56:18 -08:00
bors
587d0f5a32 auto merge of #11436 : alexcrichton/rust/update-forks, r=huonw
We're not moving everything just yet, but it's good to start somewhere!
2014-01-10 00:41:21 -08:00
bors
6ea218d37b auto merge of #11433 : brson/rust/minorstylefixes, r=alexcrichton 2014-01-09 23:26:20 -08:00
Jed Davis
5487f15bbf 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.
2014-01-09 22:24:31 -08:00
bors
c72f984d5e auto merge of #11418 : alexcrichton/rust/snapshots, r=cmr 2014-01-09 21:56:20 -08:00
Steven Fackler
52e06c663c Add eof to MemReader and BufReader
It's easy to figure out and useful as a sanity check sometimes.
2014-01-09 21:03:18 -08:00
Nick Cameron
40d8a12b68 item_impl holds an Option<> to the trait ref, not a list of trait refs. Therefore, we should not iterate over it. 2014-01-10 17:54:12 +13:00
Alex Crichton
1ea3052f41 Update submodules to point to rust-lang repos 2014-01-09 20:21:22 -08:00
bors
f78293c274 auto merge of #11360 : huonw/rust/stack_bounds, r=alexcrichton
We just approximate with a 2MB stack for native::start.
2014-01-09 20:21:17 -08:00
bors
28ddc6537f auto merge of #10926 : thestinger/rust/rc, r=cmr 2014-01-09 19:01:30 -08:00
Daniel Micay
fc60ace7a9 port over the old tests to the new Rc 2014-01-09 21:59:07 -05:00
Brian Anderson
55f81bce83 rustc: Fix style of Lint enum 2014-01-09 18:46:23 -08:00
Brian Anderson
520c82e0e9 rustc: Fix style of OutputType enum 2014-01-09 18:46:21 -08:00
bors
ff3d5d4603 auto merge of #11055 : pcwalton/rust/placement-box, r=pcwalton
r? @nikomatsakis
2014-01-09 16:11:18 -08:00
Patrick Walton
e12711540a librustc: Implement placement box for GC and unique pointers. 2014-01-09 16:05:34 -08:00
bors
d28317d78f 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.
2014-01-09 14:56:19 -08:00
OGINO Masanori
20ec0be779 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 .

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-10 07:21:32 +09:00
OGINO Masanori
d4051b6145 Update doc/po4a.conf for recent changes.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-01-10 07:21:32 +09:00
Daniel Micay
c5bcb22719 rename Strong -> Rc, replacing rc with weak 2014-01-09 16:02:17 -05:00
Daniel Micay
77cc1c5107 add a strong/weak reference counted pointer type 2014-01-09 15:53:44 -05:00
Daniel Micay
b36a948831 stop treating Rc cycles as unsafe 2014-01-09 15:53:44 -05:00
bors
9d63403c1c auto merge of #11417 : eddyb/rust/desnaking, r=bstrie 2014-01-09 12:31:35 -08:00
Eduard Burtescu
72ee4a57b7 Updated librustdoc and librustpkg to use the proper UpperCase names from libsyntax. 2014-01-09 22:25:28 +02:00
Eduard Burtescu
6b221768cf libsyntax: Renamed types, traits and enum variants to CamelCase. 2014-01-09 22:25:28 +02:00
bors
63ba93f91d 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.
2014-01-09 09:31:36 -08:00
Alex Crichton
a18282c3d0 Remove eof() from io::Reader 2014-01-09 09:27:10 -08:00
Alex Crichton
f2a86a2da6 Register new snapshots 2014-01-09 09:18:59 -08:00
bors
dd11fe17c7 auto merge of #11414 : nick29581/rust/span, r=alexcrichton
...at the start of the path, rather than at the start of the view_path.

Fixes #11317
2014-01-09 07:41:33 -08:00
bors
1b0f5b23fc auto merge of #11412 : bjz/rust/num-cleanups, r=alexcrichton
The methods contained in `std::num::{Algebraic, Trigonometric, Exponential, Hyperbolic}` have now been moved into `std::num::Real`. This is part of an ongoing effort to simplify `std::num` (see issue #10387).

`std::num::RealExt` has also been removed from the prelude because it is not a commonly used trait.

r? @alexcrichton
2014-01-09 06:26:27 -08:00
bors
ab9ec6d59a auto merge of #11402 : bjz/rust/remove-approx, r=alexcrichton
This trait seems to stray too far from the mandate of a standard library as implementations may vary between use cases. Third party libraries should implement their own if they need something like it.

This closes #5316.

r? @alexcrichton, @pcwalton
2014-01-09 05:06:33 -08:00
bors
fb44e20f65 auto merge of #11394 : alexcrichton/rust/no-decorator, r=cmr
This is just an unnecessary trait that no one's ever going to parameterize over
and it's more useful to just define the methods directly on the types
themselves. The implementors of this type almost always don't want
inner_mut_ref() but they're forced to define it as well.
2014-01-09 03:51:27 -08:00
bors
c34fc5e33b auto merge of #11387 : pcwalton/rust/de-at-block, r=alexcrichton
r? @brson
2014-01-09 02:26:26 -08:00
bors
ebc079c787 auto merge of #11386 : rcatolino/rust/ice-10955, r=pcwalton
So, like I mentioned in issue #10955 it doesn't seem like we need to call ```ty::subst_tps``` when the method is generic. But then I realized that this function doesn't mutate any of its input, and the return value is unused. Plus the type param substitution seems to be taken care of in ```trans_fn_ref_with_vtables```, so I thought I'd just try to remove it. As far as I can tell everything works.

This closes #10955.
2014-01-09 00:16:30 -08:00
Alex Crichton
6df57ec2e2 Remove the io::Decorator trait
This is just an unnecessary trait that no one's ever going to parameterize over
and it's more useful to just define the methods directly on the types
themselves. The implementors of this type almost always don't want
inner_mut_ref() but they're forced to define it as well.
2014-01-08 23:42:28 -08:00
Nick Cameron
01f42eed80 Start the span for a path in a view_path at the correct place (at the start of the path, rather than at the start of the view_path). 2014-01-09 20:12:23 +13:00
bors
f6963e260a auto merge of #11369 : kvark/rust/master, r=huonw
-Fixed Gc::clone to not require a Clone implementation for T
-Implemented Gc::ptr_eq to match Rc::ptr_eq, added a test for that
2014-01-08 21:26:29 -08:00