Commit Graph

39621 Commits

Author SHA1 Message Date
David Creswick
1d647a0eec Slice::swap should be inlineable 2015-03-02 22:06:51 -06:00
Kang Seonghoon
ef3c7af172 metadata: Bump the metadata encoding version.
We have changed the encoding enough to bump that.
Also added some notes about metadata encoding to librbml/lib.rs.
2015-03-03 11:55:38 +09:00
Kang Seonghoon
fe73d382ee metadata: Compact integer encoding.
Previously every auto-serialized tags are strongly typed. However
this is not strictly required, and instead it can be exploited
to provide the optimal encoding for smaller integers. This commit
repurposes `EsI8`/`EsU8` through `EsI64`/`EsU64` tags to represent
*any* integers with given ranges: It is now possible to encode
`42u64` as two bytes `EsU8 0x2a`, for example.

There are some limitations:

* It does not apply to non-auto-serialized tags for obvious reasons.
  Fortunately, we have already eliminated the biggest source of
  such tag in favor of auto-serialized tags: `tag_table_id`.
* Bigger tags cannot be used to represent smaller types.
* Signed tags and unsigned tags do not mix.
2015-03-03 11:55:37 +09:00
Kang Seonghoon
36a09a162d metadata: Flatten tag_table_id and tag_table_val tags.
This avoids a biggish eight-byte `tag_table_id` tag in favor of
autoserialized integer tags, which are smaller and can be later
used to encode them in the optimal number of bytes. `NodeId` was
u32 after all.

Previously:

                       <------------- len1 -------------->
    tag_table_* <len1> tag_table_id 88 <nodeid in 8 bytes>
                       tag_table_val <len2> <actual data>
                                            <-- len2 --->

Now:

                      <--------------- len --------------->
    tag_table_* <len> U32 <nodeid in 4 bytes> <actual data>
2015-03-03 11:55:37 +09:00
Kang Seonghoon
7b6e43c07f metadata: Space-optimize empty vectors and maps.
So that `EsVec 82 EsSub8 00` becomes `EsVec 80` now.
2015-03-03 11:55:37 +09:00
Kang Seonghoon
84e9a61e9c metadata: Implement relaxation of short RBML lengths.
We try to move the data when the length can be encoded in
the much smaller number of bytes. This interferes with indices and
type abbreviations however, so this commit introduces a public
interface to get and mark a "stable" (i.e. not affected by
relaxation) position of the current pointer.

The relaxation logic only moves a small data, currently at most
256 bytes, as moving the data can be costly. There might be
further opportunities to allow more relaxation by moving fields
around, which I didn't seriously try.
2015-03-03 11:55:37 +09:00
Kang Seonghoon
de00b858d1 metadata: Introduce EsSub8 and EsSub32 tags.
They replace the existing `EsEnumVid`, `EsVecLen` and `EsMapLen`
tags altogether; the meaning of them can be easily inferred
from the enclosing tag. It also has an added benefit of
encodings for smaller variant ids or lengths being more compact
(5 bytes to 2 bytes).
2015-03-03 11:55:37 +09:00
Kang Seonghoon
35c798b3fc metadata: Bye bye EsLabel. No regrets.
For the reference, while it is designed to be selectively enabled,
it was essentially enabled throughout every snapshot and nightly
as far as I can tell. This makes the usefulness of `EsLabel` itself
questionable, as it was quite rare that `EsLabel` broke the build.
It had consumed about 20~30% of metadata (!) and so this should be
a huge win.
2015-03-03 11:55:37 +09:00
Kang Seonghoon
2f3aa0dd2e metadata: Eliminate the EsEnumBody tag.
It doesn't serve any useful purpose. It *might* be useful when
there are some tags that are generated by `Encodable` and
not delimited by any tags, but IIUC it's not the case.

Previous:

                  <-------------------- len1 ------------------->
    EsEnum <len1> EsEnumVid <vid> EsEnumBody <len2> <arg1> <arg2>
                                                    <--- len2 -->

