Commit Graph

25618 Commits

Author SHA1 Message Date
bors
bf07c80838 auto merge of #11629 : brson/rust/whattayaknowitsmoreandroidfixes, r=cmr 2014-01-18 07:36:43 -08:00
bors
2952685917 auto merge of #11622 : bjz/rust/simplify-primitive-trait, r=brson
As part of #10387, this removes the `Primitive::{bits, bytes, is_signed}` methods and removes the trait's operator trait constraints for the reasons outlined below:

- The `Primitive::{bits, bytes}` associated functions were originally added to reflect the existing `BITS` and `BYTES`statics included in the numeric modules. These statics are only exist as a workaround for Rust's lack of CTFE, and should be deprecated in the future in favor of using the `std::mem::size_of` function (see #11621).

- `Primitive::is_signed` seems to be of little utility and does not seem to be used anywhere in the Rust compiler or libraries. It is also rather ugly to call due to the `Option<Self>` workaround for #8888.

- The operator trait constraints are already covered by the `Num` trait.
2014-01-18 05:36:47 -08:00
Adrien Tétar
14f605df21 doc: fix dangling links in rust.md
Fixes #11559 (not that the manual couldn't use a review).
2014-01-18 13:30:32 +01:00
bors
fb40bdbb62 auto merge of #11614 : remen/rust/patch-1, r=alexcrichton
#[cfg(test)] was being interpreted as starting a header
2014-01-18 03:41:42 -08:00
bors
88dd987df0 auto merge of #11605 : alexcrichton/rust/issue-9582, r=brson
Closes #9582
2014-01-18 01:06:47 -08:00
bors
1da2962e2e auto merge of #11001 : DaGenix/rust/iter-renaming, r=alexcrichton
Most Iterators renamed to make their naming more consistent. Most significantly, the Iterator and Iter suffixes have been completely removed.
2014-01-17 23:41:45 -08:00
Kevin Ballard
b3c93b34f3 Make WindowsPath::new("C:foo").root_path() return Some("C:") 2014-01-17 23:07:53 -08:00
Brian Anderson
50f4a0ec74 Move macro-crate to run-pass-fulldeps and force-host the aux build 2014-01-17 22:34:58 -08:00
Brian Anderson
4a3a61bd83 xfail shootout-reverse-complement on android 2014-01-17 22:34:58 -08:00
Palmer Cox
3fd8c8b330 Rename iterators for consistency
Rename existing iterators to get rid of the Iterator suffix and to
give them names that better describe the things being iterated over.
2014-01-18 01:15:15 -05:00
bors
0f8c29f0b4 auto merge of #11086 : metajack/rust/rustpkg-new-crateid-syntax, r=cmr
...arts.

This fixes a bug where new syntax crate IDs would cause rustpkg to fail to
build crates.
2014-01-17 22:06:46 -08:00
Steven Fackler
1e20960f79 Actually force a / in the path for ext crates
If the library is in the working directory, its path won't have a "/"
which will cause dlopen to search /usr/lib etc. It turns out that Path
auto-normalizes during joins so Path::new(".").join(path) is actually a
no-op.
2014-01-17 21:51:38 -08:00
Daniel Micay
ae2a5ecbf6 handle zero-size allocations correctly
The `malloc` family of functions may return a null pointer for a
zero-size allocation, which should not be interpreted as an
out-of-memory error.

If the implementation does not return a null pointer, then handling
this will result in memory savings for zero-size types.

This also switches some code to `malloc_raw` in order to maintain a
centralized point for handling out-of-memory in `rt::global_heap`.

Closes #11634
2014-01-17 23:41:31 -05:00
bors
c58d2bacb7 auto merge of #11503 : FlaPer87/rust/master, r=huonw
The patch adds the missing pow method for all the implementations of the
Integer trait. This is a small addition that will most likely be
improved by the work happening in #10387.

Fixes #11499
2014-01-17 20:36:47 -08:00
Brian Anderson
f52bd5e4b7 rustc: Feature gate log_syntax!. Closes #11602 2014-01-17 20:10:47 -08:00
bors
f4498c71e2 auto merge of #11497 : huonw/rust/trie-internal-iter, r=alexcrichton
This stores the stack of iterators inline (we have a maximum depth with
`uint` keys), and then uses direct pointer offsetting to manipulate it,
in a blazing fast way:

Before:

    bench_iter_large          ... bench:     43187 ns/iter (+/- 3082)
    bench_iter_small          ... bench:       618 ns/iter (+/- 288)

After:

    bench_iter_large          ... bench:     13497 ns/iter (+/- 1575)
    bench_iter_small          ... bench:       220 ns/iter (+/- 91)

