Commit Graph

23529 Commits

Author SHA1 Message Date
Niko Matsakis
7286e35c6b error_reporting -- explain reborrowed upvar constraints in a hopefully useful way 2014-02-11 16:55:23 -05:00
Niko Matsakis
64c9b5c3ae trans/datum -- move mutable variable into closure 2014-02-11 16:55:23 -05:00
Niko Matsakis
f7e5d8418c ty -- minor refactorings, helper methods 2014-02-11 16:55:22 -05:00
Niko Matsakis
0e005ab848 to_str -- update to contain scope of closure 2014-02-11 16:55:22 -05:00
Niko Matsakis
0f5baad6ee container -- update example to contain scope of closure borrow 2014-02-11 16:55:22 -05:00
Niko Matsakis
6f571a63a6 libglob -- patch closure where const borrow would have helped 2014-02-11 16:55:22 -05:00
Niko Matsakis
96139bf1d6 remove antiquated reflect test rather than bring it up to date 2014-02-11 16:55:22 -05:00
Niko Matsakis
852a49fd9c std -- replaces uses where const borrows would be required 2014-02-11 16:55:10 -05:00
bors
2ab248af38 auto merge of #12183 : SimonSapin/rust/patch-4, r=alexcrichton 2014-02-11 13:51:41 -08:00
Nif Ward
184367093f Includes new add method that uses .clone() for support.
Added new tests for bsearch methods and changed "add" to "insert"

Fixed failure on div_floor.
2014-02-11 15:59:33 -05:00
bors
be3cbcb431 auto merge of #12171 : chromatic/rust/fix_crate_tutorial_typos, r=brson
This commit attempts to clarify a section of the tutorial. It also fixes some typos.
2014-02-11 12:36:51 -08:00
Alex Crichton
314b02b373 Add ignore-cross-compile directive for compiletest
Loadable syntax extensions don't work when cross compiling (see #12102), so the
fourcc tests all need to be ignored. They're valuable tests, so they shouldn't
be outright ignored, so they're now flagged with ignore-cross-compile
2014-02-11 12:23:29 -08:00
bors
4c967e7041 auto merge of #12110 : fhahn/rust/issue-11363-change-xfail, r=alexcrichton
Patch for #11363
2014-02-11 09:37:18 -08:00
Florian Hahn
f62460c1f5 Change xfail directives in compiletests to ignore, closes #11363 2014-02-11 18:23:20 +01:00
Niko Matsakis
d63df5f276 Tweak test name and make it more specific 2014-02-11 11:38:42 -05:00
bors
616e53f038 auto merge of #12181 : sanxiyn/rust/accurate-span-4, r=alexcrichton 2014-02-11 08:22:22 -08:00
JeremyLetang
56ca5f837e remove dead link to rustpkg documentation 2014-02-11 09:43:19 -05:00
Simon Sapin
de6ed9c0ce Fix broken link to the container guide 2014-02-11 14:38:36 +00:00
Seo Sanghyeon
f3b5ec2318 Correct span for self and ExprStruct 2014-02-11 22:49:50 +09:00
bors
9e133d113b auto merge of #12176 : kballard/rust/dep-info-lib-filename, r=alexcrichton
Fixes #12174.
2014-02-11 04:41:39 -08:00
bors
fd4979ad04 auto merge of #12154 : pnkfelix/rust/fsk-factor-bigint-and-rat-out-of-libextra, r=alexcrichton
Removed use of globs present in earlier versions of modules.

Fix tutorial.md to reflect `extra::rational` ==> `num::rational`.
2014-02-11 03:26:42 -08:00
bors
1dc6359a0a auto merge of #12175 : sfackler/rust/phase-use-ignored, r=alexcrichton
It could throw an error but I think it's best to not since `#[phase(..)]` syntax in other places would be silently ignored.

Closes #11806
2014-02-11 02:11:41 -08:00
Felix S. Klock II
d2d1129ad0 Factoring bigint, rational, and complex out of libextra into libnum.
Removed use of globs present in earlier versions of modules.

Fix tutorial.md to reflect `extra::rational` ==> `num::rational`.
2014-02-11 10:39:15 +01:00
bors
86e6a5cf7b auto merge of #12170 : aepsil0n/rust/feature/reserve_do_keyword, r=brson
This resolves issue #12157. Does that do it already or is there something else that needs taking care of?  

As a side note, there seems to be some documentation, in which the old existence of the do keyword is explained. The list of keywords is not up-to-date either. But these are certainly separate issues.
2014-02-11 00:41:44 -08:00
bors
19f64b38f7 auto merge of #12156 : dguenther/rust/add-fourcc-doc, r=alexcrichton
Added a link to `fourcc` docs to the list of libraries
2014-02-10 21:26:48 -08:00
Kevin Ballard
8be1e34544 Output the correct library filename with --dep-info
Fixes #12174.
2014-02-10 21:06:01 -08:00
Steven Fackler
ccd1cda10e Ignore #[phase] on use view items
Closes #11806
2014-02-10 20:10:17 -08:00
bors
8ef25597e6 auto merge of #12155 : sanxiyn/rust/binary, r=pnkfelix
The field is unused.
2014-02-10 19:46:46 -08:00
bors
3870c15749 auto merge of #12173 : alexcrichton/rust/fix-snap, r=brson
The commit accidentally modified the snapshot script which changed its behavior
and is currently blocking a snapshot.
2014-02-10 18:26:49 -08:00
Alex Crichton
c2ae62faee Revert non-license changes as part of 0ebe112b
The commit accidentally modified the snapshot script which changed its behavior
and is currently blocking a snapshot.
2014-02-10 18:00:40 -08:00
bors
47ab5d2d42 auto merge of #12153 : pnkfelix/rust/fsk-add-dash-C-help-pointer, r=sanxiyn
(The fact that this flag has a large collection of suboptions qualifies it for an entry in the "Additional help" section.)
2014-02-10 17:11:48 -08:00
chromatic
c57faa2d8c Revised Crate section of tutorial for clarity. 2014-02-10 16:21:18 -08:00
Eduard Bopp
a2fab457dc Reserve do as a keyword
Resolves issue #12157. `do` is hereby reinstated as a keyword; no syntax is
associated with it though. Along the way, a unit test had to be adapted, since
it was using `do` as a method identifier.

Breaking changes:

- Any code using `do` as an identifier will no longer work.
2014-02-11 00:19:27 +01:00
bors
38ed4674e8 auto merge of #11956 : edwardw/rust/issue-7556, r=cmr
Closes #7556.

Also move ``std::util::Void`` to ``std::any::Void``. It makes more sense to me.
2014-02-10 14:56:47 -08:00
Edward Wang
e9ff91e9be Move replace and swap to std::mem. Get rid of std::util
Also move Void to std::any, move drop to std::mem and reexport in
prelude.
2014-02-11 05:21:35 +08:00
bors
cf9164f94c auto merge of #12095 : FlaPer87/rust/issue-11709, r=nikomatsakis
Closes #11709
2014-02-10 12:56:40 -08:00
Flavio Percoco
31576c7ef0 Switch to Ignore output mode for () blocks
Closes #11709
Closes #11865
2014-02-10 21:20:08 +01:00
bors
838c62bb28 auto merge of #12132 : brunoabinader/rust/list-matches-predicate, r=alexcrichton
This is needed for cases where we only need to know if a list item matches the given predicate (eg. in Servo, we need to know if attributes from different DOM elements are equal).
2014-02-10 10:16:31 -08:00
Derek Guenther
6198ae565c Added link to fourcc docs 2014-02-10 12:12:13 -06:00
bors
4f16e519f1 auto merge of #12150 : jakerr/rust/patch-1, r=pnkfelix
The current comment actually describes *co*-variance.
Fixing this to describe contravariance while keeping 'static in the definition was tricky so just changed to use 'short and 'long.

