Commit Graph

33502 Commits

Author SHA1 Message Date
Björn Steinbrink
6c18e508f1 Make MIN_ALIGN a const to allow better optimization
With MIN_ALIGN as a static, other crates don't have access to its value
at compile time, because it is an extern global. That means that the
checks against it can't be optimized out, which is rather unfortunate.
So let's make it a constant instead.
2014-10-25 12:33:27 -04:00
Daniel Hofstetter
122199909d Guide: Fix off-by-one error 2014-10-25 16:22:04 +02:00
bors
80e5fe1a56 auto merge of #18176 : jkleint/rust/guide-borrow-wording, r=steveklabnik
Explain the primary disadvantage of garbage collection is runtime
overhead and unpredictable pauses.  Elucidate where the name "race
condition" comes from.  Emphasize that Rust can guarantee your code is
free of race conditions and other memory errors, with no runtime
overhead.

cc @steveklabnik
2014-10-25 09:17:05 +00:00
Julian Orth
d6dc01e797 Deprecate UdpStream 2014-10-25 09:11:47 +02:00
bors
a34b8dec69 auto merge of #18171 : jakub-/rust/match-typeck, r=pcwalton
Rather than doing it top-down, with a known expected type, we will now simply establish the appropriate constraints between the pattern and the expression it destructures.

Closes #8783.
Closes #10200.
2014-10-25 07:07:08 +00:00
Julian Orth
8adfd02368 Make UdpStream block until the next non-empty msg. 2014-10-25 09:06:35 +02:00
Clark Gaebel
87a5f0ddf4 Make the Vec data structure layout match raw::Slice.
Fixes #18302

r? @thestinger
2014-10-24 20:12:53 -07:00
bors
172b59abe5 auto merge of #18080 : veddan/rust/assume, r=thestinger
Adds an `assume` intrinsic that gets translated to llvm.assume. It is
used on a boolean expression and allows the optimizer to assume that
the expression is true.

This implements #18051.
2014-10-25 00:32:07 +00:00
Keegan McAllister
7317ef5c36 Add as_unsafe_cell() for Cell and RefCell
Fixes #18131.
2014-10-24 14:15:50 -07:00
Jakub Bukaj
1484f9cd46 Update tests with the new error messages 2014-10-24 19:43:47 +02:00
Jakub Bukaj
4380e96c04 Overhaul typechecking of patterns
Instead of checking patterns in a top-down fashion with a known
expected type on entry, this changes makes typeck establish
appropriate constraints between a pattern and the expression
it destructures, and lets inference compute the final types
or produce good error messages if it's impossible.
2014-10-24 19:43:47 +02:00
Jakub Bukaj
3e9ce5afb7 Do not accept functions in enum patterns past resolve 2014-10-24 19:43:47 +02:00
bors
a10917a6a9 auto merge of #16388 : Zoxc/rust/stmesg, r=alexcrichton
This installs signal handlers to print out stack overflow messages on Linux. It also ensures the main thread has a guard page.

This will catch stack overflows in external code. It's done in preparation of switching to stack probes (#16012).

I've done some simple tests with overflowing the main thread, native threads and green threads (with and without UV) on x86-64.
This might work on ARM, MIPS and x86-32.

I've been unable to run the test suite on this because of #16305.
2014-10-24 17:32:04 +00:00
gamazeps
b4697f0612 Changes a little the description of take in the guide
Closes #18218
2014-10-24 17:19:09 +02:00
Julian Orth
b3ed61703c ignore-android 2014-10-24 17:19:02 +02:00
Julian Orth
da2152c9ae Improve shootout-reverse-complement 2014-10-24 17:18:10 +02:00
bors
083578ddec auto merge of #17813 : P1start/rust/lint-field-shorthand, r=huonw
Closes #17792.
2014-10-24 15:12:24 +00:00
Niko Matsakis
4a8d712345 Use type-safe wrapper for TypeFlags 2014-10-24 10:20:02 -04:00
John Kåre Alsaker
70cef9474a Print stack overflow messages for Windows, Linux and OS X
Fixes #17562
2014-10-24 14:36:29 +02:00
bors
00cc6d2409 auto merge of #17896 : mahkoh/rust/intmax, r=alexcrichton
Closes #17075

I don't know if this is correct. The easiest way to find out is to run the following program on all targets but I can't do it myself.
```c
#include <stdint.h>
#include <stdio.h>

int main(void)
{
	if (sizeof(intmax_t) != 8) {
		puts("ERROR");
		return 1;
	}
}
```
2014-10-24 03:22:29 +00:00
P1start
ead6c4b9d4 Add a lint for not using field pattern shorthands
Closes #17792.
2014-10-24 15:44:18 +13:00
John Kåre Alsaker
50e86c26e0 Fix sigaction on OS X 2014-10-24 04:28:09 +02:00
bors
c53f8a920e auto merge of #17960 : mahkoh/rust/clone_from_slice, r=pcwalton
Old vs. New vs. Vec::push_all