Also, removes `.each_{key,value}_reverse` as an offering to
placate the gods of external iterators for my heinous sin of 
attempting to add new internal ones (in a previous version of this
PR).
2014-01-17 17:56:41 -08:00
chromatic
0578c15abd Fixed typos in comments of librustc backend. 2014-01-17 17:14:47 -08:00
bors
2ff358c062 auto merge of #11618 : alexcrichton/rust/force-host, r=brson
The new macro loading infrastructure needs the ability to force a
procedural-macro crate to be built with the host architecture rather than the
target architecture (because the compiler is just about to dlopen it).
2014-01-17 15:46:40 -08:00
Huon Wilson
0148055a56 std::trie: use unsafe code to give a 3x speed up to the iterator.
This stores the stack of iterators inline (we have a maximum depth with
`uint` keys), and then uses direct pointer offsetting to manipulate it,
in a blazing fast way:

Before:

    bench_iter_large          ... bench:     43187 ns/iter (+/- 3082)
    bench_iter_small          ... bench:       618 ns/iter (+/- 288)

After:

    bench_iter_large          ... bench:     13497 ns/iter (+/- 1575)
    bench_iter_small          ... bench:       220 ns/iter (+/- 91)
2014-01-18 10:46:11 +11:00
Huon Wilson
f0c554d0d8 std::trie: remove each_{key,value}_reverse internal iterators.
This are *trivial* to reimplement in terms of each_reverse if that extra
little bit of performance is needed.
2014-01-18 10:45:34 +11:00
Brendan Zabarauskas
f125b71c00 Add FIXME comments regarding issue #11526. 2014-01-18 09:13:10 +11:00
Brendan Zabarauskas
472dfe74b3 Simplify std::num::Primitive trait definition
This removes the `Primitive::{bits, bytes, is_signed}` methods and removes the operator trait constraints, for the reasons outlined below:

- The `Primitive::{bits, bytes}` associated functions were originally added to reflect the existing `BITS` and `BYTES` statics included in the numeric modules. These statics are only exist as a workaround for Rust's lack of CTFE, and should probably be deprecated in the future in favor of using the `std::mem::size_of` function (see #11621).

- `Primitive::is_signed` seems to be of little utility and does not seem to be used anywhere in the Rust compiler or libraries. It is also rather ugly to call due to the `Option<Self>` workaround for #8888.

- The operator trait constraints are already covered by the `Num` trait.
2014-01-18 09:12:53 +11:00
Jack Moffitt
7fb712e269 Warning police. 2014-01-17 14:45:07 -07:00
Jack Moffitt
f7088edc03 Change some rustpkg tests to use new crate_id syntax. 2014-01-17 14:45:07 -07:00
Jack Moffitt
363fa51c66 Use the libsyntax PkgId parser in Rustpkg, but keep Rustpkg's version smarts.
This fixes a bug where new syntax crate IDs would cause rustpkg to fail to
build crates.
2014-01-17 14:45:07 -07:00
bors
aa67e13498 auto merge of #11604 : alexcrichton/rust/issue-11162, r=brson
Apparently this isn't necessary, and it's just causing problems.

Closes #11162
2014-01-17 13:36:43 -08:00
bors
9bf85a250c auto merge of #11598 : alexcrichton/rust/io-export, r=brson
* Reexport io::mem and io::buffered structs directly under io, make mem/buffered
  private modules
* Remove with_mem_writer
* Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered)

cc #11119
2014-01-17 12:02:07 -08:00
Alex Crichton
bd469341eb test: Add the ability to force a host target
The new macro loading infrastructure needs the ability to force a
procedural-macro crate to be built with the host architecture rather than the
target architecture (because the compiler is just about to dlopen it).
2014-01-17 11:13:22 -08:00
Adrien Tétar
2c19f51d52 doc: fix rust.md fallout 2014-01-17 19:59:37 +01:00
Edward Z. Yang
e33b1dabd3 Elaborate manual on matching (dereference patterns, lvalue/rvalue matching)
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
2014-01-17 19:44:51 +01:00
Adrien Tétar
b2cac497e8 doc: fix version stamp for TeX files
This fixes a regression introduced in
3d57b240ab.
2014-01-17 19:38:51 +01:00
Petter Remen
c6ad2de6f1 Fixup in guide-testing.md
Added back-quotes around #[cfg(test)] which was otherwise
being interpreted as starting a header
2014-01-17 19:04:55 +01:00
Alex Crichton
295b46fc08 Tweak the interface of std::io
* Reexport io::mem and io::buffered structs directly under io, make mem/buffered
  private modules
* Remove with_mem_writer
* Remove DEFAULT_CAPACITY and use DEFAULT_BUF_SIZE (in io::buffered)
2014-01-17 10:00:47 -08:00
bors
4098327b1f auto merge of #11585 : nikomatsakis/rust/issue-3511-rvalue-lifetimes, r=pcwalton
Major changes:

- Define temporary scopes in a syntax-based way that basically defaults
  to the innermost statement or conditional block, except for in
  a `let` initializer, where we default to the innermost block. Rules
  are documented in the code, but not in the manual (yet).
  See new test run-pass/cleanup-value-scopes.rs for examples.
