Commit Graph

29077 Commits

Author SHA1 Message Date
Alex Crichton
14d3dbe292 core: Document FormatWriter and allow write!
This commit fills in the documentation holes for the FormatWriter trait which
were previously accidentally left blank. Additionally, this adds the `write_fmt`
method to the trait to allow usage of the `write!` macro with implementors of
the `FormatWriter` trait. This is not useful for consumers of the standard
library who should generally avoid the `FormatWriter` trait, but it is useful
for consumers of the core library who are not using the standard library.
2014-05-17 22:10:39 -07:00
Alex Crichton
0989f5c2e7 core: Clarify the documentation on core's prelude
Closes #14246
2014-05-17 22:08:49 -07:00
bors
134f797a63 auto merge of #14230 : alexcrichton/rust/liballoc, r=cmr,huonw
This commit is part of the libstd facade RFC, issue #13851. This creates a new
library, liballoc, which is intended to be the core allocation library for all
of Rust. It is pinned on the basic assumption that an allocation failure is an
abort or failure.

This module has inherited the heap/libc_heap modules from std::rt, the owned/rc
modules from std, and the arc module from libsync. These three pointers are
currently the three most core pointer implementations in Rust.

The UnsafeArc type in std::sync should be considered deprecated and replaced by
`Arc<Unsafe<T>>`. This commit does not currently migrate to this type, but future
commits will continue this refactoring.
2014-05-17 22:01:28 -07:00
Alex Crichton
4a1d21ab7b Register new snapshots 2014-05-17 21:54:11 -07:00
Alex Crichton
639759b7f4 std: Refactor liballoc out of lib{std,sync}
This commit is part of the libstd facade RFC, issue #13851. This creates a new
library, liballoc, which is intended to be the core allocation library for all
of Rust. It is pinned on the basic assumption that an allocation failure is an
abort or failure.

This module has inherited the heap/libc_heap modules from std::rt, the owned/rc
modules from std, and the arc module from libsync. These three pointers are
currently the three most core pointer implementations in Rust.

The UnsafeArc type in std::sync should be considered deprecated and replaced by
Arc<Unsafe<T>>. This commit does not currently migrate to this type, but future
commits will continue this refactoring.
2014-05-17 21:52:23 -07:00
Michael Dagitses
4353e44563 adding move_iter() function to collections::treemap::TreeSet 2014-05-18 00:47:01 -04:00
Corey Richardson
154dfb59fe term: update example to be right (thanks @SiegeLord) 2014-05-17 20:16:21 -07:00
bors
3da5a5cd18 auto merge of #14253 : alexcrichton/rust/issue-14221, r=pcwalton
This plugs a leak where resolve was treating enums defined in parent modules as
in-scope for all children modules when resolving a pattern identifier. This
eliminates the code path in resolve entirely.

If this breaks any existing code, then it indicates that the variants need to be
explicitly imported into the module.

Closes #14221
2014-05-17 05:06:27 -07:00
bors
20b502b241 auto merge of #14247 : Ryman/rust/minor_ptr_nit, r=alexcrichton
Not too hot on the second change, welcome a better suggestion/wording.
2014-05-17 02:41:20 -07:00
Alex Crichton
4e9e091e91 syntax: Tighten search paths for inner modules
This is an implementation of RFC 16. A module can now only be loaded if the
module declaring `mod name;` "owns" the current directory. A module is
considered as owning its directory if it meets one of the following criteria:

* It is the top-level crate file
* It is a `mod.rs` file
* It was loaded via `#[path]`
* It was loaded via `include!`
* The module was declared via an inline `mod foo { ... }` statement

For example, this directory structure is now invalid

    // lib.rs
    mod foo;

    // foo.rs
    mod bar;

    // bar.rs;
    fn bar() {}

With this change `foo.rs` must be renamed to `foo/mod.rs`, and `bar.rs` must be
renamed to `foo/bar.rs`. This makes it clear that `bar` is a submodule of `foo`,
and can only be accessed through `foo`.

RFC: 0016-module-file-system-hierarchy
Closes #14180

[breaking-change]
2014-05-17 01:01:47 -07:00
bors
8befaba9ef auto merge of #14239 : alexcrichton/rust/issue-14225, r=huonw
These are taken care of with compiler errors later on, no need to spam with
extra unformatted information unconditionally.