Now:

                  <----------- len1 ---------->
    EsEnum <len1> EsEnumVid <vid> <arg1> <arg2>
2015-03-03 11:55:36 +09:00
Kang Seonghoon
c9840b644c metadata: Introduce implicit lengths for auto-serialization.
Many auto-serialization tags are fixed-size (note: many ordinary
tags are also fixed-size but for now this commit ignores them),
so having an explicit length is a waste. This moves any
auto-serialization tags with an implicit length before other tags,
so a test for them is easy. A preliminary experiment shows this
has at least 1% gain over the status quo.
2015-03-03 11:55:36 +09:00
Kang Seonghoon
38a965a747 metadata: New tag encoding scheme.
EBML tags are encoded in a variable-length unsigned int (vuint),
which is clever but causes some tags to be encoded in two bytes
while there are really about 180 tags or so. Assuming that there
wouldn't be, say, over 1,000 tags in the future, we can use much
more efficient encoding scheme. The new scheme should support
at most 4,096 tags anyway.

This also flattens a scattered tag namespace (did you know that
0xa9 is followed by 0xb0?) and makes a room for autoserialized tags
in 0x00 through 0x1f.
2015-03-03 11:55:32 +09:00
Kang Seonghoon
ac20ded1f8 metadata: Avoid the use of raw wr_str or write_all.
They are, with a conjunction of `start_tag` and `end_tag`, commonly
used to write a document with a binary data of known size. However
the use of `start_tag` makes the length always 4 bytes long, which
is almost not optimal (requiring the relaxation step to remedy).
Directly using `wr_tagged_*` methods is better for both readability
and resulting metadata size.
2015-03-03 11:55:10 +09:00
bors
5457eab3c5 Auto merge of #22600 - brson:num, r=Gankro
* count_ones/zeros, trailing_ones/zeros return u32, not usize
* rotate_left/right take u32, not usize
* RADIX, MANTISSA_DIGITS, DIGITS, BITS, BYTES are u32, not usize

Doesn't touch pow because there's another PR for it.

cc https://github.com/rust-lang/rust/issues/22240

r? @Gankro
2015-03-03 02:05:18 +00:00
Huon Wilson
c195783c05 Feature gate #[static_assert].
The API this exposes is a little strange (being attached to `static`s),
so it makes sense to conservatively feature gate it. If it is highly
popular, it is possible to reverse this gating.
2015-03-03 13:00:10 +11:00
Brian Anderson
76e9fa63ba core: Audit num module for int/uint
* count_ones/zeros, trailing_ones/zeros return u32, not usize
* rotate_left/right take u32, not usize
* RADIX, MANTISSA_DIGITS, DIGITS, BITS, BYTES are u32, not usize

Doesn't touch pow because there's another PR for it.

[breaking-change]
2015-03-02 16:12:46 -08:00
Ivan Petkov
2b03718618 Enable recursion for visit_ty in lint visitor
* The lint visitor's visit_ty method did not recurse, and had a
  reference to the now closed #10894
* The newly enabled recursion has only affected the `deprectated` lint
  which now detects uses of deprecated items in trait impls and
  function return types
* Renamed some references to `CowString` and `CowVec` to `Cow<str>` and
  `Cow<[T]>`, respectively, which appear outside of the crate which
  defines them
* Replaced a few instances of `InvariantType<T>` with
  `PhantomData<Cell<T>>`
* Disabled the `deprecated` lint in several places that
  reference/implement traits on deprecated items which will get cleaned
  up in the future
* Disabled the `exceeding_bitshifts` lint for
  compile-fail/huge-array-simple test so it doesn't shadow the expected
  error on 32bit systems
* Unfortunately, this means that if a library declares
  `#![deny(deprecated)]` and marks anything as deprecated, it will have
  to disable the lint for any uses of said item, e.g. any impl the now
  deprecated item

