Commit Graph

33198 Commits

Author SHA1 Message Date
bors
cd1fa91d2b auto merge of #17801 : Gankro/rust/collections-stuff, r=sfackler
I previously avoided `#[inline]`ing anything assuming someone would come in and explain to me where this would be appropriate. Apparently no one *really* knows, so I'll just go the opposite way an inline everything assuming someone will come in and yell at me that such-and-such shouldn't be `#[inline]`.

==================

For posterity, iteration comparisons:

```
test btree::map::bench::iter_20                            ... bench:       971 ns/iter (+/- 30)
test btree::map::bench::iter_1000                          ... bench:     29445 ns/iter (+/- 480)
test btree::map::bench::iter_100000                        ... bench:   2929035 ns/iter (+/- 21551)

test treemap::bench::iter_20                               ... bench:       530 ns/iter (+/- 66)
test treemap::bench::iter_1000                             ... bench:     26287 ns/iter (+/- 825)
test treemap::bench::iter_100000                           ... bench:   7650084 ns/iter (+/- 356711)

test trie::bench_map::iter_20                              ... bench:       646 ns/iter (+/- 265)
test trie::bench_map::iter_1000                            ... bench:     43556 ns/iter (+/- 5014)
test trie::bench_map::iter_100000                          ... bench:  12988002 ns/iter (+/- 139676)
```

As you can see `btree` "scales" much better than `treemap`. `triemap` scales quite poorly.

Note that *completely* different results are given if the elements are inserted in order from the range [0, size]. In particular, TrieMap *completely* dominates in the sorted case. This suggests adding benches for both might be worthwhile. However unsorted is *probably* the more "normal" case, so I consider this "good enough" for now.
2014-10-11 18:37:13 +00:00
Jakub Wieczorek
4442e6d890 Remove virtual structs from the reference 2014-10-11 19:42:26 +02:00
Jakub Wieczorek
17da4c761d Remove virtual struct tests 2014-10-11 19:42:26 +02:00
Jakub Wieczorek
403cd40e6a Remove virtual structs from the language 2014-10-11 19:42:26 +02:00
Michael Gehring
151aaaf46b Fix cfg warnings in librustc_back 2014-10-11 18:33:17 +02:00
Michael Gehring
22cc5d5e62 Fix cfg warnings in libcoretest 2014-10-11 18:33:17 +02:00
John Gallagher
16ccdba851 Use explicit case rather than catch-all 2014-10-11 12:03:15 -04:00
bors
4d031d7f86 auto merge of #17940 : pnkfelix/rust/fix-check-stage1-on-clean-dir, r=huonw
compiletest needs to link to native crate, or at least the `rt` library.

(I tried using a dependency on `rustrt` instead, and that did not resolve the problem.  But this does.)

Partially addresses #17883
2014-10-11 15:17:09 +00:00
Michael Gehring
d4ba942b17 Fix cfg warnings in compiletest 2014-10-11 16:10:43 +02:00
Boris Egorov
6e29f86bc8 Remove into_vec method from &[T]
[breaking-change]
Closes #17916
2014-10-11 16:22:43 +07:00
Felix S. Klock II
b63a18f585 compiletest needs to link to native crate, or at least the rt library.
(I tried using a dependency on `rustrt` instead, and that did not
resolve the problem.  But this does.)

Fix #17883
2014-10-11 11:08:15 +02:00
bors
9b98332992 auto merge of #17939 : alexcrichton/rust/snapshots, r=sfackler
Also convert a number of `static mut` to just a plain old `static` and remove
some unsafe blocks.
2014-10-11 09:02:01 +00:00
bors
ba246100ca auto merge of #17928 : steveklabnik/rust/remove_runtime_guide, r=alexcrichton
Now that libgreen is gone, this is all wrong.

Fixes #17923
2014-10-11 07:12:02 +00:00
Alex Crichton
dae48a07f3 Register new snapshots
Also convert a number of `static mut` to just a plain old `static` and remove
some unsafe blocks.
2014-10-10 22:09:49 -07:00
bors
7dd1bf0e02 auto merge of #17936 : TeXitoi/rust/remove-shootout-warnings, r=alexcrichton
Only one warning remain, and I can't find a way to remove it without doing more bound checks:

```
shootout-nbody.rs:105:36: 105:51 warning: use of deprecated item: use iter_mut, #[warn(deprecated)] on by default
shootout-nbody.rs:105             let bi = match b_slice.mut_shift_ref() {
```

using `split_at_mut` may be an option, but it will do more bound checking.

