Commit Graph

37297 Commits

Author SHA1 Message Date
bors
e375a892f1 Auto merge of #21257 - alexcrichton:issue-20064, r=pnkfelix
These two attributes are used to change the entry point into a Rust program, but
for now they're being put behind feature gates until we have a chance to think
about them a little more. The #[start] attribute specifically may have its
signature changed.

This is a breaking change to due the usage of these attributes generating errors
by default now. If your crate is using these attributes, add this to your crate
root:

    #![feature(start)] // if you're using the #[start] attribute
    #![feature(main)]  // if you're using the #[main] attribute

cc #20064
2015-01-20 02:23:49 +00:00
bors
65b61ffb3f Auto merge of #21165 - alexcrichton:second-pass-type-id, r=aturon
This commit aims to stabilize the `TypeId` abstraction by moving it out of the
`intrinsics` module into the `any` module of the standard library. Specifically,

* `TypeId` is now defined at `std::any::TypeId`
* `TypeId::hash` has been removed in favor of an implementation of `Hash`.

This commit also performs a final pass over the `any` module, confirming the
following:

* `Any::get_type_id` remains unstable as *usage* of the `Any` trait will likely
  never require this, and the `Any` trait does not need to be implemented for
  any other types. As a result, this implementation detail can remain unstable
  until associated statics are implemented.
* `Any::downcast_ref` is now stable
* `Any::downcast_mut` is now stable
* `BoxAny` remains unstable. While a direct impl on `Box<Any>` is allowed today
  it does not allow downcasting of trait objects like `Box<Any + Send>` (those
  returned from `Thread::join`). This is covered by #18737.
* `BoxAny::downcast` is now stable.
2015-01-19 23:35:12 +00:00
bors
7f8c687fdf Auto merge of #19490 - oli-obk:json_non_string_key_maps, r=alexcrichton
importing object type string key maps is still supported
writing them should be explicit, and can be done as follows

```rust
let some_tree_map : TreeMap<String, Json> = ...;
Json::Object(some_tree_map).to_writer(&mut writer);
```

related to #8335, #9028, #9142
2015-01-19 21:37:52 +00:00
Jorge Aparicio
a09df2cb9d impl Hash for arrays
closes #21402
cc #15294
2015-01-19 15:29:27 -05:00
bors
4032b85aec Auto merge of #21278 - thchittenden:issue-21033-struct-var-pattern-fix, r=alexcrichton
Closes #21033. The new strategy for parsing a field pattern is to look 1 token ahead and if it's a colon, parse as "fieldname: pat", otherwise parse the shorthand form "(box) (ref) (mut) fieldname)". The previous strategy was to parse "(ref) (mut) fieldname" then if we encounter a colon, throw an error if either "ref" or "mut" were encountered.
2015-01-19 19:40:51 +00:00
Kevin Ballard
c166017445 Fix make check PLEASE_BENCH=1
611ef49f2f removed all the metrics stuff
from tests.mk, but this meant that `PLEASE_BENCH=1` no longer did
anything.

Fixes #21324.
2015-01-19 10:59:57 -08:00
bors
54c9a4655b Auto merge of #20082 - pczarn:btree-bounded-iter, r=Gankro
Part of collections reform v1, #18424
Also, iteration is simplified:
```
before
test btree::map::bench::iter_1000                          ... bench:     17177 ns/iter (+/- 6302)
test btree::map::bench::iter_100000                        ... bench:   1735731 ns/iter (+/- 23908)
test btree::map::bench::iter_20                            ... bench:       386 ns/iter (+/- 148)
after
test btree::map::bench::iter_1000                          ... bench:     15777 ns/iter (+/- 346)
test btree::map::bench::iter_100000                        ... bench:   1602604 ns/iter (+/- 73629)
test btree::map::bench::iter_20                            ... bench:       339 ns/iter (+/- 91)
```
cc @gereeter @cgaebel
r? @Gankro
2015-01-19 17:43:47 +00:00
Steven Fackler
2854f0c75e Fix flaky condvar test 2015-01-19 09:11:06 -08:00
Tom Chittenden
d8372139a7 Fixes #21033 with accompanying test. 2015-01-19 11:58:01 -05:00
Piotr Czarnecki
429c23d5f4 Implement range and range_mut for BTree
Simplify BTree's iterators, too.
2015-01-19 17:48:59 +01:00
Adolfo Ochagavía
b4090aa730 Add test for #21328 2015-01-19 17:29:48 +01:00
bors
cda3490f8f Auto merge of #21269 - alexcrichton:issue-6936, r=pnkfelix
This commit modifies resolve to prevent conflicts with typedef names in the same
method that conflits are prevented with enum names. This is a breaking change
due to the differing semantics in resolve, and any errors generated on behalf of
this change require that a conflicting typedef, module, or structure to be
renamed so they do not conflict.