For any library that denies deprecated items but has deprecated items
of its own, this is a [breaking-change]
2015-03-02 15:35:48 -08:00
bors
b4c965ee80 Auto merge of #22882 - alexcrichton:stabilize-process, r=aturon
This commits blanket marks the API of the `std::process` module as `#[stable]`.
The module's API is very similar to the old `std::old_io::process` API and has
generally had quite a bit of time to bake both before and after the new module
landed.
2015-03-02 23:18:36 +00:00
Keegan McAllister
daef3b9b53 Add regression tests for #15778
Fixes #15778.
2015-03-02 13:22:03 -08:00
Simonas Kazlauskas
33f77e92e8 Readd int_uint feature to libstd
Reverts a small part of c74d49c804 because compilation pukes with warnings now.
2015-03-02 22:54:39 +02:00
bors
2ca6eaedae Auto merge of #22963 - Manishearth:rollup, r=Manishearth 2015-03-02 20:26:39 +00:00
Manish Goregaokar
c4b1500fec Rollup merge of #22966 - nikomatsakis:closure-region-hierarchy, r=pnkfelix
Remove the synthetic \"region bound\" from closures and instead update how
type-outlives works for closure types so that it ensures that all upvars
outlive the region in question. This gives the same guarantees but
without introducing artificial regions (and gives better error messages
to boot). This is refactoring towards #3696.

r? @pnkfelix
2015-03-03 01:48:58 +05:30
Manish Goregaokar
f608afe470 Rollup merge of #22961 - dotdash:branch_drop, r=eddyb 2015-03-03 01:48:58 +05:30
Manish Goregaokar
8567f290b8 Add cfg_attr to known attributes 2015-03-03 01:48:58 +05:30
Manish Goregaokar
c9d5494640 Rollup merge of #22961 - dotdash:branch_drop, r=eddyb 2015-03-03 01:46:29 +05:30
Manish Goregaokar
718b591f33 Rollup merge of #22925 - leonardinius:issue-22646-fmt, r=steveklabnik
Addresses rust-lang/rust#22646

Removes deprecated `{:08d}` format from the module documentation.
`{:08}` should be used instead now.
2015-03-03 01:46:29 +05:30
Manish Goregaokar
16efd0ecbf Rollup merge of #22911 - djmally:master, r=steveklabnik
... example that actually does use an Option
2015-03-03 01:46:28 +05:30
Manish Goregaokar
973272e959 Rollup merge of #22906 - alexandercampbell:readme_typo_fix, r=steveklabnik
Typo fix for the \"30 Minute Intro\".

CONTRIBUTING guide says I should do this:

r? @steveklabnik
2015-03-03 01:46:28 +05:30
Manish Goregaokar
524327ace2 Rollup merge of #22689 - tshepang:thread-doc-improvements, r=steveklabnik 2015-03-03 01:46:27 +05:30
David Mally
0a1776495c Added note that method names in tables may differ from actual collections 2015-03-02 15:01:44 -05:00
David Mally
7d3119773f Fixed references to set & take ; minor wording & syntax fixes 2015-03-02 14:32:42 -05:00
Felix S. Klock II
c6b66034d6 Make test/run-pass/backtrace.rs more robust about own host environment.
Namely, I have been annoyed in the past when I have done
`RUST_BACKTRACE=1 make check` only to discover (again) that such a
trick causes this test to fail, because it assumes that the
`RUST_BACKTRACE` environment variable is not set.