If anyone have an idea, I'll update this PR.
2014-10-11 04:37:04 +00:00
John Gallagher
0d6dafa51f Add while let to the reference
Closes #17687
2014-10-10 20:30:32 -04:00
John Gallagher
b5db97b354 Add tests for while let 2014-10-10 20:30:32 -04:00
John Gallagher
45fd623762 Handle while let desugaring 2014-10-10 20:30:32 -04:00
John Gallagher
660cf18070 Move while let behind while_let feature gate 2014-10-10 20:30:32 -04:00
John Gallagher
b003f10449 Desugar while let into loop { match { ... } } 2014-10-10 20:30:32 -04:00
John Gallagher
0c2c8116a3 Teach libsyntax about while let 2014-10-10 20:30:31 -04:00
Guillaume Pinot
5653b4da17 remove shootout warnings 2014-10-11 01:46:59 +02:00
bors
1add4dedc1 auto merge of #17920 : thestinger/rust/vec, r=aturon
Introduce conversions between `Box<[T]>` and `Vec<T>` and use it to reimplement the `vec![]` macro for efficiency.
2014-10-10 18:47:03 +00:00
Daniel Micay
02d976a7f9 improve the performance of the vec![] macro
Closes #17865
2014-10-10 14:20:12 -04:00
Steve Klabnik
51c5a8eb1b Remove the runtime guide.
Now that libgreen is gone, this is all wrong.

Fixes #17923
2014-10-10 13:30:17 -04:00
Daniel Micay
310f2deb99 implement Box<[T]> <-> Vec<T> conversions 2014-10-10 11:42:30 -04:00
bors
78a7676898 auto merge of #17793 : simias/rust/master, r=huonw
The man page stated that the list of features was space-separated when
it's actually comma-separated.
2014-10-10 14:57:03 +00:00
Daniel Micay
0075c27626 vec: minor cleanup 2014-10-10 06:21:00 -04:00
bors
45797a0765 auto merge of #17037 : kmcallister/rust/no-stack-check, r=thestinger
r? @brson 

Fixes #16980.
2014-10-10 07:52:00 +00:00
Taylor Hutchison
4474eab417 Update README.md
Added 64-bit Windows support to the list of platforms. Support for 64-bit Windows was added in Rust 0.12.0. See  https://mail.mozilla.org/pipermail/rust-dev/2014-October/011267.html for the release notes.
2014-10-09 23:41:30 -05:00
Keegan McAllister
bc3831b730 Disable no-stack-check test on Windows 2014-10-09 21:26:51 -07:00
bors
b74208bc12 auto merge of #17669 : nikomatsakis/rust/multidispatch, r=pcwalton
Implement multidispatch and conditional dispatch. Because we do not attempt to preserve crate concatenation, this is a backwards compatible change. This is not yet fully integrated into method dispatch, so "UFCS"-style wrappers must be used to take advantage of the new features (see the run-pass tests).

cc #17307 (multidispatch)
cc #5527 (trait reform -- conditional dispatch)

