Commit Graph

31668 Commits

Author SHA1 Message Date
Corey Richardson
01d2efaffe Fix FFI guide 2014-08-21 12:58:42 -04:00
Corey Richardson
21bd17fcc1 Stage #[repr(packed)] in std::rt 2014-08-20 21:02:24 -04:00
Corey Richardson
cf5d28083d libgreen: use FFI-safe types 2014-08-20 21:02:24 -04:00
Corey Richardson
2dc2ac1e6b liblibc: don't use int/uint for intptr_t/uintptr_t
int/uint aren't considered FFI safe, replace them with the actual type they
represent (i64/u64 or i32/u32). This is a breaking change, but at most a cast
to `uint` or `int` needs to be added.

[breaking-change]
2014-08-20 21:02:24 -04:00
Corey Richardson
0cffa32c21 Add detailed note about Substs to ty_enum 2014-08-20 21:02:24 -04:00
Corey Richardson
c630d96166 manual: fix link 2014-08-20 21:02:23 -04:00
Corey Richardson
bc19a77631 Add #[repr(C)] to all the things! 2014-08-20 21:02:23 -04:00
Corey Richardson
6e8ff99958 librustc: handle repr on structs, require it for ffi, unify with packed
As of RFC 18, struct layout is undefined. Opting into a C-compatible struct
layout is now down with #[repr(C)]. For consistency, specifying a packed
layout is now also down with #[repr(packed)]. Both can be specified.

To fix errors caused by this, just add #[repr(C)] to the structs, and change
 #[packed] to #[repr(packed)]

Closes #14309

