about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-03 04:08:02 +0000
committerbors <bors@rust-lang.org>2018-07-03 04:08:02 +0000
commit0fb6e3994fc1091144dc4338d3509a9cc1bcb100 (patch)
tree1a192936e8f76ff1ee2b405adcfe8d7bb81fe7f5 /src/libstd/sys/unix/stack_overflow.rs
parent81d5c3e78374df15c40f463cef27918a80f3b234 (diff)
parente7c122c5b58d4db2262b1f4325d9fe82d1423ad8 (diff)
downloadrust-0fb6e3994fc1091144dc4338d3509a9cc1bcb100.tar.gz
rust-0fb6e3994fc1091144dc4338d3509a9cc1bcb100.zip
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 837d6c70233715a0ae8e15c703d40e3046a2f36a "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.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions