Commit Graph

22871 Commits

Author SHA1 Message Date
bors
78c3fac852 auto merge of #9535 : alexcrichton/rust/no-format-default, r=thestinger
As mentioned in #9456, the format! syntax extension would previously consider an
empty format as a 'Unknown' format which could then also get coerced into a
different style of format on another argument.

This is unusual behavior because `{}` is a very common format and if you have
`{0} {0:?}` you wouldn't expect them both to be coereced to the `Poly`
formatter. This commit removes this coercion, but still retains the requirement
that each argument has exactly one format specified for it (an empty format now
counts as well).

Perhaps at a later date we can add support for multiple formats of one argument,
but this puts us in at least a backwards-compatible situation if we decide to do
that.
2013-09-27 09:41:07 -07:00
Alex Crichton
b74663e027 Remove the notion of an "unknown format"
As mentioned in #9456, the format! syntax extension would previously consider an
empty format as a 'Unknown' format which could then also get coerced into a
different style of format on another argument.

This is unusual behavior because `{}` is a very common format and if you have
`{0} {0:?}` you wouldn't expect them both to be coereced to the `Poly`
formatter. This commit removes this coercion, but still retains the requirement
that each argument has exactly one format specified for it (an empty format now
counts as well).

Perhaps at a later date we can add support for multiple formats of one argument,
but this puts us in at least a backwards-compatible situation if we decide to do
that.
2013-09-27 09:39:05 -07:00
Tim Chevalier
96bdcd07fe rustpkg: Implement rustpkg test
Towards #7401
2013-09-27 09:38:22 -07:00
bors
10e7f12daf auto merge of #9550 : alexcrichton/rust/remove-printf, r=thestinger
The 0.8 release was cut, down with printf!
2013-09-27 08:21:23 -07:00
bors
01313a131b auto merge of #9548 : thestinger/rust/internal, r=alexcrichton
Closes #9494
2013-09-27 06:21:22 -07:00
bors
74dfd93bad auto merge of #9540 : alexcrichton/rust/more-rustdoc-improvements, r=brson
Commit messages have the details, mostly just knocking out more low-hanging-fruit type issues.
2013-09-27 04:51:13 -07:00
bors
ae8a2ff379 auto merge of #9538 : thestinger/rust/type_use, r=pcwalton
This is broken, and results in poor performance due to the undefined
behaviour in the LLVM IR. LLVM's `mergefunc` is a *much* better way of
doing this since it merges based on the equality of the bytecode.

For example, consider `std::repr`. It generates different code per
type, but is not included in the type bounds of generics.

The `mergefunc` pass works for most of our code but currently hits an
assert on libstd. It is receiving attention upstream so it will be
ready soon, but I don't think removing this broken code should wait any
longer. I've opened #9536 about enabling it by default.

Closes #8651
Closes #3547
Closes #2537
Closes #6971
Closes #9222
2013-09-27 03:31:13 -07:00
bors
afbc242a20 auto merge of #9527 : bmaxa/rust/master, r=alexcrichton
that is, if super trait had more methods, tnen subtrait, compiling would fail. I simply forgot to update
variable name. Updated test case , too.
2013-09-27 01:36:15 -07:00
Alex Crichton
46aaf5128d Register new snapshots 2013-09-27 00:44:32 -07:00
bors
d6774f8c39 auto merge of #9352 : erickt/rust/master, r=huonw
One of the downsides with `c_str` is that it always forces an allocation, and so this could add unnecessary overhead to various calls. This PR implements one of the suggestions @graydon made in #8296 for `vec.with_c_str` in that for a short string can use a small stack array instead of a malloced array for our temporary c string. This ends up being twice as fast for small strings.

There are two things to consider before landing this commit though. First off, I arbitrarily picked the stack array as 32 bytes, and I'm not sure if this a reasonable amount or not. Second, there is a risk that someone can keep a reference to the interior stack pointer, which could cause mayhem if someone were to dereference the pointer. Since we also can easily grab and return interior pointers to vecs though, I don't think this is that much of an issue.
2013-09-26 23:51:13 -07:00
Erick Tryzelaar
b1ee87f402 std: simplify vec.with_c_str
This also fixes a bug in `vec.with_c_str_unchecked` where we
were not calling `.to_c_str_unchecked()` for long strings.
2013-09-26 22:49:10 -07:00
Erick Tryzelaar
2d878033fd std: add micro optimization to vec.with_c_str_unchecked
before:

test c_str::bench::bench_with_c_str_unchecked_long ... bench: 361 ns/iter (+/- 9)
test c_str::bench::bench_with_c_str_unchecked_medium ... bench: 75 ns/iter (+/- 2)
test c_str::bench::bench_with_c_str_unchecked_short ... bench: 60 ns/iter (+/- 9)