I found the typo in my attempt to understand the concept of variance itself and the comment confused me. I mention this to point out that I'm new to the concept so may have still got the definition wrong, so please review with care :)
2014-02-10 08:16:35 -08:00
Seo Sanghyeon
d1cbdc6b1b Remove binary field 2014-02-11 01:10:26 +09:00
Felix S. Klock II
06a0c21c91 Add pointer to extended-help entry for -C help codegen options. 2014-02-10 16:54:00 +01:00
bors
d324917596 auto merge of #12149 : thomaslee/rust/ipaddr_deriving_iter_bytes, r=cmr
This is a fairly trivial (but IMHO handy) change to implement IterBytes for IpAddr and SocketAddr.

I originally stumbled across this because I wanted to use a SocketAddr as a HashMap key and discovered that I couldn't do it directly. Had to impl IterBytes on a new intermediate type to work around it.
2014-02-10 06:31:27 -08:00
Bruno de Oliveira Abinader
cb1fad3b28 Implement List's any() function
This is needed for cases where we only need to know if a list item
matches the given predicate (eg. in Servo, we need to know if attributes
from different DOM elements are equal).
2014-02-10 08:36:48 -04:00
Jake Kerr
266b7e0f71 Update comment in contravariant test
The previous definition was actually describing covariance.
Fixing to describe contravariance while keeping 'static in the definition was tricky so just changed to use 'short and 'long.
2014-02-10 20:26:09 +09:00
Tom Lee
e205185095 IterBytes for IpAddr and SocketAddr 2014-02-10 02:21:50 -08:00
bors
d440a569bb auto merge of #12084 : alexcrichton/rust/codegen-opts, r=cmr
Move them all behind a new -C switch. This migrates some -Z flags and some
top-level flags behind this -C codegen option.

The -C flag takes values of the form "-C name=value" where the "=value" is
optional for some flags.

Flags affected:

* --llvm-args           => -C llvm-args
* --passes              => -C passes
* --ar                  => -C ar
* --linker              => -C linker
* --link-args           => -C link-args
* --target-cpu          => -C target-cpu
* --target-feature      => -C target-fature
* --android-cross-path  => -C android-cross-path
* --save-temps          => -C save-temps
* --no-rpath            => -C no-rpath
* -Z no-prepopulate     => -C no-prepopulate-passes
* -Z no-vectorize-loops => -C no-vectorize-loops
* -Z no-vectorize-slp   => -C no-vectorize-slp
* -Z soft-float         => -C soft-float
* -Z gen-crate-map      => -C gen-crate-map
* -Z prefer-dynamic     => -C prefer-dynamic
* -Z no-integrated-as   => -C no-integrated-as

As a bonus, this also promotes the -Z extra-debug-info flag to a first class -g
or --debuginfo flag.

* -Z debug-info         => removed
* -Z extra-debug-info   => -g or --debuginfo

Closes #9770
Closes #12000
2014-02-10 01:26:24 -08:00
Alex Crichton
071ee96277 Consolidate codegen-related compiler flags
Move them all behind a new -C switch. This migrates some -Z flags and some
top-level flags behind this -C codegen option.

The -C flag takes values of the form "-C name=value" where the "=value" is
optional for some flags.

Flags affected:

* --llvm-args           => -C llvm-args
* --passes              => -C passes
* --ar                  => -C ar
* --linker              => -C linker
* --link-args           => -C link-args
* --target-cpu          => -C target-cpu
* --target-feature      => -C target-fature
* --android-cross-path  => -C android-cross-path
* --save-temps          => -C save-temps
* --no-rpath            => -C no-rpath
* -Z no-prepopulate     => -C no-prepopulate-passes
* -Z no-vectorize-loops => -C no-vectorize-loops
* -Z no-vectorize-slp   => -C no-vectorize-slp
* -Z soft-float         => -C soft-float
* -Z gen-crate-map      => -C gen-crate-map
* -Z prefer-dynamic     => -C prefer-dynamic
* -Z no-integrated-as   => -C no-integrated-as

As a bonus, this also promotes the -Z extra-debug-info flag to a first class -g
or --debuginfo flag.

* -Z debug-info         => removed
* -Z extra-debug-info   => -g or --debuginfo

Closes #9770
Closes #12000
2014-02-10 00:50:39 -08:00
bors
f3a87a7f1f auto merge of #12143 : brson/rust/swap, r=alexcrichton
Thinking about swap as an example of unsafe programming. This cleans it up a bit. It also removes type parametrization over `RawPtr` from the memcpy functions to make this compile.
2014-02-09 23:11:25 -08:00
bors
5bad63cef5 auto merge of #12136 : alexcrichton/rust/issue-12123, r=brson
Closes #12123
2014-02-09 21:56:26 -08:00
bors
47e14456f7 auto merge of #12134 : FlaPer87/rust/temporary-conditions, r=nikomatsakis
Closes #12033

IR Before:

```llvm
normal-return:                                    ; preds = %while_body
  %113 = load i64* %i
  %114 = sub i64 %113, 1
  store i64 %114, i64* %i
  br label %while_cond
```

IR After:

```llvm
normal-return:                                    ; preds = %while_cond
  store i8 %11, i8* %0
  %18 = load i8* %0, !range !0
  call void @_ZN9Temporary9glue_drop19he4ee51d3c03b9cf4ajE(%struct.Temporary* %10)
  %19 = bitcast %struct.Temporary* %10 to i8*
  call void @_ZN2rt11global_heap14exchange_free_19h4fabdf24a2250163aj4v0.0E(i8* %19)
  %20 = icmp ne i8 %18, 0
  br i1 %20, label %while_body, label %while_exit
```
2014-02-09 20:41:27 -08:00
bors
d0affa5c8d auto merge of #12131 : brunoabinader/rust/list-find-doc-typo, r=alexcrichton
Replace ```v``` with ```ls```.
2014-02-09 18:46:28 -08:00
chromatic
e30fd3067e Rearranged enum section of tutorial for clarity.
This version starts with the simple case and builds on it.
2014-02-09 16:59:39 -08:00
Brian Anderson
07c5e5d813 std: Clean up the swap function a little 2014-02-09 16:23:39 -08:00
Brian Anderson
1b7733109d std: Stop parameterizing some memcpy functions over RawPtr
It unsafe assumptions that any impl of RawPtr is for actual pointers,
that they can be copied by memcpy. Removing it is easy, so I don't
think it's solving a real problem.
2014-02-09 16:23:10 -08:00
bors
27f9c7951f auto merge of #12124 : brson/rust/intrinsics, r=thestinger
As mentioned https://github.com/mozilla/rust/pull/11956#issuecomment-34561655 I've taken some of the most commonly-used intrinsics and put them in a more logical place, reduced the amount of code looking in `unstable::intrinsics`.

r? @thestinger
2014-02-09 15:01:32 -08:00
bors
7985fbcb4d auto merge of #12120 : gifnksm/rust/buffered-chars, r=alexcrichton
Add `std::io::Chars` iterator and `Buffer#chars()` method
2014-02-09 11:57:26 -08:00
Alex Crichton
882e2c391e Fix the signature of CreateSymbolicLinkW
Closes #12123
2014-02-09 11:54:19 -08:00
Flavio Percoco
b0ef791496 Make if and while conditions temporary
Closes #12033
2014-02-09 19:46:44 +01:00
Bruno de Oliveira Abinader
66c036c293 Fixed a typo in list's find() documentation. 2014-02-09 12:45:54 -04:00
bors
2780d9dd54 auto merge of #12119 : huonw/rust/guide-testing, r=brson
be more precise about what's being benchmarked.

Also, reorganise the layout a bit, to put examples directly in their
sections.
2014-02-09 02:21:22 -08:00
bors
f0e0d9e101 auto merge of #12117 : nikomatsakis/rust/issue-11913-borrow-in-aliasable-loc, r=pcwalton
Repair a rather embarassingly obvious hole that I created as part of #9629. In particular, prevent `&mut` borrows of data in an aliasable location. This used to be prevented through the restrictions mechanism, but in #9629 I modified those rules incorrectly. 

r? @pcwalton

Fixes #11913
2014-02-09 01:06:23 -08:00
Brian Anderson
1c4a2fd61c std: Make mem's doc slightly more accurate 2014-02-09 00:23:04 -08:00
Brian Anderson
073b655187 std: Move byteswap functions to mem 2014-02-09 00:17:41 -08:00
Brian Anderson
c7710cdf45 std: Add move_val_init to mem. Replace direct intrinsic usage 2014-02-09 00:17:41 -08:00
Brian Anderson
d433b80e02 std: Add init and uninit to mem. Replace direct intrinsic usage 2014-02-09 00:17:40 -08:00
bors
49ac48db3f auto merge of #12034 : dguenther/rust/fourcc, r=alexcrichton
I was looking into #9303 and was curious if this would still be valuable. @kballard had already done 99% of the work, so I brought the branch up to date and added a feature gate. Any feedback would be appreciated; I wasn't sure if this should be set up as a syntax extension with `#[macro_registrar]`, and if so, where it should be located.

Original PR is here: #9255

TODO:
* [x] Convert to loadable syntax extension
* [x] Default to big endian
* [x] Add `target` identifier
* [x] Expand to include code points 128-255
2014-02-08 22:31:27 -08:00
gifnksm
3a610e98a2 std::io: Add Chars iterator for Buffer.
Add `std::io::Chars` iterator and `Buffer#chars()` method
2014-02-09 14:46:25 +09:00
Yuri Kunde Schlesner
337e62e4d6 Allow codepoints 128-255 in fourc!!
Codepoints with those values will be interpreted as bytes with their
raw codepoint value. ('\xAB' -> 0xABu8, etc.) Codepoints > 255 remain
forbidden.
2014-02-08 23:40:17 -06:00
Yuri Kunde Schlesner
6381daab77 Default fourcc! to big-endian.
It was decided that a consistent result across platforms would be the
most useful and least surprising. A "target" option has been added to
get the old behaviour of using the target platform's endianess.
2014-02-08 23:40:17 -06:00
Derek Guenther
97078d43b2 Converted fourcc! to loadable syntax extension 2014-02-08 23:40:17 -06:00
Kevin Ballard
c1cc7e5f16 Add new syntax extension fourcc!()
fourcc!() allows you to embed FourCC (or OSType) values that are
evaluated as u32 literals. It takes a 4-byte ASCII string and produces
the u32 resulting in interpreting those 4 bytes as a u32, using either
the platform-native endianness, or explicitly as big or little endian.
2014-02-08 23:40:16 -06:00
bors
58985e168b auto merge of #12106 : qpliu/rust/memreader-fill-eof, r=sfackler
I don't know if anything depends on MemReader::fill returning an empty slice instead of EndOfFile, but I'm pretty sure that MemReader::read_until should not go into an infinite loop.
2014-02-08 21:16:28 -08:00
Huon Wilson
a7719a7347 Expand the testing guide to cover optimizations, benchmarks and how to
be more precise about what's being benchmarked.

Also, reorganise the layout a bit, to put examples directly in their
sections.
2014-02-09 16:16:00 +11:00
bors
b66ec3483b auto merge of #12114 : brson/rust/faqs, r=cmr
These are ancient. I removed a bunch of questions that are less relevant - or completely unrelevant, updated other entries, and removed things that are already better expressed elsewhere.
2014-02-08 20:01:27 -08:00
bors
fddc18ec4b auto merge of #12105 : huonw/rust/bench-black-box, r=alexcrichton
This allows a result to be marked as "used" by passing it to a function
LLVM cannot see inside (unless LTO is enabled).

Closes #8261.
2014-02-08 18:46:27 -08:00
Q.P.Liu
71c88e7f47 Fix infinite loop in BufReader::read_until. 2014-02-08 17:53:27 -08:00
Q.P.Liu
e9c539a488 Fix infinite loop in MemReader::read_until. 2014-02-08 17:42:38 -08:00
Huon Wilson
38447344f1 arena: use the generic bh.iter to stop the benchmarks being DCE'd.
Before:

    test test::bench_nonpod_nonarena  ... bench:        62 ns/iter (+/- 6)
    test test::bench_pod_nonarena     ... bench:         0 ns/iter (+/- 0)

After:

    test test::bench_nonpod_nonarena  ... bench:       158 ns/iter (+/- 11)
    test test::bench_pod_nonarena     ... bench:        48 ns/iter (+/- 2)

The other tests show no change, but are adjusted to use the generic
return value of `.iter` anyway so that this doesn't change in future.
2014-02-09 12:31:45 +11:00
Huon Wilson
b029a18820 extra::test: add an opaque function to assist with accurate
benchmarking.

This allows a result to be marked as "used" by passing it to a function
LLVM cannot see inside. By making `iter` generic and using this
`black_box` on the result benchmarks can get this behaviour simply by
returning their computation.
2014-02-09 12:02:03 +11:00
Niko Matsakis
eb774f69e5 Update deriving to pass around the cx linearly 2014-02-08 19:42:24 -05:00
Niko Matsakis
e9b9067560 Make &mut borrows restrict aliasing
Fixes #11913
2014-02-08 19:41:43 -05:00
Niko Matsakis
3df1eb2c2b Remove unused ConstMutability 2014-02-08 19:41:43 -05:00
bors
cba7ac5e01 auto merge of #12065 : mrshu/rust/error-formating-fix, r=alexcrichton
This pull request tries to fix #12050.

I went after these wrong errors quite aggressively so it might be that I also changed some strings that are not actual errors.

Please point those out and I will update this pull request accordingly.
2014-02-08 13:56:45 -08:00
mr.Shu
ee3fa68fed Fixed error starting with uppercase
Error messages cleaned in librustc/middle

Error messages cleaned in libsyntax

Error messages cleaned in libsyntax more agressively

Error messages cleaned in librustc more aggressively

Fixed affected tests

Fixed other failing tests

Last failing tests fixed
2014-02-08 20:59:38 +01:00
bors
c8759f6b56 auto merge of #12090 : bjz/rust/unimplemented, r=cmr
Adds a standardised placeholder for marking unfinished code.
2014-02-08 11:46:29 -08:00
bors
35518514c4 auto merge of #12109 : omasanori/rust/small-fixes, r=sfackler
Most of them are to reduce warnings in testing builds.
2014-02-08 10:31:33 -08:00
OGINO Masanori
f87e507858 rustpkg has gone.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-09 00:46:31 +09:00
bors
5acc998ed9 auto merge of #12098 : kballard/rust/from_utf8_lossy_tweak, r=huonw
MaybeOwned allows from_utf8_lossy to avoid allocation if there are no
invalid bytes in the input.