- Refactors Datum to better define cleanup roles.
- Refactor cleanup scopes to not be tied to basic blocks, permitting
  us to have a very large number of scopes (one per AST node).
- Introduce nascent documentation in trans/doc.rs covering datums and
  cleanup in a more comprehensive way.

r? @pcwalton
2014-01-17 07:56:45 -08:00
Niko Matsakis
b520c2f280 Adjust comments in test case 2014-01-17 10:47:29 -05:00
Niko Matsakis
483ae32189 Update years on more license headers 2014-01-17 10:18:39 -05:00
Niko Matsakis
578b9d1d97 Update year on license header 2014-01-17 10:13:53 -05:00
Huon Wilson
4be3262058 syntax::ext: replace span_fatal with span_err in many places.
This means that compilation continues for longer, and so we can see more
errors per compile. This is mildly more user-friendly because it stops
users having to run rustc n times to see n macro errors: just run it
once to see all of them.
2014-01-18 02:03:04 +11:00
Flavio Percoco
ed7e576d9c Add a generic power function
The patch adds a `pow` function for types implementing `One`, `Mul` and
`Clone` trait.

The patch also renames f32 and f64 pow into powf in order to still have
a way to easily have float powers. It uses llvms intrinsics.

The pow implementation for all num types uses the exponentiation by
square.

Fixes bug #11499
2014-01-17 15:41:26 +01:00
bors
1e1871f35e auto merge of #11479 : khodzha/rust/peekable_empty, r=brson
to fix https://github.com/mozilla/rust/issues/11218
2014-01-17 06:32:01 -08:00
Niko Matsakis
b1da8c618f Change expansion of for loop to use a match statement
so that the "innermost enclosing statement" used for rvalue
temporaries matches up with user expectations
2014-01-17 08:30:06 -05:00
Niko Matsakis
8f16356e5f Extend temporary lifetimes if there is a ref in an enum binding
too.

Previously I had omitted this case since function calls don't get the same
treatment on the RHS, but it's different on the pattern and is more consistent
-- the goal is to identify `let` statements where `ref` bindings create
interior pointers.
2014-01-17 08:10:42 -05:00
Niko Matsakis
56f4d1831a Link lifetimes in let patterns just as we do for match patterns 2014-01-17 08:04:38 -05:00
bors
7d75bbf50d auto merge of #11601 : dguenther/rust/fix_test_summary, r=brson
The test run summary currently prints the wrong number of tests run. This PR fixes it by adding a newline to the log output, and also adds support for counting bench runs.

Closes #11381
2014-01-17 04:11:46 -08:00
Alex Whitney
32408a6e32 Fixed bug when initialising bitv from bool=true 2014-01-17 12:07:32 +00:00
bors
93fb12e3d0 auto merge of #11498 : c-a/rust/optimize_vuint_at, r=alexcrichton
Use a lookup table, SHIFT_MASK_TABLE, that for every possible four
bit prefix holds the number of times the value should be right shifted and what
the right shifted value should be masked with. This way we can get rid of the
branches which in my testing gives approximately a 2x speedup.

Timings on Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz

-- Before --
running 5 tests
test ebml::tests::test_vuint_at ... ok
test ebml::bench::vuint_at_A_aligned          ... bench:       494 ns/iter (+/- 3)
test ebml::bench::vuint_at_A_unaligned        ... bench:       494 ns/iter (+/- 4)
test ebml::bench::vuint_at_D_aligned          ... bench:       467 ns/iter (+/- 5)
test ebml::bench::vuint_at_D_unaligned        ... bench:       467 ns/iter (+/- 5)

-- After --
running 5 tests
test ebml::tests::test_vuint_at ... ok
test ebml::bench::vuint_at_A_aligned ... bench: 181 ns/iter (+/- 2)
test ebml::bench::vuint_at_A_unaligned ... bench: 192 ns/iter (+/- 1)
test ebml::bench::vuint_at_D_aligned ... bench: 181 ns/iter (+/- 3)
test ebml::bench::vuint_at_D_unaligned ... bench: 197 ns/iter (+/- 6)
2014-01-17 00:01:56 -08:00
Niko Matsakis
0c916c58e8 Make main() public in uninit-empty-types 2014-01-17 01:02:16 -05:00
bors
5fdc81262a auto merge of #11553 : klutzy/rust/rustc-cleanups, r=alexcrichton 2014-01-16 20:56:45 -08:00
klutzy
b33d2fede8 syntax::ast: Remove/Recover tests
`xorpush_test` and `test_marksof` are at `syntax::ast_util`.

Fixes #7952
2014-01-17 13:27:47 +09:00
klutzy
ec6aba37d7 rustc::metadata: Remove trait FileSearch 2014-01-17 13:27:47 +09:00