[breaking-change]
Closes #6936
2015-01-19 15:44:41 +00:00
Adolfo Ochagavía
c3ac929ba9 Add a Drain iterator to VecMap 2015-01-19 15:23:52 +01:00
Oliver 'ker' Schneider
a320149dcc ugly hack to convert BadHashMapKey error to general fmt::Error 2015-01-19 14:22:17 +01:00
Oliver 'ker' Schneider
0478a8c1d7 add unit test for non string/numeric map keys 2015-01-19 14:22:16 +01:00
Oliver 'ker' Schneider
d727f99107 lower FnMut to FnOnce since json-hack is no longer required
Conflicts:
	src/libserialize/serialize.rs
2015-01-19 14:22:16 +01:00
Oliver 'ker' Schneider
f015a3b871 json-encoder: report error when hash map key is not string or numeric 2015-01-19 14:22:15 +01:00
bors
43f2c199e4 Auto merge of #21282 - Aatch:init-memzero, r=alexcrichton
LLVM gets overwhelmed when presented with a zeroinitializer for a large
type. In unoptimised builds, it generates a long sequence of stores to
memory. In optmised builds, it manages to generate a standard memset of
zero values, but takes a long time doing so.

Call out to the `llvm.memset` function to zero out the memory instead.

Fixes #21264
2015-01-19 12:17:07 +00:00
bors
7b87900d72 Auto merge of #20874 - klutzy:windows-dynamic-lib, r=alexcrichton
This is a [breaking-change] since `std::dynamic_lib::dl` is now
private.

When `LoadLibraryW()` fails, original code called `errno()` to get error
code.  However, there was local allocation of `Vec` before
`LoadLibraryW()`, and it drops before `errno()`, and the drop
(deallocation) changed `errno`! Therefore `dynamic_lib::open()` thought
it always succeeded.
This commit fixes the issue.

This commit also sets Windows error mode during `LoadLibrary()` to
prevent "dll load failed" dialog.
2015-01-19 10:19:23 +00:00
Adolfo Ochagavía
2366dee8e9 Make VecMap::into_iter consume the VecMap
This is a breaking change. To fix it you should pass the VecMap by value
instead of by reference.

[breaking-change]
2015-01-19 10:48:01 +01:00
Peter Atashian
b57662aed7 Fix HMODULE
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-01-19 03:43:44 -05:00
bors
135cac8528 Auto merge of #21099 - sanxiyn:opt-return-ty, r=alexcrichton
This avoids having ast::Ty nodes which have no counterpart in the source.
2015-01-19 08:22:58 +00:00
Diggory Blake
a674f852db Ranges implement Clone where possible 2015-01-19 05:43:15 +00:00
Alex Crichton
70f7165cc8 std: Stabilize TypeId and tweak BoxAny
This commit aims to stabilize the `TypeId` abstraction by moving it out of the
`intrinsics` module into the `any` module of the standard library. Specifically,

* `TypeId` is now defined at `std::any::TypeId`
* `TypeId::hash` has been removed in favor of an implementation of `Hash`.

This commit also performs a final pass over the `any` module, confirming the
following:

* `Any::get_type_id` remains unstable as *usage* of the `Any` trait will likely
  never require this, and the `Any` trait does not need to be implemented for
  any other types. As a result, this implementation detail can remain unstable
  until associated statics are implemented.
* `Any::downcast_ref` is now stable
* `Any::downcast_mut` is now stable
* `BoxAny` remains unstable. While a direct impl on `Box<Any>` is allowed today
  it does not allow downcasting of trait objects like `Box<Any + Send>` (those
  returned from `Thread::join`). This is covered by #18737.
* `BoxAny::downcast` is now stable.
2015-01-18 18:29:22 -08:00
Alex Crichton
3121c04043 Fix typedef/module name conflicts in the compiler 2015-01-18 18:26:34 -08:00
Alex Crichton
2549cbec9d rustc_resolve: Do not allow mods to shadow types
This commit modifies resolve to prevent conflicts with typedef names in the same
method that conflits are prevented with enum names. This is a breaking change
due to the differing semantics in resolve, and any errors generated on behalf of
this change require that a conflicting typedef, module, or structure to be
renamed so they do not conflict.

[breaking-change]
Closes #6936
2015-01-18 18:25:55 -08:00
Alex Crichton
46366faf61 rustc_resolve: De-indent by breaking out of match
Helps reduce some rightward drift
2015-01-18 18:25:55 -08:00
bors
bd8a43c668 Auto merge of #21267 - danslapman:master, r=alexcrichton
This patch fixes IP_ADD_MEMBERSHIP problem described here: https://github.com/rust-lang/rust/issues/20381