Closes #14225
2014-05-17 01:01:22 -07:00
bors
1e0379f05b auto merge of #14224 : michaelwoerister/rust/simd-update, r=alexcrichton
This is a small change that improves the DWARF description of SIMD types by exposing their type name to debuginfo.
2014-05-16 23:16:22 -07:00
bors
11e17c8705 auto merge of #14236 : alexcrichton/rust/issue-14082, r=brson
The reexport didn't switch the privacy, so the reexport was actually considered
private, erroneously failing to resolve imports later on.

Closes #14082
2014-05-16 21:36:23 -07:00
bors
5327218013 auto merge of #14257 : alexcrichton/rust/fix-snap, r=huonw
This is blocking a snapshot because apparently the test fails on the bots.
2014-05-16 19:21:26 -07:00
Alex Crichton
99a9cc5331 term: Don't run the code example, just compile it
This is blocking a snapshot because apparently the test fails on the bots.
2014-05-16 18:45:59 -07:00
bors
2216eceea5 auto merge of #14216 : kballard/rust/macos_precise_time_ns, r=alexcrichton
Use sync:1️⃣:Once to fetch the mach_timebase_info only once when
running precise_time_ns(). This helps because mach_timebase_info() is
surprisingly inefficient. Also fix the order of operations when applying
the timebase to the mach absolute time value.

This improves the time on my machine from

```
test tests::bench_precise_time_ns ... bench:       157 ns/iter (+/- 4)
```

to

```
test tests::bench_precise_time_ns ... bench:        38 ns/iter (+/- 3)
```

and it will get even faster once #14174 lands.
2014-05-16 16:31:24 -07:00
Alex Crichton
7cbec5566c rustc: Stop leaking enum variants into children
This plugs a leak where resolve was treating enums defined in parent modules as
in-scope for all children modules when resolving a pattern identifier. This
eliminates the code path in resolve entirely.

If this breaks any existing code, then it indicates that the variants need to be
explicitly imported into the module.

Closes #14221

[breaking-change]
2014-05-16 16:16:57 -07:00
bors
cea4803d4c auto merge of #14135 : gereeter/rust/two-way-search, r=brson
This changes the previously naive string searching algorithm to a two-way search like glibc, which should be faster on average while still maintaining worst case linear time complexity. This fixes #14107. Note that I don't think this should be merged yet, as this is the only approach to speeding up search I've tried - it's worth considering options like Boyer-Moore or adding a bad character shift table to this. However, the benchmarks look quite good so far:

    test str::bench::bench_contains_bad_naive                   ... bench:       290 ns/iter (+/- 12)     from 1309 ns/iter (+/- 36)
    test str::bench::bench_contains_equal                       ... bench:       479 ns/iter (+/- 10)     from  137 ns/iter (+/- 2)
    test str::bench::bench_contains_short_long                  ... bench:      2844 ns/iter (+/- 105)    from 5473 ns/iter (+/- 14)
    test str::bench::bench_contains_short_short                 ... bench:        55 ns/iter (+/- 4)      from   57 ns/iter (+/- 6)

Except for the case specifically designed to be optimal for the naive case (`bench_contains_equal`), this gets as good or better performance as the previous code.
2014-05-16 14:46:24 -07:00
Luqman Aden
28243a5c0e librustc: Separate NullablePointer into RawNullablePointer and StructWrappedNullablePointer. 2014-05-16 17:24:49 -04:00
Luqman Aden
d104dabae9 Make some NullablePointer enums FFI-compatible with the base pointer type. 2014-05-16 17:24:49 -04:00
Kevin Ballard
8ef3e22719 Optimize and fix time::precise_time_ns() on macos
Use sync:1️⃣:Once to fetch the mach_timebase_info only once when
running precise_time_ns(). This helps because mach_timebase_info() is
surprisingly inefficient. Also fix the order of operations when applying
the timebase to the mach absolute time value.

This improves the time on my machine from

```
test tests::bench_precise_time_ns ... bench:       157 ns/iter (+/- 4)
```

to

```
test tests::bench_precise_time_ns ... bench:        38 ns/iter (+/- 3)
```