Before:
```
test str::bench::from_utf8_lossy_100_ascii                      ... bench:       183 ns/iter (+/- 5)
test str::bench::from_utf8_lossy_100_invalid                    ... bench:       341 ns/iter (+/- 15)
test str::bench::from_utf8_lossy_100_multibyte                  ... bench:       227 ns/iter (+/- 13)
test str::bench::from_utf8_lossy_invalid                        ... bench:       102 ns/iter (+/- 4)
test str::bench::is_utf8_100_ascii                              ... bench:         2 ns/iter (+/- 0)
test str::bench::is_utf8_100_multibyte                          ... bench:         2 ns/iter (+/- 0)
```

Now:
```
test str::bench::from_utf8_lossy_100_ascii                      ... bench:        96 ns/iter (+/- 4)
test str::bench::from_utf8_lossy_100_invalid                    ... bench:       318 ns/iter (+/- 10)
test str::bench::from_utf8_lossy_100_multibyte                  ... bench:       105 ns/iter (+/- 2)
test str::bench::from_utf8_lossy_invalid                        ... bench:       105 ns/iter (+/- 2)
test str::bench::is_utf8_100_ascii                              ... bench:         2 ns/iter (+/- 0)
test str::bench::is_utf8_100_multibyte                          ... bench:         2 ns/iter (+/- 0)
```
2014-02-08 05:01:30 -08:00
bors
548b8cec19 auto merge of #12101 : csherratt/rust/master, r=alexcrichton
CowArc was crated before libsync and the merge request did not contain the required export change.
2014-02-08 03:46:29 -08:00
bors
b60bed9791 auto merge of #12096 : brson/rust/morestack-addr, r=thestinger 2014-02-08 01:56:30 -08:00
Brian Anderson
30dcc8285b doc: Modernize FAQs just slightly 2014-02-08 00:38:00 -08:00
bors
95483e30a2 auto merge of #12086 : huonw/rust/safe-json, r=kballard
The lexer and json were using `transmute(-1): char` as a sentinel value for EOF, which is invalid since `char` is strictly a unicode codepoint.

Fixing this allows for range asserts on chars since they always lie between 0 and 0x10FFFF.
2014-02-08 00:26:30 -08:00
Kevin Ballard
1d17c2129e Rewrite path::Display to reduce unnecessary allocation 2014-02-07 22:31:52 -08:00
Kevin Ballard
086c0dd33f Delete send_str, rewrite clients on top of MaybeOwned<'static>
Declare a `type SendStr = MaybeOwned<'static>` to ease readibility of
types that needed the old SendStr behavior.

Implement all the traits for MaybeOwned that SendStr used to implement.
2014-02-07 22:31:52 -08:00
Kevin Ballard
122c94d2f3 Implement BytesContainer for MaybeOwned 2014-02-07 22:31:51 -08:00
Kevin Ballard
28467f5d19 Tweak from_utf8_lossy to return a new MaybeOwned enum
MaybeOwned allows from_utf8_lossy to avoid allocation if there are no
invalid bytes in the input.
2014-02-07 22:31:51 -08:00
OGINO Masanori
e107121e34 Remove unnecessary parentheses.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-08 15:08:45 +09:00
OGINO Masanori
d4898e72e3 Remove an unused variable in a test of std::c_str.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-08 15:08:44 +09:00
OGINO Masanori
f7eb705248 Fix unused import warnings.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-08 15:08:44 +09:00
OGINO Masanori
dd071eeeb8 Remove redundant Ord implementation for Version.
I've forgot why we keep them, so let me know if you know their reason
for existing.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-08 15:08:44 +09:00
bors
dde2e0b386 auto merge of #12066 : huonw/rust/show2, r=alexcrichton
- Convert the formatting traits to `&self` rather than `_: &Self`
- Rejig `syntax::ext::{format,deriving}` a little in preparation
- Implement `#[deriving(Show)]`
2014-02-07 20:46:30 -08:00
bors
80c6c73647 auto merge of #12059 : thestinger/rust/glue, r=pcwalton
A follow-up from the work I started with 383e3fd13b.
2014-02-07 19:31:31 -08:00
Huon Wilson
b89afe2af7 Update docs and tests for #[deriving(Show)]. 2014-02-08 13:53:21 +11:00
Huon Wilson
6a8b3ae22f Implement #[deriving(Show)]. 2014-02-08 13:53:21 +11:00
Huon Wilson
5d63910f90 syntax: split out the parsing and the formatting part of format_args!(). 2014-02-08 13:53:21 +11:00
Huon Wilson
fa191a5591 syntax: convert deriving to take &mut ExtCtxt. 2014-02-08 13:53:21 +11:00
Huon Wilson
eac673ab0c syntax: remove some dead code. 2014-02-08 13:53:21 +11:00
Huon Wilson
8d1204a4b7 std::fmt: convert the formatting traits to a proper self.
Poly and String have polymorphic `impl`s and so require different method
names.
2014-02-08 13:53:21 +11:00
Colin Sherratt
0640fc3a8c Added missing export of CowArc 2014-02-07 21:47:23 -05:00
Daniel Micay
95d897c579 add a hack to fix debug-info tests under gdb 7.7 2014-02-07 21:22:47 -05:00
Daniel Micay
0c8ba5fe7f rm out-of-date comment from std::unstable::raw 2014-02-07 21:20:43 -05:00
Daniel Micay
eced501226 allow generating drop glue without the TyDesc
Reflection is now the only user of type descriptors. Uses of drop glue
no longer cause a type descriptor to be generated.
2014-02-07 21:20:43 -05:00
Huon Wilson
5e2de79b30 rustc: load bools as unsigned numbers.
Apparently loading them signed will break if/when they become i1.
2014-02-08 12:13:28 +11:00
Huon Wilson
285c25f7f4 rustc: put range asserts on char loads.
A `char` is a Unicode codepoint, and so ranges from 0--0x10FFFF (with
the surrogate gaps): we may as well inform LLVM of this.
2014-02-08 12:13:28 +11:00
Huon Wilson
1dd1880121 syntax: convert the lexer to use Option<char> over transmute(-1).
The transmute was unsound.

There are many instances of .unwrap_or('\x00') for "ignoring" EOF which
either do not make the situation worse than it was (well, actually make
it better, since it's easy to grep for places that don't handle EOF) or
can never ever be read.

Fixes #8971.
2014-02-08 12:13:27 +11:00
Huon Wilson
e7908c0a66 extra::json: remove the use of unsafe char transmutes.
Avoid using -1 as a char sentinel, when Option<char> is the perfect
thing.
2014-02-08 12:13:27 +11:00
Daniel Micay
940d1ae2f3 remove type descriptors from proc and @T
This also drops support for the managed pointer POISON_ON_FREE feature
as it's not worth adding back the support for it. After a snapshot, the
leftovers can be removed.
2014-02-07 20:08:35 -05:00
bors
29e500db8a auto merge of #12094 : adridu59/rust/licensing, r=brson
Closes #12069.

cc @brson
2014-02-07 16:16:35 -08:00
bors
1fd2d77860 auto merge of #12029 : zkamsler/rust/merge-sort-allocations, r=huonw
This pull request:
1) Changes the initial insertion sort to be in-place, and defers allocation of working set until merge is needed.
2) Increases the increases the maximum run length to use insertion sort for from 8 to 32 elements. This increases the size of vectors that will not allocate, and reduces the number of merge passes by two. It seemed to be the sweet spot in the benchmarks that I ran.

