Commit Graph

25741 Commits

Author SHA1 Message Date
bors
dbce62c6bb auto merge of #11311 : hdima/rust/vim-syntax-spell-check, r=cmr
Add `@Spell` clusters to Vim syntax highlighting file to do spell checking only inside comments and strings
2014-01-18 19:06:37 -08:00
Brian Anderson
2d656d6285 Pass the correct --target flag when type checking pretty-printed code in tests
This makes pretty print tests that have aux crates work correctly on Android.
Without they generate errors ICEs about incorrect node ids. Not sure why.
2014-01-18 18:23:46 -08:00
Huon Wilson
68517a2cca syntax: convert ast_map to use a SmallIntMap.
NodeIds are sequential integers starting at zero, so we can achieve some
memory savings by just storing the items all in a line in a vector.

The occupancy for typical crates seems to be 75-80%, so we're already
more efficient than a HashMap (maximum occupancy 75%), not even counting
the extra book-keeping that HashMap does.
2014-01-19 12:56:26 +11:00
bors
c0578b4a41 auto merge of #11632 : brson/rust/issue-11602, r=huonw 2014-01-18 16:46:39 -08:00
Brian Anderson
2ff5963b9d xfail more external syntax extension tests on android 2014-01-18 16:32:33 -08:00
bors
d0f6ef080b auto merge of #11620 : alexcrichton/rust/rustc-silent, r=brson
This commit re-works how the monitor() function works and how it both receives
and transmits errors. There are a few cases in which the compiler can abort:

1. A normal compiler error. In this case, the compiler raises a FatalError as
   the failure value of the task. If this happens, then the monitor task does
   nothing. It ignores all stderr output of the child task and it also
   suppresses the failure message of the main task itself. This means that on a
   normal compiler error just the error message itself is printed.

2. A normal internal compiler error. These are invoked from sess.span_bug() and
   friends. In these cases, they follow the same path (raising a FatalError),
   but they will also print an ICE message which has a URL to go report a bug.

3. An actual compiler bug. This happens whenever anything calls fail!() instead
   of going through the session itself. In this case, we print out stuff about
   RUST_LOG=2 and we by default capture all stderr and print via warn!() so it's
   only printed out with the RUST_LOG var set.
2014-01-18 14:36:41 -08:00
bors
b5a110c7fe auto merge of #11607 : alexcrichton/rust/issue-9957, r=cmr
For `use` statements, this means disallowing qualifiers when in functions and
disallowing `priv` outside of functions.

For `extern mod` statements, this means disallowing everything everywhere. It
may have been envisioned for `pub extern mod foo` to be a thing, but it
currently doesn't do anything (resolve doesn't pick it up), so better to err on
the side of forwards-compatibility and forbid it entirely for now.

Closes #9957
2014-01-18 13:01:47 -08:00
korenchkin
e0ea31f56c Consistent formatting for args and attrs 2014-01-18 21:45:05 +01:00
bors
c5d05acf39 auto merge of #11606 : alexcrichton/rust/issue-9259, r=brson
This must have been fixed in some recent trans refactor/rewrite, hurray!

Closes #9259
2014-01-18 11:32:06 -08:00
Flavio Percoco
3830a3b4f2 Replace old pow_with_uint with the new pow func
There was an old and barely used implementation of pow, which expected
both parameters to be uint and required more traits to be implemented.
Since a new implementation for `pow` landed, I'm proposing to remove
this old impl in favor of the new one.

The benchmark shows that the new implementation is faster than the one
being removed:

test num::bench::bench_pow_function               ..bench:      9429 ns/iter (+/- 2055)
test num::bench::bench_pow_with_uint_function     ...bench:     28476 ns/iter (+/- 2202)
2014-01-18 20:17:12 +01:00
Flavio Percoco
aaf8ba7c51 Added benchmark for pow and pow_with_uint 2014-01-18 20:16:30 +01:00
Alex Crichton
4d5da45e7e Add a test for closed issue #9259
This must have been fixed in some recent trans refactor/rewrite, hurray!

Closes #9259
2014-01-18 11:01:15 -08:00
Alex Crichton
d37e2f79cc Disallow implementation of cross-crate priv traits
Turns out we were just forgetting to encode the privacy for trais, and
everything without privacy defaults to public!

Closes #11593
2014-01-18 10:58:01 -08:00
Alex Crichton
2784313344 rustc: Clean up error reporting
This commit re-works how the monitor() function works and how it both receives
and transmits errors. There are a few cases in which the compiler can abort:

1. A normal compiler error. In this case, the compiler raises a FatalError as
   the failure value of the task. If this happens, then the monitor task does
   nothing. It ignores all stderr output of the child task and it also
   suppresses the failure message of the main task itself. This means that on a
   normal compiler error just the error message itself is printed.

2. A normal internal compiler error. These are invoked from sess.span_bug() and
   friends. In these cases, they follow the same path (raising a FatalError),
   but they will also print an ICE message which has a URL to go report a bug.

3. An actual compiler bug. This happens whenever anything calls fail!() instead
   of going through the session itself. In this case, we print out stuff about
   RUST_LOG=2 and we by default capture all stderr and print via warn!() so it's
   only printed out with the RUST_LOG var set.
2014-01-18 10:49:32 -08:00
Alex Crichton
4a78364d49 Forbid unnecessary visibility on view items
For `use` statements, this means disallowing qualifiers when in functions and
disallowing `priv` outside of functions.

For `extern mod` statements, this means disallowing everything everywhere. It
may have been envisioned for `pub extern mod foo` to be a thing, but it
currently doesn't do anything (resolve doesn't pick it up), so better to err on
the side of forwards-compatibility and forbid it entirely for now.

Closes #9957
2014-01-18 10:46:32 -08:00
Dmitry Vasiliev
99cde8482e Ignore all newline characters in Base64 decoder
Ignore all newline characters in Base64 decoder to make it compatible
with other Base64 decoders.
2014-01-18 19:18:44 +01:00
Erick Tryzelaar
f13086f457 Expose platform independent path separators 2014-01-18 09:19:10 -08:00
bors
f3f2e697d8 auto merge of #11619 : adridu59/rust/patch-md, r=cmr
Noticeably necroes #10892.
Also closes #11559.

r? @alexcrichton
2014-01-18 09:01:46 -08:00
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