and it will get even faster once #14174 lands.
2014-05-16 14:02:14 -07:00
bors
5e10686aab auto merge of #14233 : pcwalton/rust/detildestr-morelibs, r=alexcrichton
r? @alexcrichton
2014-05-16 13:11:23 -07:00
bors
25c54226c3 auto merge of #13401 : cmr/rust/docs, r=brson
Adds docs where previously there were no docs. Also adds windows support to libterm.
2014-05-16 11:41:30 -07:00
Patrick Walton
b84c0dc2d6 doc: Remove all uses of ~str from the documentation. 2014-05-16 11:41:27 -07:00
Patrick Walton
1fb08f11b7 libgetopts: Remove all uses of ~str from libgetopts 2014-05-16 11:41:27 -07:00
Patrick Walton
28bcef85e4 libserialize: Remove all uses of ~str from libserialize.
Had to make `struct Tm` in `libtime` not serializable for now.
2014-05-16 11:41:27 -07:00
Patrick Walton
67e39a8e76 libfmt_macros: Remove all uses of ~str from libfmt_macros 2014-05-16 11:41:27 -07:00
Patrick Walton
ce11f19695 librustuv: Remove all uses of ~str from librustuv 2014-05-16 11:41:27 -07:00
Patrick Walton
78bc758c94 compiletest: Remove all uses of ~str from compiletest 2014-05-16 11:41:26 -07:00
Corey Richardson
3da99c5d8a Some fixes 2014-05-16 10:59:25 -07:00
Corey Richardson
1fe15b95cb Fix example 2014-05-16 10:00:14 -07:00
Corey Richardson
26238c9a24 Flush before applying console attributes 2014-05-16 10:00:14 -07:00
Corey Richardson
2cd32a8c88 Add a bang 2014-05-16 10:00:14 -07:00
Corey Richardson
2afa42a32e Update for Box 2014-05-16 10:00:13 -07:00
Corey Richardson
c4cf6ca8ad Update for master 2014-05-16 10:00:13 -07:00
Corey Richardson
67aea1f8bd Add WinConsole docs 2014-05-16 10:00:13 -07:00
Corey Richardson
3af7755909 test: update for term fallout 2014-05-16 10:00:13 -07:00
Corey Richardson
7bf1de5283 workcache: add crate doc block 2014-05-16 10:00:13 -07:00
Corey Richardson
6ef2169bac time: crate description 2014-05-16 10:00:13 -07:00
Corey Richardson
e3d0e5e2f2 syntax: update for libterm fallout 2014-05-16 09:59:31 -07:00
Corey Richardson
f923b93694 term: add docs and windows support
Closes #2807
2014-05-16 09:57:32 -07:00
Corey Richardson
e30198d9d4 num: expand crate documentation + add example 2014-05-16 09:55:29 -07:00
Corey Richardson
91fa8e5f2a arena: add docs for Arena 2014-05-16 09:55:29 -07:00
Corey Richardson
30250d3de8 flate: add documentation 2014-05-16 09:55:29 -07:00
Alex Crichton
6959b4f7b0 rustc: Stop calling error! in resolve
These are taken care of with compiler errors later on, no need to spam with
extra unformatted information unconditionally.

Closes #14225
2014-05-16 09:15:51 -07:00
Kevin Butler
6bfe361de2 guide-pointers: minor nits 2014-05-16 15:40:21 +01:00
bors
bbd034c3a6 auto merge of #14237 : alexcrichton/rust/issue-14144, r=cmr
By default, jemalloc is building itself with -g3 if the local compiler supports
it. It looks like this is generating a good deal of debug info that windows
isn't optimizing out (on the order of 18MB). Windows gcc/ld is also not
optimizing this data away, causing hello world to be 18MB in size.

There's no current real need for debugging jemalloc to a great extent, so this
commit manually passes -g1 to override -g3 which jemalloc is using. This is
confirmed to drop the size of executables on windows back to a more reasonable
size (2.0MB, as they were before).

Closes #14144
2014-05-16 02:46:25 -07:00
bors
d92926ca3b auto merge of #14235 : Ryman/rust/simplify_arcs_doc, r=alexcrichton 2014-05-16 01:06:25 -07:00
bors
b545a499fa auto merge of #14115 : alexcrichton/rust/core-fmt, r=brson
This was a more difficult change than I thought it would be, and it is unfortunately a breaking change rather than a drop-in replacement. Most of the rationale can be found in the third commit.

cc #13851
2014-05-15 23:26:26 -07:00
Alex Crichton
2e2160b026 core: Update all tests for fmt movement 2014-05-15 23:22:15 -07:00