Here are the results of some benchmarks. Note that they are sorting u64s, so types that are more expensive to compare or copy may have different behaviors.
Before changes:
```
test vec::bench::sort_random_large      bench:    719753 ns/iter (+/- 130173) = 111 MB/s
test vec::bench::sort_random_medium     bench:      4726 ns/iter (+/- 742) = 169 MB/s
test vec::bench::sort_random_small      bench:       344 ns/iter (+/- 76) = 116 MB/s
test vec::bench::sort_sorted            bench:    437244 ns/iter (+/- 70043) = 182 MB/s
```

Deferred allocation (8 element insertion sort):
```
test vec::bench::sort_random_large      bench:    702630 ns/iter (+/- 88158) = 113 MB/s
test vec::bench::sort_random_medium     bench:      4529 ns/iter (+/- 497) = 176 MB/s
test vec::bench::sort_random_small      bench:       185 ns/iter (+/- 49) = 216 MB/s
test vec::bench::sort_sorted            bench:    425853 ns/iter (+/- 60907) = 187 MB/s
```

Deferred allocation (16 element insertion sort):
```
test vec::bench::sort_random_large      bench:    692783 ns/iter (+/- 165837) = 115 MB/s
test vec::bench::sort_random_medium     bench:      4434 ns/iter (+/- 722) = 180 MB/s
test vec::bench::sort_random_small      bench:       187 ns/iter (+/- 38) = 213 MB/s
test vec::bench::sort_sorted            bench:    393783 ns/iter (+/- 85548) = 203 MB/s
```

Deferred allocation (32 element insertion sort):
```
test vec::bench::sort_random_large      bench:    682556 ns/iter (+/- 131008) = 117 MB/s
test vec::bench::sort_random_medium     bench:      4370 ns/iter (+/- 1369) = 183 MB/s
test vec::bench::sort_random_small      bench:       179 ns/iter (+/- 32) = 223 MB/s
test vec::bench::sort_sorted            bench:    358353 ns/iter (+/- 65423) = 223 MB/s
```

Deferred allocation (64 element insertion sort):
```
test vec::bench::sort_random_large      bench:    712040 ns/iter (+/- 132454) = 112 MB/s
test vec::bench::sort_random_medium     bench:      4425 ns/iter (+/- 784) = 180 MB/s
test vec::bench::sort_random_small      bench:       179 ns/iter (+/- 81) = 223 MB/s
test vec::bench::sort_sorted            bench:    317812 ns/iter (+/- 62675) = 251 MB/s
```

This is the best I could manage with the basic merge sort while keeping the invariant that the original vector must contain each element exactly once when the comparison function is called. If one is not married to a stable sort, an in-place n*log(n) sorting algorithm may have better performance in some cases.

for #12011
cc @huonw
2014-02-07 14:21:30 -08:00
Zach Kamsler
cebe5e8e6b Reduced allocations in merge_sort for short vectors
Added a seperate in-place insertion sort for short vectors.
Increased threshold for insertion short for 8 to 32 elements
for small types and 16 for larger types. Added benchmarks
for sorting larger types.
2014-02-07 17:11:28 -05:00
Brian Anderson
b91caac729 rustc: Remove 'morestack_addr' intrinsic. Unused 2014-02-07 13:21:35 -08:00
bors
7d7a060f8d auto merge of #12073 : alexcrichton/rust/doc-examples, r=cmr
"How do I start in libX" is a common question that I've seen, so I figured
putting the examples in as many places as possible is probably a good idea.
2014-02-07 12:41:35 -08:00
Adrien Tétar
ec2f047aa9 doc: add license information for gen. files 2014-02-07 20:50:15 +01:00
bors
56565eb129 auto merge of #12055 : dguenther/rust/tidy_test, r=alexcrichton
This PR extends the tidy formatting check to rust files in the test folder. To facilitate this, a few flags were added to tidy:

* `xfail-tidy-cr` - Disables the check for CR characters for all following lines in the file
* `xfail-tidy-tab` - Disables the check for tab characters for all following lines in the file
* `xfail-tidy-linelength` - Disables the line length check for all following lines in the file

Checks should not have to be disabled often. I disabled line length checks in `debug-info` tests that use `debugger:` checks, but aside from that, there were relatively few exclusions. Running tidy on all the tests does slow down the formatting check, so it may be worth investigating further optimization.

cc #4534
2014-02-07 11:26:29 -08:00
Derek Guenther
730bdb6403 Added tests to make tidy 2014-02-07 12:49:24 -06:00
Brendan Zabarauskas
8192f5508a Clean up formatting in macros module 2014-02-08 05:39:50 +11:00
chromatic
b91b6a746b Cleaned up imports per coding standards.
No functional changes; just style.
2014-02-07 09:59:19 -08:00
chromatic
813886b22c Removed prelude::* from libstd files.
This replaces the imports from the prelude with the re-exported symbols.
2014-02-07 09:59:19 -08:00
Brendan Zabarauskas
1e55cae783 Add missing test for unreachable! macro 2014-02-08 04:43:51 +11:00
Brendan Zabarauskas
7e1cfc8893 Add unimplemented! macro 2014-02-08 04:43:39 +11:00
bors
c3ccaacc6c auto merge of #12087 : sanxiyn/rust/show-span, r=huonw 2014-02-07 03:26:34 -08:00
Seo Sanghyeon
e5463b996c Add comments to span debugger 2014-02-07 20:13:07 +09:00
Seo Sanghyeon
5109d1adce Correct span for ExprFnBlock, ExprMethodCall, ExprParen 2014-02-07 19:52:12 +09:00
Seo Sanghyeon
104002be6f Span debugger 2014-02-07 19:50:07 +09:00
bors
14cb4be6e9 auto merge of #12083 : bjz/rust/semver, r=huonw 2014-02-07 02:11:30 -08:00
bors
36f1b38f80 auto merge of #12062 : kballard/rust/from_utf8_lossy, r=huonw
`from_utf8_lossy()` takes a byte vector and produces a `~str`, converting
any invalid UTF-8 sequence into the U+FFFD REPLACEMENT CHARACTER.

The replacement follows the guidelines in §5.22 Best Practice for U+FFFD
Substitution from the Unicode Standard (Version 6.2)[1], which also
matches the WHATWG rules for utf-8 decoding[2].

[1]: http://www.unicode.org/versions/Unicode6.2.0/ch05.pdf
[2]: http://encoding.spec.whatwg.org/#utf-8

Closes #9516.
2014-02-07 00:56:31 -08:00
bors
21b856d2dc auto merge of #12010 : HeroesGrave/rust/libcollection, r=alexcrichton
Part of #8784

Changes:
- Everything labeled under collections in libextra has been moved into a new crate 'libcollection'.
- Renamed container.rs to deque.rs, since it was no longer 'container traits for extra', just a deque trait.
- Crates that depend on the collections have been updated and dependencies sorted.
- I think I changed all the imports in the tests to make sure it works. I'm not entirely sure, as near the end of the tests there was yet another `use` that I forgot to change, and when I went to try again, it started rebuilding everything, which I don't currently have time for. 

There will probably be incompatibility between this and the other pull requests that are splitting up libextra. I'm happy to rebase once those have been merged.

The tests I didn't get to run should pass. But I can redo them another time if they don't.
2014-02-06 23:46:35 -08:00
Kevin Ballard
544cb42d7a Hoist path::Display on top of from_utf8_lossy() 2014-02-06 23:44:26 -08:00
Kevin Ballard
b0b89a57d5 Add new function str::from_utf8_lossy()
from_utf8_lossy() takes a byte vector and produces a ~str, converting
any invalid UTF-8 sequence into the U+FFFD REPLACEMENT CHARACTER.