Because we no longer preserve crate concatenability, this deviates slightly from what was specified in the RFC. The motivation for this change is described in [this blog post](http://smallcultfollowing.com/babysteps/blog/2014/09/30/multi-and-conditional-dispatch-in-traits/). I will post an amendment to the RFC in due course but do not anticipate great controversy on this point -- particularly as the RFCs more important features (e.g., conditional dispatch) just don't work without the change.
2014-10-10 03:02:02 +00:00
bors
f9fc49c06e auto merge of #17853 : alexcrichton/rust/issue-17718, r=pcwalton
This change is an implementation of [RFC 69][rfc] which adds a third kind of
global to the language, `const`. This global is most similar to what the old
`static` was, and if you're unsure about what to use then you should use a
`const`.

The semantics of these three kinds of globals are:

* A `const` does not represent a memory location, but only a value. Constants
  are translated as rvalues, which means that their values are directly inlined
  at usage location (similar to a #define in C/C++). Constant values are, well,
  constant, and can not be modified. Any "modification" is actually a
  modification to a local value on the stack rather than the actual constant
  itself.

  Almost all values are allowed inside constants, whether they have interior
  mutability or not. There are a few minor restrictions listed in the RFC, but
  they should in general not come up too often.

* A `static` now always represents a memory location (unconditionally). Any
  references to the same `static` are actually a reference to the same memory
  location. Only values whose types ascribe to `Sync` are allowed in a `static`.
  This restriction is in place because many threads may access a `static`
  concurrently. Lifting this restriction (and allowing unsafe access) is a
  future extension not implemented at this time.

* A `static mut` continues to always represent a memory location. All references
  to a `static mut` continue to be `unsafe`.

This is a large breaking change, and many programs will need to be updated
accordingly. A summary of the breaking changes is:

* Statics may no longer be used in patterns. Statics now always represent a
  memory location, which can sometimes be modified. To fix code, repurpose the
  matched-on-`static` to a `const`.

      static FOO: uint = 4;
      match n {
          FOO => { /* ... */ }
          _ => { /* ... */ }
      }

  change this code to:

      const FOO: uint = 4;
      match n {
          FOO => { /* ... */ }
          _ => { /* ... */ }
      }

* Statics may no longer refer to other statics by value. Due to statics being
  able to change at runtime, allowing them to reference one another could
  possibly lead to confusing semantics. If you are in this situation, use a
  constant initializer instead. Note, however, that statics may reference other
  statics by address, however.

* Statics may no longer be used in constant expressions, such as array lengths.
  This is due to the same restrictions as listed above. Use a `const` instead.

[breaking-change]
Closes #17718 

[rfc]: https://github.com/rust-lang/rfcs/pull/246
2014-10-10 00:07:08 +00:00
Alex Crichton
0b517117b3 Test fixes and rebase conflicts 2014-10-09 16:36:07 -07:00
Keegan McAllister
441796831f Add tests for no-stack-check attr and codegen option 2014-10-09 15:01:00 -07:00
Keegan McAllister
d7fff9f15b Add -C no-stack-check
Fixes #16980.
2014-10-09 14:32:23 -07:00
Keegan McAllister
db3bd23467 Rename the no_split_stack attribute to no_stack_check
The old name is misleading as we haven't had segmented stacks in quite some
time. But we still recognize it, with a deprecation warning.
2014-10-09 14:24:36 -07:00
Niko Matsakis
7a07f2a780 Add a few more debug statements 2014-10-09 17:19:53 -04:00
Niko Matsakis
2bb0796ae2 Convert tests to cross-crate, fix a RefCell bug I found in the process. 2014-10-09 17:19:53 -04:00
Niko Matsakis
6340c1a373 Add a model for how conditional trait impls might be used to implement
the Fn-FnMut-FnOnce hierarchy.
2014-10-09 17:19:53 -04:00
Niko Matsakis
389ef6601d Implement multidispatch and conditional dispatch. Because we do not
attempt to preserve crate concatenation, this is a backwards compatible
change.

Conflicts:
	src/librustc/middle/traits/select.rs
2014-10-09 17:19:50 -04:00
bors
8b12fb326b auto merge of #17891 : brson/rust/verbump, r=alexcrichton 2014-10-09 21:12:03 +00:00
bors
79d056f94b auto merge of #17558 : kaseyc/rust/fix_bitvset_union, r=aturon
Updates the other_op function shared by the union/intersect/difference/symmetric_difference -with functions to fix an issue where certain elements would not be present in the result. To fix this, when other op is called, we resize self's nbits to account for any new elements that may be added to the set.

Example:
```rust
	let mut a = BitvSet::new();
	let mut b = BitvSet::new();
	a.insert(0);
	b.insert(5);
	a.union_with(&b);
	println!("{}", a); //Prints "{0}" instead of "{0, 5}"
```
2014-10-09 19:02:06 +00:00
Brian Anderson
5c92a8e054 Use the same html_root_url for all docs 2014-10-09 10:50:13 -07:00
Brian Anderson
afc1b20d8e Bump version to 0.13.0 2014-10-09 10:41:23 -07:00
Brian Anderson
6beddcfd83 Revert "Update html_root_url for 0.12.0 release"
This reverts commit 2288f33230.
2014-10-09 10:34:34 -07:00
bors
eb04229f7a auto merge of #17880 : pcwalton/rust/duplicate-bindings-in-parameter-list, r=alexcrichton
parameter list.

This breaks code like:

    fn f(a: int, a: int) { ... }
    fn g<T,T>(a: T) { ... }

Change this code to not use the same name for a parameter. For example:

    fn f(a: int, b: int) { ... }
    fn g<T,U>(a: T) { ... }

Code like this is *not* affected, since `_` is not an identifier:

    fn f(_: int, _: int) { ... } // OK

Closes #17568.

r? @alexcrichton 
[breaking-change]
2014-10-09 16:57:03 +00:00
Alex Crichton
a3e8f41212 doc: Document constants in the reference 2014-10-09 09:44:52 -07:00
Alex Crichton
d03a4b0046 test: Convert statics to constants
Additionally, add lots of tests for new functionality around statics and
`static mut`.
2014-10-09 09:44:52 -07:00
Alex Crichton
9c09c94347 syntax: Tweak the return value of bytes!()
Instead of returning &'static [u8], an invocation of `bytes!()` now returns
`&'static [u8, ..N]` where `N` is the length of the byte vector. This should
functionally be the same, but there are some cases where an explicit cast may be
needed, so this is a:

[breaking-change]
2014-10-09 09:44:51 -07:00