after:

test c_str::bench::bench_with_c_str_unchecked_long ... bench: 362 ns/iter (+/-
test c_str::bench::bench_with_c_str_unchecked_medium ... bench: 30 ns/iter (+/- 7)
test c_str::bench::bench_with_c_str_unchecked_short ... bench: 12 ns/iter (+/- 4)
2013-09-26 22:20:40 -07:00
Erick Tryzelaar
4868273d97 std: Up vec.with_c_str's stack buffer to 128
This matches @graydon's recommendation.
2013-09-26 22:20:40 -07:00
Erick Tryzelaar
ca66b81283 std: Remove an unnecessary comment from c_str
The documentation for `.with_c_str()` already says that the pointer
will be deallocated before returning from the function.
2013-09-26 22:20:40 -07:00
Erick Tryzelaar
e02d1eb171 std: Micro-optimize vec.with_c_str for short vectors
This now makes it unsafe to save the pointer returned by .with_c_str
as that pointer now may be pointing at a stack allocated array.

I arbitrarily chose 32 bytes as the length of the stack vector, and
so it might not be the most optimal size.

before:

test c_str::bench::bench_with_c_str_long ... bench: 539 ns/iter (+/- 91)
test c_str::bench::bench_with_c_str_medium ... bench: 97 ns/iter (+/- 2)
test c_str::bench::bench_with_c_str_short ... bench: 70 ns/iter (+/- 5)

after:

test c_str::bench::bench_with_c_str_long ... bench: 542 ns/iter (+/- 13)
test c_str::bench::bench_with_c_str_medium ... bench: 53 ns/iter (+/- 6)
test c_str::bench::bench_with_c_str_short ... bench: 19 ns/iter (+/- 0)
2013-09-26 22:20:40 -07:00
Erick Tryzelaar
410a96cc79 std: Add benchmarks to c_str 2013-09-26 22:20:40 -07:00
Erick Tryzelaar
2a9e763304 std: implement Container for CString 2013-09-26 22:20:39 -07:00
Erick Tryzelaar
0bdc99d81f std: removed some warnings in tests. 2013-09-26 22:20:39 -07:00
Erick Tryzelaar
4834661c66 std and rustc: Convert users of c_str to use .with_c_str 2013-09-26 22:20:39 -07:00
bors
eb3ebb7ebd auto merge of #9525 : klutzy/rust/obsolete-span-fix, r=alexcrichton 2013-09-26 22:11:14 -07:00
Steven Fackler
fe9b1e29fc Visibility fixes 2013-09-26 22:01:33 -07:00
blake2-ppc
c0e1c09783 std::vec: Use a valid value as lifetime dummy in iterator
The current implementation uses `&v[0]` for the lifetime struct field,
but that is a dangling pointer for iterators derived from zero-length
slices.

Example:

    let v: [int, ..0] = [];  println!("{:?}", v.iter())

    std::vec::VecIterator<,int>{ptr: (0x7f3768626100 as *()), end: (0x7f3768626100 as *()), lifetime: &139875951207128}

To replace this parameter, use a field of type `Option<&'self ()>`
that is simply initialized with `None`, but still allows the iterator to
have a lifetime parameter.
2013-09-27 06:06:13 +02:00
Alex Crichton
5fe09563ac Remove @mut Resolver
Instead use &mut everywhere as much as possible and then reorganize lots of code
to get past the borrow checker.
2013-09-26 20:12:55 -07:00
bors
fcd3776e82 auto merge of #9523 : huonw/rust/kud1ing-docs, r=huonw
Collation of @kud1ing's work in #9511, #9512, #9513 and #9518.
2013-09-26 20:06:09 -07:00
bors
a94158ce64 auto merge of #9504 : brson/rust/continue, r=alexcrichton 2013-09-26 18:46:10 -07:00
Brian Anderson
25bc6b6283 Remove a little bit of unused C++ 2013-09-26 18:40:13 -07:00
Brian Anderson
99c1fb8c66 Update version numbers to 0.9-pre 2013-09-26 18:18:42 -07:00
bors
1434b4bfca auto merge of #9261 : alexcrichton/rust/logging, r=huonw
This lifts various restrictions on the runtime, for example the character limit
when logging a message. Right now the old debug!-style macros still involve
allocating (because they use fmt! syntax), but the new debug2! macros don't
involve allocating at all (unless the formatter for a type requires allocation.
2013-09-26 17:11:13 -07:00
Alex Crichton
409182de6d Update the compiler to not use printf/printfln 2013-09-26 17:05:59 -07:00
Alex Crichton
09a5338197 Remove the printf{,ln}! macros
These are deprecated in favor of print{,ln}!
2013-09-26 17:03:31 -07:00
Daniel Micay
2aadd3652d mark globals as internal when not building a library
Closes #9494
2013-09-26 19:21:22 -04:00
bors
48499c7494 auto merge of #9484 : alexcrichton/rust/fix-cfg-inner-item, r=pcwalton
If an item is skipped due to it being unreachable or for some optimization, then
it shouldn't be encoded into the metadata (because it wasn't present in the
first place).
2013-09-26 15:36:10 -07:00
Brian Anderson
c1d64297f0 Add 'continue' keyword to emacs, vim, gedit, kate 2013-09-26 15:04:43 -07:00
Brian Anderson
88272a4f24 Add 'continue' as a synonym for 'loop' 2013-09-26 15:04:13 -07:00
Felix S. Klock II
2835df2db6 Fix for make -j race from #9531 injected by cleanup in b1a22518f0. 2013-09-26 23:56:53 +02:00
Daniel Micay
c3e4e06841 remove type_use
This is broken, and results in poor performance due to the undefined
behaviour in the LLVM IR. LLVM's `mergefunc` is a *much* better way of
doing this since it merges based on the equality of the bytecode.

For example, consider `std::repr`. It generates different code per
type, but is not included in the type bounds of generics.

The `mergefunc` pass works for most of our code but currently hits an
assert on libstd. It is receiving attention upstream so it will be
ready soon, but I don't think removing this broken code should wait any
longer. I've opened #9536 about enabling it by default.

Closes #8651
Closes #3547
Closes #2537
Closes #6971
Closes #9222
2013-09-26 17:27:23 -04:00
Alex Crichton
daee1b4d5c Ensure that skipped items aren't encoded
If an item is skipped due to it being unreachable or for some optimization, then
it shouldn't be encoded into the metadata (because it wasn't present in the
first place).
2013-09-26 13:54:50 -07:00
Alex Crichton
42bcf638b0 rustdoc: Render stability attributes
Closes #8965
2013-09-26 13:39:06 -07:00
bors
f210a16718 auto merge of #9520 : blake2-ppc/rust/ringbuf-swap, r=thestinger
extra::ringbuf: Implement method `.swap(uint, uint)` just like vector