The replacement follows the guidelines in §5.22 Best Practice for U+FFFD
Substitution from the Unicode Standard (Version 6.2)[1], which also
matches the WHATWG rules for utf-8 decoding[2].

[1]: http://www.unicode.org/versions/Unicode6.2.0/ch05.pdf
[2]: http://encoding.spec.whatwg.org/#utf-8
2014-02-06 23:44:26 -08:00
Brendan Zabarauskas
aa829c2904 Implement std::fmt::Show for semver::{Identifier, Version} 2014-02-07 18:03:06 +11:00
HeroesGrave
d81bb441da moved collections from libextra into libcollections 2014-02-07 19:49:26 +13:00
bors
55f53f553a auto merge of #12078 : colemickens/rust/patch-2, r=alexcrichton 2014-02-06 22:31:33 -08:00
Brendan Zabarauskas
78cb1e2ab0 Make semver::Version fields public 2014-02-07 17:19:21 +11:00
bors
396ef9352e auto merge of #12077 : colemickens/rust/patch-1, r=alexcrichton 2014-02-06 21:11:34 -08:00
bors
87fe3ccf09 auto merge of #12039 : alexcrichton/rust/no-conditions, r=brson
This has been a long time coming. Conditions in rust were initially envisioned
as being a good alternative to error code return pattern. The idea is that all
errors are fatal-by-default, and you can opt-in to handling the error by
registering an error handler.

While sounding nice, conditions ended up having some unforseen shortcomings:

* Actually handling an error has some very awkward syntax:

        let mut result = None;                                        
        let mut answer = None;                                        
        io::io_error::cond.trap(|e| { result = Some(e) }).inside(|| { 
            answer = Some(some_io_operation());                       
        });                                                           
        match result {                                                
            Some(err) => { /* hit an I/O error */ }                   
            None => {                                                 
                let answer = answer.unwrap();                         
                /* deal with the result of I/O */                     
            }                                                         
        }                                                             

  This pattern can certainly use functions like io::result, but at its core
  actually handling conditions is fairly difficult

* The "zero value" of a function is often confusing. One of the main ideas
  behind using conditions was to change the signature of I/O functions. Instead
  of read_be_u32() returning a result, it returned a u32. Errors were notified
  via a condition, and if you caught the condition you understood that the "zero
  value" returned is actually a garbage value. These zero values are often
  difficult to understand, however.

  One case of this is the read_bytes() function. The function takes an integer
  length of the amount of bytes to read, and returns an array of that size. The
  array may actually be shorter, however, if an error occurred.

  Another case is fs::stat(). The theoretical "zero value" is a blank stat
  struct, but it's a little awkward to create and return a zero'd out stat
  struct on a call to stat().

  In general, the return value of functions that can raise error are much more
  natural when using a Result as opposed to an always-usable zero-value.

* Conditions impose a necessary runtime requirement on *all* I/O. In theory I/O
  is as simple as calling read() and write(), but using conditions imposed the
  restriction that a rust local task was required if you wanted to catch errors
  with I/O. While certainly an surmountable difficulty, this was always a bit of
  a thorn in the side of conditions.

* Functions raising conditions are not always clear that they are raising
  conditions. This suffers a similar problem to exceptions where you don't
  actually know whether a function raises a condition or not. The documentation
  likely explains, but if someone retroactively adds a condition to a function
  there's nothing forcing upstream users to acknowledge a new point of task
  failure.

* Libaries using I/O are not guaranteed to correctly raise on conditions when an
  error occurs. In developing various I/O libraries, it's much easier to just
  return `None` from a read rather than raising an error. The silent contract of
  "don't raise on EOF" was a little difficult to understand and threw a wrench
  into the answer of the question "when do I raise a condition?"

Many of these difficulties can be overcome through documentation, examples, and
general practice. In the end, all of these difficulties added together ended up
being too overwhelming and improving various aspects didn't end up helping that
much.

A result-based I/O error handling strategy also has shortcomings, but the
cognitive burden is much smaller. The tooling necessary to make this strategy as
usable as conditions were is much smaller than the tooling necessary for
conditions.

Perhaps conditions may manifest themselves as a future entity, but for now
we're going to remove them from the standard library.

Closes #9795
Closes #8968
2014-02-06 17:11:33 -08:00
Alex Crichton
1508b6e953 Add some doc examples to lib{green,native}
"How do I start in libX" is a common question that I've seen, so I figured
putting the examples in as many places as possible is probably a good idea.
2014-02-06 16:45:22 -08:00
Cole Mickens
ee608cb935 Update link_name=... -> link(name=... 2014-02-06 15:54:25 -08:00
Alex Crichton
454882dcb7 Remove std::condition
This has been a long time coming. Conditions in rust were initially envisioned
as being a good alternative to error code return pattern. The idea is that all
errors are fatal-by-default, and you can opt-in to handling the error by
registering an error handler.

While sounding nice, conditions ended up having some unforseen shortcomings:

* Actually handling an error has some very awkward syntax:

    let mut result = None;
    let mut answer = None;
    io::io_error::cond.trap(|e| { result = Some(e) }).inside(|| {
        answer = Some(some_io_operation());
    });
    match result {
        Some(err) => { /* hit an I/O error */ }
        None => {
            let answer = answer.unwrap();
            /* deal with the result of I/O */
        }
    }

  This pattern can certainly use functions like io::result, but at its core
  actually handling conditions is fairly difficult

* The "zero value" of a function is often confusing. One of the main ideas
  behind using conditions was to change the signature of I/O functions. Instead
  of read_be_u32() returning a result, it returned a u32. Errors were notified
  via a condition, and if you caught the condition you understood that the "zero
  value" returned is actually a garbage value. These zero values are often
  difficult to understand, however.

  One case of this is the read_bytes() function. The function takes an integer
  length of the amount of bytes to read, and returns an array of that size. The
  array may actually be shorter, however, if an error occurred.

  Another case is fs::stat(). The theoretical "zero value" is a blank stat
  struct, but it's a little awkward to create and return a zero'd out stat
  struct on a call to stat().

  In general, the return value of functions that can raise error are much more
  natural when using a Result as opposed to an always-usable zero-value.

* Conditions impose a necessary runtime requirement on *all* I/O. In theory I/O
  is as simple as calling read() and write(), but using conditions imposed the
  restriction that a rust local task was required if you wanted to catch errors
  with I/O. While certainly an surmountable difficulty, this was always a bit of
  a thorn in the side of conditions.

* Functions raising conditions are not always clear that they are raising
  conditions. This suffers a similar problem to exceptions where you don't
  actually know whether a function raises a condition or not. The documentation
  likely explains, but if someone retroactively adds a condition to a function
  there's nothing forcing upstream users to acknowledge a new point of task
  failure.

* Libaries using I/O are not guaranteed to correctly raise on conditions when an
  error occurs. In developing various I/O libraries, it's much easier to just
  return `None` from a read rather than raising an error. The silent contract of
  "don't raise on EOF" was a little difficult to understand and threw a wrench
  into the answer of the question "when do I raise a condition?"

Many of these difficulties can be overcome through documentation, examples, and
general practice. In the end, all of these difficulties added together ended up
being too overwhelming and improving various aspects didn't end up helping that
much.

A result-based I/O error handling strategy also has shortcomings, but the
cognitive burden is much smaller. The tooling necessary to make this strategy as
usable as conditions were is much smaller than the tooling necessary for
conditions.

Perhaps conditions may manifest themselves as a future entity, but for now
we're going to remove them from the standard library.

Closes #9795
Closes #8968
2014-02-06 15:48:56 -08:00
Cole Mickens
4352a8d604 Fix a dead URL 2014-02-06 15:48:15 -08:00
Eduard Burtescu
b2d30b72bf Removed @self and @Trait. 2014-02-07 00:38:33 +02:00
bors
c13a929d58 auto merge of #12020 : alexcrichton/rust/output-flags, r=brson
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:

* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]