Fix #22870
2015-03-02 18:32:39 +01:00
Björn Steinbrink
f580412e95 Drop alloca_zeroed
Its only user was lvalue_scratch_datum which is called with zero=true
anymore, so it's effectively unused.
2015-03-02 17:12:36 +01:00
Florian Zeitz
f35f973cb7 Use consts instead of statics where appropriate
This changes the type of some public constants/statics in libunicode.
Notably some `&'static &'static [(char, char)]` have changed
to `&'static [(char, char)]`. The regexp crate seems to be the
sole user of these, yet this is technically a [breaking-change]
2015-03-02 17:11:51 +01:00
Björn Steinbrink
fe91974dd6 Properly propagate block changes while translating drop glue 2015-03-02 21:35:40 +05:30
bors
1cc8b6ec66 Auto merge of #22510 - GuillaumeGomez:audit-integer-libstd-thread, r=alexcrichton
Part of #22240.
2015-03-02 11:21:26 +00:00
Björn Steinbrink
31ad998bfd Properly propagate block changes while translating drop glue 2015-03-02 12:13:28 +01:00
Niko Matsakis
00fcf79448 Remove the synthetic "region bound" from closures and instead update how
type-outlives works for closure types so that it ensures that all upvars
outlive the region in question. This gives the same guarantees but
without introducing artificial regions (and gives better error messages
to boot).
2015-03-02 05:45:41 -05:00
Lai Jiangshan
cd65156514 iter: use Option::map() in struct Iterater::map()
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
2015-03-02 17:32:16 +08:00
bors
c5142056f7 Auto merge of #22797 - alexcrichton:io-stdio, r=aturon
This is an implementation of RFC 899 and adds stdio functionality to the new
`std::io` module. Details of the API can be found on the RFC, but from a high
level:

* `io::{stdin, stdout, stderr}` constructors are now available. There are also
  `*_raw` variants for unbuffered and unlocked access.
* All handles are globally shared (excluding raw variants).
* The stderr handle is no longer buffered.
* All handles can be explicitly locked (excluding the raw variants).

The `print!` and `println!` machinery has not yet been hooked up to these
streams just yet. The `std::fmt::output` module has also not yet been
implemented as part of this commit.
2015-03-02 07:10:14 +00:00
Huon Wilson
b0e7c58bf0 Add missing stability attributes on struct fields.
Unstable is the conservative choice.

cc #22950.
2015-03-02 18:04:11 +11:00
Huon Wilson
25ad3ba3cb Manual Clone for Windows/Chunks.
`#[derive(Clone)]` unnecessarily requires the element type to also be
`Clone`.
2015-03-02 17:54:18 +11:00
Eunji Jeong
a7fe94fc0c Fix broken aarch64 build 2015-03-02 14:35:58 +09:00
Alex Crichton
93613a543f std: Stabilize the process module
This commits blanket marks the API of the `std::process` module as `#[stable]`.
The module's API is very similar to the old `std::old_io::process` API and has
generally had quite a bit of time to bake both before and after the new module
landed.

The one modification made to the API is that `Stdio::capture` is now named
`stdio::piped`.

[breaking-change]
2015-03-01 20:41:37 -08:00
bors
4b3b02f8f4 Auto merge of #22940 - Manishearth:rollup, r=Manishearth 2015-03-02 00:37:24 +00:00
Manish Goregaokar
69881574f7 Rollup merge of #22944 - Manishearth:patch-1, r=sfackler
Been breaking tests lately. Somehow nondeterministic?
2015-03-02 06:04:39 +05:30
Manish Goregaokar
e955f4323b Fix unknown attribute in test 2015-03-02 05:31:34 +05:30
Manish Goregaokar
c84e3a1f19 Rollup merge of #22941 - sfackler:re-disable, r=sfackler
Seems to be blocking forever
2015-03-02 04:43:32 +05:30
Steven Fackler
1f1c5d54bf Ignore issue #16671 test on android (again)
Seems to be blocking forever
2015-03-01 15:11:09 -08:00
GuillaumeGomez
6d74279234 Replace int/uint by isize/usize 2015-03-01 23:26:23 +01:00
Manish Goregaokar
b79a788f8f Rollup merge of #22935 - dotdash:method_attr, r=eddyb
... objects

For method calls through trait objects, we currently generate the llvm
function argument attributes using the non-opaque method signature that
still has the trait object fat pointer for the self pointer. This leads
to attributes that are plain wrong, e.g. noalias. As we don't know
anything about the concrete type of the underlying object, we must
replace the self argument with an opaque i8 pointer before applying the
attributes.
2015-03-02 03:54:33 +05:30