Commit Graph

655 Commits

Author SHA1 Message Date
Nicholas Nethercote
e761f3af90 Inline various simple emit_* and read_* methods in Decoder.
Mostly, these are the ones whose body just contains `f(self)`.
2020-02-18 16:46:50 +11:00
Dylan DPC
a50a896755
Rollup merge of #69050 - nnethercote:micro-optimize-leb128, r=michaelwoerister
Micro-optimize the heck out of LEB128 reading and writing.

This commit makes the following writing improvements:
- Removes the unnecessary `write_to_vec` function.
- Reduces the number of conditions per loop from 2 to 1.
- Avoids a mask and a shift on the final byte.

And the following reading improvements:
- Removes an unnecessary type annotation.
- Fixes a dangerous unchecked slice access. Imagine a slice `[0x80]` --
  the current code will read past the end of the slice some number of
  bytes. The bounds check at the end will subsequently trigger, unless
  something bad (like a crash) happens first. The cost of doing bounds
  check in the loop body is negligible.
- Avoids a mask on the final byte.

And the following improvements for both reading and writing:
- Changes `for` to `loop` for the loops, avoiding an unnecessary
  condition on each iteration. This also removes the need for
  `leb128_size`.

All of these changes give significant perf wins, up to 5%.

r? @michaelwoerister
2020-02-13 02:52:54 +01:00
Nicholas Nethercote
ad7802f9d4 Micro-optimize the heck out of LEB128 reading and writing.
This commit makes the following writing improvements:
- Removes the unnecessary `write_to_vec` function.
- Reduces the number of conditions per loop from 2 to 1.
- Avoids a mask and a shift on the final byte.

And the following reading improvements:
- Removes an unnecessary type annotation.
- Fixes a dangerous unchecked slice access. Imagine a slice `[0x80]` --
  the current code will read past the end of the slice some number of
  bytes. The bounds check at the end will subsequently trigger, unless
  something bad (like a crash) happens first. The cost of doing bounds
  check in the loop body is negligible.
- Avoids a mask on the final byte.

And the following improvements for both reading and writing:
- Changes `for` to `loop` for the loops, avoiding an unnecessary
  condition on each iteration. This also removes the need for
  `leb128_size`.

All of these changes give significant perf wins, up to 5%.
2020-02-11 19:07:43 +11:00
bjorn3
9d6bdccd9e Remove unused feature gate from libserialize 2020-02-07 13:59:31 +01:00
Nicholas Nethercote
6961db2024 Remove unused read_uleb128 parameter. 2020-01-30 15:22:53 +11:00
David Tolnay
4646a88b7a
Deprecate Error::description for real
`description` has been documented as soft-deprecated since 1.27.0 (17
months ago). There is no longer any reason to call it or implement it.

This commit:

- adds #[rustc_deprecated(since = "1.41.0")] to Error::description;

- moves description (and cause, which is also deprecated) below the
  source and backtrace methods in the Error trait;

- reduces documentation of description and cause to take up much less
  vertical real estate in rustdocs, while preserving the example that
  shows how to render errors without needing to call description;

- removes the description function of all *currently unstable* Error
  impls in the standard library;

- marks #[allow(deprecated)] the description function of all *stable*
  Error impls in the standard library;

- replaces miscellaneous uses of description in example code and the
  compiler.
2019-12-24 22:39:49 -08:00
Mark Rousskov
a06baa56b9 Format the world 2019-12-22 17:42:47 -05:00
Niko Matsakis
d286113024 Revert "Stabilize the never_type, written !."
This reverts commit 15c30ddd69.
2019-12-14 09:01:09 -05:00
Mazdak Farrokhzad
15c30ddd69 Stabilize the never_type, written !. 2019-11-21 14:55:32 +01:00
Ralf Jung
90b8d34c9f bump smallvec to 1.0 2019-11-04 15:59:09 +01:00
Nicholas Nethercote
c3b3a86124 Remove unnecessary Hash bounds from various types. 2019-10-21 13:48:20 +11:00
Yuki Okushi
f10d2e2d23 Fix clippy warnings 2019-10-01 23:15:47 +09:00
Alex Crichton
d8253c166b Tweak libserialize allows 2019-09-23 09:34:44 -07:00
Alex Crichton
7b907ded0e Fix compiling libserialize tests
They've got new warnings turned on so they need more `#![allow]`
2019-09-23 09:34:44 -07:00
Alex Crichton
22699d3139 Move handling of internal lints to build.rs 2019-09-23 09:34:44 -07:00
Ilija Tovilo
3a6a29b4ec
Use associated_type_bounds where applicable - closes #61738 2019-08-08 22:39:15 +02:00
Vadim Petrochenkov
f53fc21ba0 libserialize: Unconfigure tests during normal build 2019-08-02 01:59:01 +03:00
Vadim Petrochenkov
434152157f Remove lint annotations in specific crates that are already enforced by rustbuild
Remove some random unnecessary lint `allow`s
2019-07-28 18:46:24 +03:00
Mazdak Farrokhzad
3b19dc96fc
Rollup merge of #60066 - sfackler:type-name, r=Centril
Stabilize the type_name intrinsic in core::any

Stabilize `type_name` in `core::any`.

Closes rust-lang/rfcs#1428

FCP completed over there.

