Commit Graph

534 Commits

Author SHA1 Message Date
Ethan Brierley
121e5e806e fix missing borrow 2018-11-25 19:44:09 +00:00
Ethan Brierley
07b97a486f Use a reference rather than take ownership 2018-11-25 19:31:35 +00:00
Simon Sapin
68a26ec647 Stabilize the int_to_from_bytes feature
Fixes #52963
2018-11-25 08:29:01 +01:00
Pietro Albini
0f1c1eb480 Rollup merge of #55828 - oli-obk:promotion_strikes_again, r=eddyb
Add missing `rustc_promotable` attribute to unsigned `min_value` and `max_value`

cc @pnkfelix

fixes #55806
2018-11-11 00:21:23 +01:00
Oliver Scherer
f4c9dd55d6 Add missing rustc_promotable attribute to unsigned min_value and max_value 2018-11-09 17:55:24 +01:00
Ethan Brierley
51e1f5560d add unstable attribute 2018-11-07 08:48:37 +00:00
Ethan Brierley
d0bac148f7 Fix incorrect documentation 2018-11-07 08:38:34 +00:00
Ethan Brierley
11ee29a813 Use method rather than public field 2018-11-07 08:35:28 +00:00
Ethan Brierley
f1a593d116 Document kind field 2018-11-06 09:29:24 +00:00
Ethan Brierley
3dc56b7d9c Fix mistake in my markdown 2018-11-06 08:37:25 +00:00
Ethan Brierley
c3f0c9419e Add very useful documentation 2018-11-06 08:34:30 +00:00
Ethan Brierley
b60efc1574 Continue to try to make travis happy by adding a issue number 2018-11-05 21:57:19 +00:00
Ethan Brierley
420e6413c6 break line to keep travis_fold:start:tidy happy 2018-11-05 21:37:10 +00:00
Ethan Brierley
3b0fc3c309 Add useful attributes 2018-11-05 21:22:45 +00:00
Ethan Brierley
2d1cd9ae80 Make ParseIntError and IntErrorKind fully public 2018-11-05 17:23:34 +00:00
Nikita Popov
4c40ff6a24 Implement rotate using funnel shift on LLVM >= 7
Implement the rotate_left and rotate_right operations using
llvm.fshl and llvm.fshr if they are available (LLVM >= 7).

Originally I wanted to expose the funnel_shift_left and
funnel_shift_right intrinsics and implement rotate_left and
rotate_right on top of them. However, emulation of funnel
shifts requires emitting a conditional to check for zero shift
amount, which is not necessary for rotates. I was uncomfortable
doing that here, as I don't want to rely on LLVM to optimize
away that conditional (and for variable rotates, I'm not sure it
can). We should revisit that question when we raise our minimum
version requirement to LLVM 7 and don't need emulation code
anymore.
2018-11-03 23:50:55 +01:00
Alex Crichton
d0060d72e5 Bump nightly to 1.32.0
* Also update the bootstrap compiler
* Update cargo to 1.32.0
* Clean out stage0 annotations
2018-10-31 11:53:50 -07:00
Oliver Schneider
9e46c0b689 Only promote calls to #[rustc_promotable] const fns 2018-10-03 10:07:05 +02:00
bors
6310be458f Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum
Bump to 1.31.0 and bootstrap from 1.30 beta

Closes #54594.
2018-09-30 01:45:50 +00:00
Josh Stone
ce034951fb Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
csmoe
ac61a9ce21 introduce from_nonzero feature 2018-09-17 16:34:24 +08:00
csmoe
d5c1d15d31 implement From<NonZero<Int>> for Int 2018-09-15 09:34:36 +08:00
Martin Pool
597c06544d Document .0 to unpack the value from Wrapping 2018-09-08 11:35:02 -07:00
Andre Bogus
90b7c5acbc Individual docs for {from,to}_*_bytes 2018-09-05 19:49:57 +02:00
Tim Diekmann
256cf8681e Add const_unstable flag to overflowing_shr 2018-09-03 14:53:05 +02:00
Tim
cdea63058a rebase 2018-09-01 15:05:55 +02:00
Pietro Albini
a245d9bbca Rollup merge of #53476 - GuillaumeGomez:try-from-int-error-partial-eq, r=KodrAus
Add partialeq implementation for TryFromIntError type

Fixes #53458.
2018-08-30 20:15:30 +02:00
Guillaume Gomez
da4febd51e Add partialeq implementation for TryFromIntError type 2018-08-28 20:40:14 +02:00
kennytm
7896ac3e08 Rollup merge of #53363 - llogiq:num-individual-nonzero-docs, r=steveklabnik
add individual docs to `core::num::NonZero*`
2018-08-21 17:51:54 +08:00
Simon Sapin
f5556a6a28 Gratuitous at byte boundaries in hex i32 literals in some doc-tests 2018-08-17 14:01:57 +02:00
Andre Bogus
687cc989ca add individual docs to core::num::NonZero* 2018-08-14 22:18:18 +02:00
Simon Sapin
8defd152b3 {to,from}_{ne,le,be}_bytes for unsigned integer types
Same as https://github.com/rust-lang/rust/pull/51919 did for signed integers.