RingBuf::swap(&mut self, i, j) swaps the element at indices `i` and `j`
if both elements are in bounds, otherwise it fails.
2013-09-26 13:21:08 -07:00
Alex Crichton
6a277dc4ba rustdoc: Strip implementations of private traits
Closes #5416
2013-09-26 12:27:38 -07:00
bors
47f2e80b65 auto merge of #9515 : pnkfelix/rust/fsk-test-for-issue-5153, r=alexcrichton
r? anyone
2013-09-26 12:01:28 -07:00
Alex Crichton
ca697d3705 rustdoc: Generate documentation for foreign items
This slurps up everything inside of an 'extern' block into the enclosing module
in order to document them. The documentation must be on the items themselves,
and they'll show up next to everything else on the module index pages.

Closes #5953
2013-09-26 11:57:25 -07:00
Alex Crichton
c429c7c04b rustdoc: Fix broken struct field search links
Takes the same approach as variants, writes a redirect index page back to the
struct with an anchor to the field in question.

Closes #9524
2013-09-26 11:31:40 -07:00
bors
c486634118 auto merge of #9507 : brson/rust/sched, r=alexcrichton
This also includes a fix for yielding from single-threaded schedulers where the scheduler would stop working before its work queue was empty. Fixes the deadlocks that this patch had previously.
2013-09-26 10:46:15 -07:00
bors
6f991a2441 auto merge of #9506 : sfackler/rust/visibility, r=alexcrichton 2013-09-26 09:21:09 -07:00
Branimir
a4b7474461 Fix ICE caused by my previous patch, that is, if super trait had more
methods tnan subtrait, compiling would fail. I simply forgot to update
variable name. Updated test case , too.
2013-09-26 16:59:54 +02:00
bors
0f9bcaf7fe auto merge of #9503 : dcrewi/rust/fix-digest-visibility, r=alexcrichton
I really have no idea why the tests didn't fail. Maybe it's another cross-crate issue?
2013-09-26 06:56:00 -07:00
klutzy
fc44a9c7dd syntax: Fix wrong span on trait fn visibility
Fixes #9348.
2013-09-26 22:48:21 +09:00
klutzy
a56e2eecf5 syntax: Fix wrong span on ObsoleteMode 2013-09-26 22:47:43 +09:00
klutzy
d96dfc9a59 syntax: Fix wrong span on ObsoleteEmptyImpl 2013-09-26 22:47:33 +09:00