`RELEASES.md`: Prefer T-libs for categorization.
2019-07-25 23:20:49 +02:00
Steven Fackler
91fa898975 Stabilize the type_name intrinsic in core::any
Closes rust-lang/rfcs#1428
2019-07-24 21:35:49 -07:00
Vadim Petrochenkov
614037171b cleanup: Remove extern crate serialize as rustc_serializes 2019-07-23 19:20:16 +03:00
Mazdak Farrokhzad
3250b8ee59
Rollup merge of #62042 - petrochenkov:macstab, r=matthewjasper
Support stability and deprecation checking for all macros

RELNOTES: Deprecation attributes on macros now have effect.

Fixes https://github.com/rust-lang/rust/issues/34079
Fixes https://github.com/rust-lang/rust/issues/49912
Unblocks https://github.com/rust-lang/rust/pull/62086
Unblocks https://github.com/rust-lang/rust/pull/61000
2019-07-07 17:00:17 +02:00
Vadim Petrochenkov
941653b528 Address review comments + Fix rebase 2019-07-07 13:04:07 +03:00
Vadim Petrochenkov
1ee0ce82cb syntax: Migrate built-in macros to the regular stability checking 2019-07-07 13:04:07 +03:00
Alex Crichton
345ba505ec rustc: Remove dylib crate type from most rustc crates
Now that procedural macros no longer link transitively to libsyntax,
this shouldn't be needed any more! This commit is an experiment in
removing all dynamic libraries from rustc except for librustc_driver
itself. Let's see how far we can get with that!
2019-07-07 03:23:00 +02:00
Jeremy Stucki
47ea8ae022
Remove needless lifetimes 2019-07-01 12:15:27 +02:00
Igor Matuszewski
6c93b47c01 Fix clippy::cast_losless 2019-06-26 14:11:58 +02:00
Igor Matuszewski
12806b7050 Fix clippy::redundant_field_names 2019-06-26 13:59:58 +02:00
Igor Matuszewski
dedcd97e92 Use f{32,64}::from_bits 2019-06-25 23:08:10 +02:00
Julien Cretin
b8106b59d2 Fix meta-variable binding errors in macros
The errors are either:
- The meta-variable used in the right-hand side is not bound (or defined) in the
  left-hand side.
- The meta-variable used in the right-hand side does not repeat with the same
  kleene operator as its binder in the left-hand side. Either it does not repeat
  enough, or it uses a different operator somewhere.

This change should have no semantic impact.
2019-06-23 01:30:41 +02:00
Eduard-Mihai Burtescu
b25b466a88 rustc: remove 'x: 'y bounds (except from comments/strings). 2019-06-18 18:10:21 +03:00
chansuke
db55aafd72 Separate libserialize module 2019-06-16 14:17:01 +03:00
Mazdak Farrokhzad
97df8676b7
Rollup merge of #59600 - tobia:master, r=pnkfelix
Replaced linear token counting macros with optimized implementation

There are currently two distinct token-counting macros in the source. Both implement the trivial algorithm, with linear complexity. They may or may not be adequate for their use case, but considering that other people are probably going to copy and paste them whenever they need a token-counting macro, I replaced them with an optimized implementation with logarithmic complexity.
2019-06-10 13:14:26 +02:00
Eduard-Mihai Burtescu
961fe5479f rustc: use indexmap instead of a plain vector for upvars. 2019-06-01 19:17:22 +03:00
Eduard-Mihai Burtescu
9a2ee0aaef serialize: add missing Encodable impl for Path. 2019-05-07 02:47:45 +03:00
Philipp Hansch
8e5555909c
Allow unused_extern_crates for rustc_libserialize 2019-04-21 10:52:12 +02:00
Tobia
a4a07e00ce Replaced linear token counting macros with optimized implementation 2019-04-13 01:24:10 +09:00
John Kåre Alsaker
223f1c7d1f Remove useless ?Sized bound 2019-04-10 03:58:13 +02:00
John Kåre Alsaker
4ccb9ae98a Impl UseSpecializedDecodable for &T 2019-04-05 00:55:07 +02:00
John Kåre Alsaker
002c70f2d4 Introduce an arena type which may be used to allocate a list of types with destructors 2019-04-05 00:55:07 +02:00
bors
b244f61b77 Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnik
Cosmetic improvements to doc comments

This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase).

r? @steveklabnik

Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-12 19:09:24 +00:00
Mazdak Farrokhzad
308c07bc3b
Rollup merge of #58318 - taiki-e:libserialize-2018, r=Centril
libserialize => 2018

Transitions `libserialize` to Rust 2018; cc #58099

This includes a commit from #58252 (thanks @h-michael!)

r? @Centril
2019-02-12 04:42:24 +01:00
Alexander Regueiro
c3e182cf43 rustc: doc comments 2019-02-10 23:42:32 +00:00
Taiki Endo
06b63046b2 Cleanup imports 2019-02-09 17:13:39 +09:00
Taiki Endo
360e65db7a Move some tests into the tests directory
This moves tests in opaque.rs and tests other than tests that require
private items in json.rs into tests/opaque.rs and tests/json.rs.
2019-02-09 17:12:04 +09:00
Guillaume Gomez
8b886e07f5 Remove images' url to make it work even without internet connection 2019-02-07 11:06:19 +01:00
Hirokazu Hata
94c609ca9a Transition libserialize to 2018 edition 2019-02-07 14:15:07 +09:00
Alexander Regueiro
88336ea4c3 Cosmetic improvements 2019-01-13 19:47:02 +00:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
John Kåre Alsaker
4f30a24e42 Inline tweaks 2018-12-21 12:09:43 +01:00