The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.

The new logic for files that rustc emits is as follows:

1. Output types are dictated by the --emit flag. The default value is
   --emit=link, and this option can be passed multiple times and have all options
   stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
   attribute. The flags can be passed many times and stack with the crate
   attribute.
3. If the -o flag is specified, and only one output type is specified, the
   output will be emitted at this location. If more than one output type is
   specified, then the filename of -o is ignored, and all output goes in the
   directory that -o specifies. The -o option always ignores the --out-dir
   option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the directory of
   the crate file.
6. When multiple output types are specified, the filestem of all output is the
   same as the name of the CrateId (derived from a crate attribute or from the
   filestem of the crate file).

Closes #7791
Closes #11056
Closes #11667
2014-02-06 12:41:30 -08:00
bors
680925e258 auto merge of #12007 : Arcterus/rust/libgetopts, r=cmr
Should help towards finishing #8784.
2014-02-06 11:16:33 -08:00
Alex Crichton
6e7968b10a Redesign output flags for rustc
This commit removes the -c, --emit-llvm, -s, --rlib, --dylib, --staticlib,
--lib, and --bin flags from rustc, adding the following flags:

* --emit=[asm,ir,bc,obj,link]
* --crate-type=[dylib,rlib,staticlib,bin,lib]

The -o option has also been redefined to be used for *all* flavors of outputs.
This means that we no longer ignore it for libraries. The --out-dir remains the
same as before.

The new logic for files that rustc emits is as follows:

1. Output types are dictated by the --emit flag. The default value is
   --emit=link, and this option can be passed multiple times and have all
   options stacked on one another.
2. Crate types are dictated by the --crate-type flag and the #[crate_type]
   attribute. The flags can be passed many times and stack with the crate
   attribute.
3. If the -o flag is specified, and only one output type is specified, the
   output will be emitted at this location. If more than one output type is
   specified, then the filename of -o is ignored, and all output goes in the
   directory that -o specifies. The -o option always ignores the --out-dir
   option.
4. If the --out-dir flag is specified, all output goes in this directory.
5. If -o and --out-dir are both not present, all output goes in the current
   directory of the process.
6. When multiple output types are specified, the filestem of all output is the
   same as the name of the CrateId (derived from a crate attribute or from the
   filestem of the crate file).

Closes #7791
Closes #11056
Closes #11667
2014-02-06 11:14:13 -08:00
Arcterus
968ce53dff getopts: fixed a failing test 2014-02-06 10:04:26 -08:00
Arcterus
2ce7019b87 getopts: unify tests 2014-02-06 10:04:26 -08:00
Arcterus
c09ca940e5 getopts: replaced base functions with those from group 2014-02-06 10:04:26 -08:00
Arcterus
9752c63035 Move getopts out of extra 2014-02-06 10:00:17 -08:00
bors
66b9c35654 auto merge of #12053 : fhahn/rust/remove-str-in-comment, r=alexcrichton
This tiny pull request updates a comment referring to `@str` which was replaced by `(InternedString,StrStyle)` .

related to #10516
2014-02-06 09:21:31 -08:00
bors
f039d10cf7 auto merge of #12048 : sanxiyn/rust/crate-config, r=alexcrichton 2014-02-06 08:06:33 -08:00
Seo Sanghyeon
5719ff73bf Fix expansion tests 2014-02-07 00:28:50 +09:00
bors
27dcd873cb auto merge of #12051 : luqmana/rust/arm-fix, r=alexcrichton
Fix building for arm/Linux.
2014-02-06 06:06:35 -08:00
bors
9a9a70b3fd auto merge of #12047 : huonw/rust/cyclic-rc, r=thestinger
A weak pointer inside itself will have its destructor run when the last
strong pointer to that data disappears, so we need to make sure that the
Weak and Rc destructors don't duplicate work (i.e. freeing).

By making the Rcs effectively take a weak pointer, we ensure that no
Weak destructor will free the pointer while still ensuring that Weak
pointers can't be upgraded to strong ones as the destructors run.

This approach of starting weak at 1 is what libstdc++ does.

Fixes #12046.
2014-02-06 03:11:39 -08:00
bors
d8c4e78603 auto merge of #12001 : yuriks/rust/getopts-tweaks, r=brson
This complements `usage` by auto-generating a short one-liner summary
of the options.

(First timer here, be gentle... :)
2014-02-06 00:01:34 -08:00
bors
8dc06802b2 auto merge of #12054 : alexcrichton/rust/less-flaky-udp, r=brson
I have a hunch this just deadlocked the windows bots. Due to UDP being a lossy
protocol, I don't think we can guarantee that the server can receive both
packets, so just listen for one of them.
2014-02-05 22:46:33 -08:00
Alex Crichton
7b81cc09c1 Make a double-write UDP test more robust
I have a hunch this just deadlocked the windows bots. Due to UDP being a lossy
protocol, I don't think we can guarantee that the server can receive both
packets, so just listen for one of them.
2014-02-05 18:47:49 -08:00
bors
9a672f98e5 auto merge of #11989 : adridu59/rust/tidy, r=alexcrichton
Closes #11985
Closes #4533

@huonw, @alexcrichton
2014-02-05 18:31:36 -08:00
Florian Hahn
5d6bed8c88 Remove reference to @str in comment 2014-02-06 01:04:41 +01:00
Luqman Aden
f286859c1e libstd: Add missing constants for arm/linux. 2014-02-05 18:38:17 -05:00
Huon Wilson
da45340ab8 Ensure an Rc isn't freed while running its own destructor.
A weak pointer inside itself will have its destructor run when the last
strong pointer to that data disappears, so we need to make sure that the
Weak and Rc destructors don't duplicate work (i.e. freeing).

By making the Rcs effectively take a weak pointer, we ensure that no
Weak destructor will free the pointer while still ensuring that Weak
pointers can't be upgraded to strong ones as the destructors run.

This approach of starting weak at 1 is what libstdc++ does.

Fixes #12046.
2014-02-06 09:05:59 +11:00
bors
6aad3bf944 auto merge of #11894 : alexcrichton/rust/io-clone, r=brson
This is part of the overall strategy I would like to take when approaching
issue #11165. The only two I/O objects that reasonably want to be "split" are
the network stream objects. Everything else can be "split" by just creating
another version.

The initial idea I had was the literally split the object into a reader and a
writer half, but that would just introduce lots of clutter with extra interfaces
that were a little unnnecssary, or it would return a ~Reader and a ~Writer which
means you couldn't access things like the remote peer name or local socket name.

The solution I found to be nicer was to just clone the stream itself. The clone
is just a clone of the handle, nothing fancy going on at the kernel level.
Conceptually I found this very easy to wrap my head around (everything else
supports clone()), and it solved the "split" problem at the same time.

The cloning support is pretty specific per platform/lib combination:

* native/win32 - uses some specific WSA apis to clone the SOCKET handle
* native/unix - uses dup() to get another file descriptor
* green/all - This is where things get interesting. When we support full clones
              of a handle, this implies that we're allowing simultaneous writes
              and reads to happen. It turns out that libuv doesn't support two
              simultaneous reads or writes of the same object. It does support
              *one* read and *one* write at the same time, however. Some extra
              infrastructure was added to just block concurrent writers/readers
              until the previous read/write operation was completed.

