Commit Graph

26277 Commits

Author SHA1 Message Date
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
bors
cf243f9b59 auto merge of #12060 : chromatic/rust/enum_tutorial_improvement, r=alexcrichton
This version starts with the simplest case and builds on it. I believe it flows better.
2014-02-09 17:31:31 -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
35b4115ef8 auto merge of #12126 : brson/rust/oxidize_mk, r=alexcrichton
I've always thought 'compile_and_link: ...' looked really awkward in our build output. Replace it with something more interesting. I'm open to alternatives to 'oxidize', like 'compile', anything but 'compile_and_link'.
2014-02-09 16:16:33 -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
Brian Anderson
3062d0f6bb mk: Replace 'compile_and_link' with 'oxidize' 2014-02-09 02:42:28 -08: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
a2290db797 auto merge of #12112 : lucab/rust/make-dist, r=alexcrichton
`make dist` or building from a generated tarball is currently not possible due to some files that have been renamed and the ongoing libextra split. This PR fixes all (current) issues in order to build rust from the .tar.gz source alone.
2014-02-08 15:17:30 -08: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
Luca Bruno
51b74c41ff make: update dist target after libextra split
libextra is currently being split into several crates. This commit adds
them all to the dist target in order to have them in the final tarballs.

Signed-off-by: Luca Bruno <lucab@debian.org>
2014-02-08 21:32:43 +01: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
Luca Bruno
99cdabab00 make: update dist target for renamed files
src/README.txt has been renamed in a30d61b05a, make dist is
thus failing as unable to find it.
This commit makes the dist target working again.

Signed-off-by: Luca Bruno <lucab@debian.org>
2014-02-08 14:36:18 +01: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