Commit Graph

23314 Commits

Author SHA1 Message Date
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
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
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