Tracking issue: https://github.com/rust-lang/rust/issues/52963
2018-08-14 18:46:04 +02:00
Andre Bogus
945f0325e3 Add individual documentation for <integer>.swap_bytes/.reverse_bits 2018-08-10 12:10:07 +02:00
kennytm
9f55705a24 Rollup merge of #53207 - llogiq:num-rotate-docs, r=QuietMisdreavus
Add individual docs for rotate_{left, right}
2018-08-10 01:55:31 +08:00
Andre Bogus
cc2503a4f4 Add individual docs for rotate_{left, right} 2018-08-09 17:10:27 +02:00
varkor
a00ba4d71e Correct invalid feature attributes 2018-08-05 15:54:49 +01:00
Tobias Bucher
0ddfae5ba2 Change tracking issue from #49792 to #51919
The old issue has already been in FCP, a new issue was opened for the
new API.
2018-08-04 08:36:54 +02:00
Tobias Bucher
a04b2cda0b Provide {to,from}_{ne,le,be}_bytes functions on integers
If one doesn't view integers as containers of bytes, converting them to
bytes necessarily needs the specfication of encoding.

I think Rust is a language that wants to be explicit. The `to_bytes`
function is basically the opposite of that – it converts an integer into
the native byte representation, but there's no mention (in the function
name) of it being very much platform dependent. Therefore, I think it
would be better to replace that method by three methods, the explicit
`to_ne_bytes` ("native endian") which does the same thing and
`to_{le,be}_bytes` which return the little- resp. big-endian encoding.
2018-08-03 07:55:10 +02:00
Simon Sapin
f162438fb3 Revert "Stabilize to_bytes and from_bytes for integers."
This reverts commit c8f9b84b39.
2018-07-30 11:55:20 +02:00
bors
0ad8f9e5b1 Auto merge of #51395 - SimonSapin:repr-transparent, r=SimonSapin
Add #[repr(transparent)] to some libcore types

* `UnsafeCell`
* `Cell`
* `NonZero*`
* `NonNull`
* `Unique`

CC https://github.com/rust-lang/rust/issues/43036
2018-07-04 16:21:42 +00:00
bors
0fb6e3994f Auto merge of #51564 - SimonSapin:try-int, r=alexcrichton
Implement always-fallible TryFrom for usize/isize conversions that are infallible on some platforms

This reverts commit 837d6c7023 "Remove TryFrom impls that might become conditionally-infallible with a portability lint".

This fixes #49415 by adding (restoring) missing `TryFrom` impls for integer conversions to or from `usize` or `isize`, by making them always fallible at the type system level (that is, with `Error=TryFromIntError`) even though they happen to be infallible on some platforms (for some values of `size_of::<usize>()`).

They had been removed to allow the possibility to conditionally having some of them be infallible `From` impls instead, depending on the platforms, and have the [portability lint](https://github.com/rust-lang/rfcs/pull/1868) warn when they are used in code that is not already opting into non-portability. For example `#[allow(some_lint)] usize::from(x: u64)` would be valid on code that only targets 64-bit platforms.

This PR gives up on this possiblity for two reasons:

* Based on discussion with @aturon, it seems that the portability lint is not happening any time soon. It’s better to have the conversions be available *at all* than keep blocking them for so long. Portability-lint-gated platform-specific APIs can always be added separately later.

* For code that is fine with fallibility, the alternative would force it to opt into "non-portability" even though there would be no real portability issue.
2018-07-03 04:08:02 +00:00
Mark Simulacrum
ad97f8b491 Bootstrap from 1.28.0-beta.3 2018-06-30 13:17:49 -07:00
Thayne McCombs
c8f9b84b39 Stabilize to_bytes and from_bytes for integers.
Fixes #49792
2018-06-26 23:17:56 -06:00
Simon Sapin
530d7bc517 Add #[repr(transparent)] to some libcore types
* `UnsafeCell`
* `Cell`
* `NonZero*`
* `NonNull`
* `Unique`
2018-06-16 18:25:15 +02:00
Andre Bogus
553a44a5cc add some docs to conversions 2018-06-10 13:16:34 +02:00
Simon Sapin
5c7ca77b17 Make the size of Option<NonZero*> a documented guarantee.
Closes #49137, the tracking issue for `NonZero*`,
as this was the last remaining open question.

Note that `ptr::NonNull<T>` already documents a similar guarantee.
2018-06-06 13:58:09 +02:00
Simon Sapin
e7c122c5b5 Revert "Remove TryFrom impls that might become conditionally-infallible with a portability lint"
This reverts commit 837d6c7023.

Fixes https://github.com/rust-lang/rust/issues/49415
2018-06-06 13:52:22 +02:00
Linus Färnstrand
8a27c19c92 Make integer methods non-const in stage0 2018-06-02 13:57:31 +02:00
Linus Färnstrand
1b9ab8939e Make most integer operations const fns 2018-06-02 12:03:10 +02:00
bors
2954cb5119 Auto merge of #50554 - clarcharr:from_bool, r=TimNN
Add From<bool> for int types

Fixes #46109.
2018-06-02 07:50:10 +00:00