```
test slice     ... bench:   3091942 ns/iter (+/- 54460)
test slice_new ... bench:   1800065 ns/iter (+/- 69513)
test vec       ... bench:   1804805 ns/iter (+/- 75609)
```
2014-10-24 01:02:21 +00:00
Nick Cameron
e4b913f60f s/vtable2/vtable 2014-10-24 11:25:35 +13:00
Jakub Bukaj
d7e910ec90 Update .mailmap 2014-10-23 23:01:31 +02:00
bors
56d544f7ad auto merge of #17683 : gereeter/rust/ident-to-name, r=pcwalton
This does a large chunk of #6993. It is based on top of #17654.
2014-10-23 20:22:18 +00:00
Markus Siemens
53ac852bf0 Fail immediately if linking returns status code != 0 2014-10-23 19:32:18 +02:00
bors
091b9811c8 auto merge of #18253 : steveklabnik/rust/small_doc_fixes, r=huonw
All these stars aren't needed anymore.
2014-10-23 16:57:24 +00:00
Alex Crichton
398b28722d Register new snapshots
This in theory enables uncommenting IndexMut implementations, but upon doing so
the compiler immediately segfaulted in stage1, so I'll leave those to a later
time.
2014-10-23 09:38:37 -07:00
Robin Gloster
0b8bd6f667 plugin-guide: nicer creation of the parser 2014-10-23 17:21:24 +02:00
Simon Sapin
941d90d97f Add syntax::print::pprint::view_item_to_string
… similar to the existing `item_to_string`.

There may be more missing like this.
2014-10-23 23:56:33 +09:00
areski
fe6847a25b Improved examples on Vec documentation
- shrink_to_fit example is now more clear by asserting the capacity value
2014-10-23 16:45:36 +02:00
Steve Klabnik
4a74af62c6 Improve code in the intro.
All these stars aren't needed anymore.
2014-10-23 09:36:34 -04:00
Steve Klabnik
0c3ad8be5b build the crates guide 2014-10-23 07:40:29 -04:00
bors
37f2db769f auto merge of #18217 : mikedilger/rust/bug_report_instructions, r=pnkfelix
Fixed as per @pnkfelix comments in #17848
2014-10-23 11:37:12 +00:00
Björn Steinbrink
70fe20a698 Fix codegen breaking aliasing rules for functions with sret results
This reverts commit a0ec902e23 "Avoid
unnecessary temporary on assignments".

Leaving out the temporary for the functions return value can lead to a
situation that conflicts with rust's aliasing rules.

Given this:

````rust
fn func(f: &mut Foo) -> Foo { /* ... */ }

fn bar() {
    let mut foo = Foo { /* ... */ };

    foo = func(&mut foo);
}
````

We effectively get two mutable references to the same variable `foo` at
the same time. One for the parameter `f`, and one for the hidden
out-pointer. So we can't just `trans_into` the destination directly, but
must use `trans` to get a new temporary slot from which the result can
be copied.
2014-10-23 11:43:48 +02:00
bors
8a40854660 auto merge of #17868 : nick29581/rust/valgrind, r=alexcrichton
r? @alexcrichton
2014-10-23 05:27:11 +00:00
Nick Cameron
80ff1d1a10 Error if we should be able to Valgrind but can't 2014-10-23 14:28:52 +13:00
Jonathan S
2343e9d354 Part of #6993. Moved a bunch of uses of Ident to Name 2014-10-22 20:23:13 -05:00
Nick Cameron
1285d4f467 Remove support for .rc files from test.mk 2014-10-23 13:52:35 +13:00
Nick Cameron
c562b5bd9d Make rpass-valgrind work with pretty 2014-10-23 13:52:34 +13:00
Nick Cameron
edc5275563 Move some tests to run-pass-valgrind 2014-10-23 13:52:34 +13:00
Nick Cameron
f466e1a59f Add run-pass-valgrind tests
Closes #16914
2014-10-23 13:52:34 +13:00
bors
96991e9335 auto merge of #18224 : nikomatsakis/rust/issue-17594, r=alexcrichton
Add test for issue #17594

Fixes #17594
2014-10-22 23:57:11 +00:00
areski
ebdc3046a4 Fixed single quote around string slice and simplify example
This patch contains a fix for:
- single quote around string slice
- string: String is confusing for newbies and it's more readble if the
  argument name is different that the argument type name
2014-10-23 00:44:17 +02:00
bors
7d7e409839 auto merge of #18092 : michaelwoerister/rust/lldb-test-versioning, r=alexcrichton
Now that there are build bots with a stable enough LLDB version on OSX we can finally let the tests run on every PR!
😹
2014-10-22 21:32:16 +00:00
bors
9f0c29af02 auto merge of #17846 : tomjakubowski/rust/rustdoc-hide-private-traits, r=alexcrichton
Fix #16563
2014-10-22 16:47:14 +00:00
Niko Matsakis
de06faf889 Use local cache when there are unbound type variables and where clauses in scope.
Fixes #18209.
2014-10-22 11:35:53 -04:00
bors
1d647564b1 auto merge of #18230 : cakebaker/rust/adapt_range_value_to_variable_name, r=steveklabnik
The variable name <code>one_to_one_hundred</code> implies that it will contain a collection with the values from 1 to 100, but the collection contains the values from 0 to 99. This patch changes the ranges to produce a collection with the values from 1 to 100.
2014-10-22 14:32:11 +00:00
Daniel Hofstetter
cb5593a448 Guide: Change >= to > in closure 2014-10-22 16:16:05 +02:00