I've tested on my ProbeR project, everything seems ok.
2015-01-19 01:45:36 +00:00
Tshepang Lekhonkhobe
fccc2cfb30 doc: typo fix 2015-01-19 03:14:36 +02:00
Kevin Yap
21f4483de3 Use 'in' instead of 'find()' in tidy.py
'x in y' is more Pythonic and faster than 'y.find(x) != -1'.
2015-01-18 14:52:59 -08:00
James Miller
25a4adc62f Reduce size of array in test case to 1MB 2015-01-19 09:22:54 +13:00
James Miller
9c5173f8e5 Add test to catch performance regressions 2015-01-19 09:21:23 +13:00
James Miller
0859e5ebb3 Use zero_mem instead of a zerointializer for init intrinsic
LLVM gets overwhelmed when presented with a zeroinitializer for a large
type. In unoptimised builds, it generates a long sequence of stores to
memory. In optmised builds, it manages to generate a standard memset of
zero values, but takes a long time doing so.

Call out to the `llvm.memset` function to zero out the memory instead.
2015-01-19 09:21:23 +13:00
Alex Crichton
440d63b0f5 rustdoc: Improve diagnostics on lockfile failures
cc #19872, this may help give some insight
2015-01-18 10:22:12 -08:00
Kevin Yap
d1b1b62ae8 Ignore NOTEs when Travis runs make tidy
Only print NOTE warnings if the 'TRAVIS' environment variable has not
been set. Addresses #21322.
2015-01-18 09:29:44 -08:00
Corey Richardson
2d30f22014 syntax: allow bare sequences in lhs for follow checking
Closes #21350
2015-01-18 10:19:47 -05:00
klutzy
d053ccb45f std::dynamic_lib: Fix Windows error handling
This is a [breaking-change] since `std::dynamic_lib::dl` is now
private.

When `LoadLibraryW()` fails, original code called `errno()` to get error
code.  However, there was local allocation of `Vec` before
`LoadLibraryW()`, and it drops before `errno()`, and the drop
(deallocation) changed `errno`! Therefore `dynamic_lib::open()` thought
it always succeeded.
This commit fixes the issue.

This commit also sets Windows error mode during `LoadLibrary()` to
prevent "dll load failed" dialog.
2015-01-19 00:12:45 +09:00
Wangshan Lu
e28da7ad44 Fix std::marker.
From std::markers to std::marker.
2015-01-18 22:17:44 +08:00
Seo Sanghyeon
3f0cc8011a Make output type in ast::FnDecl optional 2015-01-18 22:49:19 +09:00
Jay True
ab73d455fe fix formatting 2015-01-18 21:23:22 +08:00
Alfie John
5431727b6e docs: replacing more deprecated integer suffixes 2015-01-18 12:43:12 +00:00
Kim Røen
17ffe51aa3 Remove redundant "Right now"
Having both "Right now" and "at the moment" in the same statement is redundant.
2015-01-18 13:24:13 +01:00
Alfie John
66003c06a1 docs: replace deprecated integer suffixes from examples 2015-01-18 11:49:37 +00:00
bors
dcaeb6aa23 auto merge of #20901 : dgrunwald/rust/update-token-can-begin-expr, r=sanxiyn
* add `Token::AndAnd` (double borrow)
 * add `Token::DotDot` (range notation)
 * remove `Token::Pound` and `Token::At`

This fixes a syntax error when parsing `fn f() -> RangeTo<i32> { return ..1; }`.

Also, remove `fn_expr_lookahead`.
It's from the `fn~` days and seems to no longer be necessary.
2015-01-18 11:28:53 +00:00
bors
30f081e548 auto merge of #21276 : huonw/rust/trait-suggestion-nits, r=nikomatsakis
Follow up to #21008.

r? @nikomatsakis
2015-01-18 09:21:42 +00:00
Michael Neumann
d0eb85dc3f Redo Segmented stack support for DragonFly
It got accidentially reverted in 44440e5.
2015-01-18 08:25:52 +01:00
bors
a833337943 auto merge of #21288 : brson/rust/snaps, r=alexcrichton
This fixes the issues mentioned in https://github.com/rust-lang/rust/pull/21236, as well as the one https://github.com/rust-lang/rust/issues/21230 where `CFG_BOOTSTRAP_KEY` was being set to simply 'N'. It changes the build such that `RUSTC_BOOTSTRAP_KEY` is only exported on -beta and -stable, so that the behavior of the -dev, -nightly, and snapshot compilers is the same everywhere.

Haven't run it completely through 'make check' yet, but the I have verified that the aforementioned issues are fixed.

r? @alexcrichton cc @eddyb
2015-01-18 05:48:56 +00:00
Kang Seonghoon
2c1d1fbdf9 tests: Warn on the trailing backslash in the template. 2015-01-18 13:23:34 +09:00
bors
6da8827482 auto merge of #21330 : JeffBelgum/rust/collections-reform-issue-19986-add-append-and-split-off, r=Gankro
Please review carefully. Contains unsafe and is my first commit to Rust.

Uses ptr::copy_nonoverlapping_memory. Attempts to handle zero-size types correctly.
2015-01-18 03:11:42 +00:00
Jay True
2b6efbf92d fix an error about the static lifetime
The reference should be `x`, not `FOO` itself.
2015-01-18 10:58:55 +08:00