[breaking-change]
2014-08-20 21:02:23 -04:00
Corey Richardson
54bd9e6323 docs: don't claim struct layout is specified, but mention repr 2014-08-20 19:11:25 -04:00
bors
43f040dac8 auto merge of #16408 : steveklabnik/rust/guide_iterators, r=brson
An introduction to iterators. I kinda like this, but I kinda don't. Hmmm.
2014-08-20 18:15:53 +00:00
bors
e11cb5bba7 auto merge of #16257 : steveklabnik/rust/guide_patterns, r=brson
Fixes #4417.
2014-08-20 16:25:53 +00:00
bors
655600b01b auto merge of #16621 : tshepang/rust/grammar, r=steveklabnik 2014-08-20 13:55:52 +00:00
bors
cb5967e002 auto merge of #16620 : tshepang/rust/tasks, r=steveklabnik 2014-08-20 12:10:58 +00:00
bors
b22e840d43 auto merge of #16618 : nham/rust/strslice_examples, r=alexcrichton
(By chance, the `contains` example was actually what I was trying to write when I discovered #16589)
2014-08-20 10:25:54 +00:00
bors
05df25f13e auto merge of #16615 : pcwalton/rust/unboxed-closures-prelude, r=huonw
Closes #16600.

r? @huonw
2014-08-20 08:00:56 +00:00
bors
b8e9bbf793 auto merge of #16614 : cdwort/rust/pointer-guide-typo, r=steveklabnik
This appears to be a minor typo. This example implies that x is mutable otherwise the compiler would error on the line before the comment implies.

Please let me know if I'm missing something - I'd love to learn what I got wrong!
2014-08-20 06:15:58 +00:00
bors
4be4ea7bb0 auto merge of #16606 : pczarn/rust/inline-asm, r=alexcrichton
It's unfortunate that the read+write operands need special treatment in the AST. A separate vec for all expressions is an alternative, but it doesn't play nicely with trans.

Fixes #14936
2014-08-20 03:25:58 +00:00
bors
4a0272da67 auto merge of #16603 : SiegeLord/rust/nullable, r=alexcrichton
A few reasons:

* `Nullable` is basically unused, save for one argument in the `glob` function in `liblibc`, so this change likely impacts nobody negatively. The constructors are never used, and I don't foresee people using them. The people implementing the glob functionality don't seem to be reaching for this POSIX `glob` function, so it seems unlikely to be used heavily.
* At the same time, the old name, `Some`, needlessly conflicted with the same re-exported name in the prelude, which impacted everybody who use glob imports with `libc`. Changing it to something else would simplify things greatly for those people.
* `NotNull` seemed like the best option (others included `Just`, `Valid`, etc. which all had somewhat different connotations than what this type was going for (even `Some` doesn't quite seem like the opposite of `Null`)). Other options included removing the type completely and adding a special, `glob`-specific type. This latter approach doesn't seem future-proof.

Overall, I feel like this is a mildly positive change.
2014-08-20 01:40:58 +00:00
bors
a6758e344b auto merge of #16584 : luqmana/rust/psfo, r=alexcrichton
Fixes #16574.
2014-08-19 23:56:02 +00:00
Tshepang Lekhonkhobe
17c630a8dd doc: small tasks guide improvements 2014-08-20 01:34:41 +02:00
Tshepang Lekhonkhobe
1f1620eed7 doc: grammar fixes 2014-08-20 01:31:07 +02:00
nham
0821119edd Add examples for some StrSlice methods. 2014-08-19 18:51:58 -04:00
bors
0600a3befa auto merge of #16201 : erickt/rust/json-ints, r=acrichto
This patch allows json to deserialize integers larger than 2^53 without losing precision. It does this by first keeping the integer portion of a number as a `i64`, and only casting it over to a `f64` if we have a decimal or exponent.
2014-08-19 22:10:55 +00:00
Patrick Walton
e0a165ca13 libstd: Add Fn/FnMut/FnOnce to the prelude.
Closes #16600.
2014-08-19 13:57:10 -07:00
Amy Unger
0493fb2cfc Make variable mutable to allow mutable reference 2014-08-19 15:41:12 -05:00
Erick Tryzelaar
9b23287974 Don't fail if an object is keyed with a string and we're expecting a number 2014-08-19 13:35:41 -07:00
Erick Tryzelaar
e95552c5e6 serialize: add json bounds checks, support for u64s, and tests 2014-08-19 13:35:41 -07:00
Luqman Aden
7382554496 Add fix for test on windows. 2014-08-19 13:32:41 -07:00
bors
51b901e160 auto merge of #16241 : P1start/rust/doc-fixes, r=alexcrichton
For crates `alloc`–`collections`. This is mostly just updating a few function/method descriptions to use the indicative style. 

cc #4361; I’ve sort of assumed that the third-person indicative style has been decided on, but I could update this to use the imperative style if that’s preferred, or even update this to remove all function-style-related changes. (I think that standardising on one thing, even if it’s not the ‘best’ option, is still better than having no standard at all.) The indicative style seems to be more common in the Rust standard library at the moment, especially in the newer modules (e.g. `collections::vec`), more popular in the discussion about it, and also more popular amongst other languages (see https://github.com/rust-lang/rust/issues/4361#issuecomment-33470215).
2014-08-19 20:25:49 +00:00
Piotr Czarnecki
4155643428 Fix double evaluation of read+write operands
Stop read+write expressions from expanding into two occurences
in the AST. Add a bool to indicate whether an operand in output
position if read+write or not.

Fixes #14936
2014-08-19 20:39:26 +01:00
bors
3f5d0b5b6c auto merge of #16590 : nham/rust/str_searcher_underflow, r=alexcrichton
This incidentally fixes #16589, because it will cause `MatchIndices` to use `NaiveSearcher` instead of `TwoWaySearcher`, but I'm not sure #16589 should be closed until the underlying problem in `TwoWaySearcher` is found.
2014-08-19 16:35:51 +00:00
Erick Tryzelaar
3019af6c01 serialize: add json::{Integer,Floating} to parse large integers properly
[breaking-change]
2014-08-19 09:34:10 -07:00
bors
c883510479 auto merge of #16588 : thestinger/rust/aslr, r=pcwalton
Closes #16514
2014-08-19 14:50:51 +00:00
bors
ef0d49d78f auto merge of #16585 : steveklabnik/rust/random_remarks, r=pcwalton
Fixes #15954 and #16354.
2014-08-19 13:05:52 +00:00
SiegeLord
f6a679f87d Rename Nullable::Some to Nullable::NotNull 2014-08-19 08:59:50 -04:00
bors
3570095e34 auto merge of #16583 : steveklabnik/rust/gh16569, r=pcwalton
Fixes #16569
2014-08-19 10:20:54 +00:00
bors
9af4e325af auto merge of #16582 : Gankro/rust/bitv, r=alexcrichton
This was bothering me (and some other people). The macro was necessary in a transient step of my development, but I converged on a design where it was unnecessary, but it didn't really click that that had happened.

This fixes it up.
2014-08-19 08:35:55 +00:00
bors
d16a5cd7c4 auto merge of #16364 : tbu-/rust/pr_checkeddiv0, r=alexcrichton 2014-08-19 06:50:55 +00:00
P1start
f2aa88ca06 A few minor documentation fixes 2014-08-19 17:22:18 +12:00
bors
dee8313364 auto merge of #16573 : ruud-v-a/rust/timespec-arithmetic, r=alexcrichton
This implements `Add` and `Sub` for `Timespec`, which enables `Timespec` to be used as a time span. For example:

```rust
let begin = get_time();
// Do some stuff.
let end = get_time();
let delta = end - begin;
println!("Doing stuff took {}.{:09d} seconds.", delta.sec, delta.nsec);
```
This resolves one of the points mentioned in #2153.
2014-08-19 04:56:10 +00:00
nham
3b0084e834 Add a test for the fix of issue 16589 2014-08-19 00:37:34 -04:00
bors
eaf810a219 auto merge of #16345 : EduardoBautista/rust/fix-error-message-in-guide, r=steveklabnik
Just some simple changes to the guide.
2014-08-19 03:11:12 +00:00
bors
ef5ad07272 auto merge of #16580 : steveklabnik/rust/gh1498, r=pcwalton
Fixes #14948
2014-08-19 01:26:14 +00:00
bors
fb4201ff34 auto merge of #16579 : steveklabnik/rust/gh9099, r=pcwalton
Fixes #9099
2014-08-18 22:46:19 +00:00
nham
a4bbb5bab4 Fix underflow bug in core::str::Searcher::new for haystacks of length < 20 2014-08-18 17:51:51 -04:00
Steve Klabnik
c88feffde4 Make comment about small bias in %.
Fixes #16354.
2014-08-18 17:46:18 -04:00
Alexis Beingessner
dcccf824b1 Fixing bitvset is_disjoint, fixes #16587 2014-08-18 17:05:26 -04:00
bors
e8ad6a888e auto merge of #16578 : steveklabnik/rust/gh16239, r=pcwalton
Fies #16239.
2014-08-18 21:01:19 +00:00
Steve Klabnik
f8a9211740 Explain modulo in the guide.
Fixes #15954
2014-08-18 15:38:47 -04:00
Daniel Micay
96f5eba4f5 work around MinGW linker bug for ASLR on Windows
Closes #16514
2014-08-18 15:30:35 -04:00