I've added tests to the tcp/unix modules to make sure that this functionality is
supported everywhere.
2014-02-05 12:56:34 -08:00
Alex Crichton
56080c4767 Implement clone() for TCP/UDP/Unix sockets
This is part of the overall strategy I would like to take when approaching
issue #11165. The only two I/O objects that reasonably want to be "split" are
the network stream objects. Everything else can be "split" by just creating
another version.

The initial idea I had was the literally split the object into a reader and a
writer half, but that would just introduce lots of clutter with extra interfaces
that were a little unnnecssary, or it would return a ~Reader and a ~Writer which
means you couldn't access things like the remote peer name or local socket name.

The solution I found to be nicer was to just clone the stream itself. The clone
is just a clone of the handle, nothing fancy going on at the kernel level.
Conceptually I found this very easy to wrap my head around (everything else
supports clone()), and it solved the "split" problem at the same time.

The cloning support is pretty specific per platform/lib combination:

* native/win32 - uses some specific WSA apis to clone the SOCKET handle
* native/unix - uses dup() to get another file descriptor
* green/all - This is where things get interesting. When we support full clones
              of a handle, this implies that we're allowing simultaneous writes
              and reads to happen. It turns out that libuv doesn't support two
              simultaneous reads or writes of the same object. It does support
              *one* read and *one* write at the same time, however. Some extra
              infrastructure was added to just block concurrent writers/readers
              until the previous read/write operation was completed.

I've added tests to the tcp/unix modules to make sure that this functionality is
supported everywhere.
2014-02-05 11:43:49 -08:00
Adrien Tétar
611c7a6fa5 rustdoc: update deps 2014-02-05 19:54:01 +01:00
Adrien Tétar
0ebe112b3b etc: add missing license boilerplates 2014-02-05 19:53:53 +01:00
Adrien Tétar
fc1d655ed2 etc/tidy: don't check SNAP against triple 2014-02-05 19:53:46 +01:00
Jeff Olson
b8852e89ce pull extra::{serialize, ebml} into a separate libserialize crate
- `extra::json` didn't make the cut, because of `extra::json` required
   dep on `extra::TreeMap`. If/when `extra::TreeMap` moves out of `extra`,
   then `extra::json` could move into `serialize`
- `libextra`, `libsyntax` and `librustc` depend on the newly created
  `libserialize`
- The extensions to various `extra` types like `DList`, `RingBuf`, `TreeMap`
  and `TreeSet` for `Encodable`/`Decodable` were moved into the respective
  modules in `extra`
- There is some trickery, evident in `src/libextra/lib.rs` where a stub
  of `extra::serialize` is set up (in `src/libextra/serialize.rs`) for
  use in the stage0 build, where the snapshot rustc is still making
  deriving for `Encodable` and `Decodable` point at extra. Big props to
  @huonw for help working out the re-export solution for this

extra: inline extra::serialize stub

fix stuff clobbered in rebase + don't reexport serialize::serialize

no more globs in libserialize

syntax: fix import of libserialize traits

librustc: fix bad imports in encoder/decoder

add serialize dep to librustdoc

fix failing run-pass tests w/ serialize dep

adjust uuid dep

more rebase de-clobbering for libserialize

fixing tests, pushing libextra dep into cfg(test)

fix doc code in extra::json

adjust index.md links to serialize and uuid library
2014-02-05 10:38:22 -08:00
Seo Sanghyeon
b653fa0c4a Avoid cloning ast::CrateConfig 2014-02-06 02:26:00 +09:00
bors
2bf575c86f auto merge of #11939 : JeremyLetang/rust/move-libsync, r=alexcrichton
This time everything should be okay, No break due to a failed merge or rebase...

Sorry for the abuse of pull request.

So this move extra::sync, extra::arc, extra::future, extra::comm and extra::task_pool to libsync.
2014-02-05 09:21:34 -08:00
JeremyLetang
dd21a51d29 move concurrent stuff from libextra to libsync 2014-02-05 11:56:04 -05:00
bors
faf60551ec auto merge of #12045 : thestinger/rust/glue, r=pcwalton
A solid step towards fixing #11998. Eventually, the size may always be
passed to `exchange_free` but this will not be required to fix the bug.
2014-02-05 08:06:37 -08:00
bors
ed885e35fe auto merge of #12035 : chromatic/rust/tutorial_improvements, r=alexcrichton
This cleans up a warning about an unused variable and explains the code
further.
2014-02-05 03:16:35 -08:00
bors
53864ce512 auto merge of #12025 : lilac/rust/feature-gate-quote, r=brson
Closes #11630.
2014-02-05 01:06:32 -08:00
Daniel Micay
1778b63616 stop calling exchange_free on 0-size types
A solid step towards fixing #11998. Eventually, the size may always be
passed to `exchange_free` but this will not be required to fix the bug.
2014-02-05 03:05:36 -05:00
bors
1bcc73fe9d auto merge of #12023 : nick29581/rust/err_res, r=alexcrichton
closes #3512
2014-02-04 23:46:37 -08:00
bors
4509b49451 auto merge of #12018 : alexcrichton/rust/triage, r=sfackler
Mostly just test suite modifications.
2014-02-04 21:46:35 -08:00
bors
28f277b909 auto merge of #12014 : eddyb/rust/less-copies, r=cmr 2014-02-04 18:41:38 -08:00
Alex Crichton
03c28b4ac5 Make cfail test error messages more precise
Closes #3192
2014-02-04 18:05:13 -08:00
Alex Crichton
8a1dda92ba Adding tests for closed issues
Closes #5521
Closes #9396
Closes #10714
2014-02-04 18:05:13 -08:00
chromatic
87d026b76e Improved pattern-match code and explanation.
This cleans up a warning about an unused variable and explains the code
further.
2014-02-04 16:11:32 -08:00
bors
acb1ec0b67 auto merge of #11230 : csherratt/rust/cow, r=alexcrichton
This allows patch adds a new arc type that allows for creation of copy-on-write data structures. The idea is that it is safe to mutate any data structure as long as it has only one reference to it. If there are multiple, it requires cloning of the data structure before mutation is possible.
2014-02-04 14:41:36 -08:00
Nick Cameron
8d8c7835f7 Check for trait impl conflicts across crates 2014-02-05 08:50:05 +13:00
Eduard Burtescu
01815b3920 Don't copy arguments passed by value with indirection to allocas. 2014-02-04 20:53:58 +02:00
bors
ef53b7a97c auto merge of #12026 : alexcrichton/rust/snapshots, r=cmr 2014-02-04 06:31:34 -08:00
bors
cdc678945f auto merge of #11951 : dmanescu/rust/reserve-rename, r=huonw
Changes in std::{str,vec,hashmap} and extra::{priority_queue,ringbuf}.
Fixes #11949
2014-02-04 04:31:34 -08:00
James Deng
124938bcf5 Replaced with a single "quote" feature gate. 2014-02-04 22:03:00 +11:00
bors
10de762f6c auto merge of #11717 : DiamondLovesYou/rust/master, r=alexcrichton
Note that it still doesn't allow generic types to be marked with #[simd].
2014-02-04 01:11:34 -08:00
Richard Diamond
7becc0f34c Added missing xfail-fast. 2014-02-04 02:26:02 -06:00
Alex Crichton
6c41192c41 Register new snapshots 2014-02-04 00:06:08 -08:00
Richard Diamond
63ba2e1219 Simd feature gating + Win32/64 fixes. 2014-02-04 01:04:19 -06:00
James Deng
38f2526beb Feature gate all quasi-quoting macros. 2014-02-04 16:35:57 +11:00