Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upstd: Stabilize APIs for the 1.10 release #33699
Conversation
rust-highfive
assigned
brson
May 17, 2016
This comment has been minimized.
This comment has been minimized.
|
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
Still working through the tests, but this should have all the real meat. r? @aturon |
rust-highfive
assigned
aturon
and unassigned
brson
May 17, 2016
futile
reviewed
May 18, 2016
| @@ -14,6 +14,8 @@ | |||
|
|
|||
| #[stable(feature = "rust1", since = "1.0.0")] | |||
| pub use self::c_str::{CString, CStr, NulError, IntoStringError}; | |||
| #[stable(feature = "rust1", since = "1.0.0")] | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
futile
reviewed
May 18, 2016
| @@ -37,6 +37,8 @@ use tables::{derived_property, property, general_category, conversions}; | |||
| pub use core::char::{MAX, from_u32, from_u32_unchecked, from_digit}; | |||
| #[stable(feature = "rust1", since = "1.0.0")] | |||
| pub use core::char::{EscapeUnicode, EscapeDefault, EncodeUtf8, EncodeUtf16}; | |||
| #[stable(feature = "rust1", since = "1.0.0")] | |||
This comment has been minimized.
This comment has been minimized.
alexcrichton
force-pushed the
alexcrichton:stabilize-1.10
branch
3 times, most recently
from
2e3600c
to
7c03658
May 18, 2016
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin brings up that |
This comment has been minimized.
This comment has been minimized.
|
I think I like that approach given that there's an obvious and reasonable upper bound on the buffer size. |
This comment has been minimized.
This comment has been minimized.
|
I personally feel that it's inconsistent with how we handle encoding/decoding everywhere else, which is to use a result instead of panicking |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton what APIs and errors are you thinking of, specifically? Providing a buffer smaller than four bytes or two 16-bit units is a different kind of error than, for example, the input containing ill-formed byte sequences. It’s easy to use something like And, as I argued in #27784 (comment), would callers ever do anything other than |
This comment has been minimized.
This comment has been minimized.
|
The major examples are |
This comment has been minimized.
This comment has been minimized.
|
These examples don’t take a caller-provided buffer, so the "buffer too short" kind of error doesn’t happen there. If the caller of |
This comment has been minimized.
This comment has been minimized.
|
Yes they're only analogous in the sense that they don't panic, they return results on encoding/decoding operations. The buffer may not always be controlled by the caller, but some utility function would be given a buffer from elsewhere in which case it'd just always have to perform this validation. Essentially you will 100% of the time need this check for length unless you're calling with a buffer you created yourself, and that's probably not 100% of use cases. |
This comment has been minimized.
This comment has been minimized.
|
Outside of tests, rust-lang/rust currently contains 9 uses of
100% would statically ensure they provide a large enough buffer to (I found zero usage in Servo and its dependencies that I’ve ever checked out. When I really don’t see a scenario where "some utility function given a buffer from elsewhere" would be useful. |
This comment has been minimized.
This comment has been minimized.
|
I agree with @SimonSapin here, a too-short buffer seems reasonable to treat as a contract violation. |
This comment has been minimized.
This comment has been minimized.
|
I'd be pretty uncomfortable stabilizing an API with a brand new name, new semantics, and a new return type all at once. This may also miss the beta branch now and need to be backported. Shall we just leave it out for another round? |
This comment has been minimized.
This comment has been minimized.
|
Ok, I've backed out those API additions, re-r? @aturon |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton I've reviewed the rest of the PR (LGTM), but I don't see the updates backing out these recent additions. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
alexcrichton
force-pushed the
alexcrichton:stabilize-1.10
branch
from
7c03658
to
91e8b4c
May 23, 2016
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
May 23, 2016
This comment has been minimized.
This comment has been minimized.
|
|
alexcrichton
force-pushed the
alexcrichton:stabilize-1.10
branch
from
91e8b4c
to
804f23f
May 23, 2016
This comment has been minimized.
This comment has been minimized.
|
@bors: r=aturon |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
|
bors
added a commit
that referenced
this pull request
May 24, 2016
This comment has been minimized.
This comment has been minimized.
|
|
alexcrichton
force-pushed the
alexcrichton:stabilize-1.10
branch
from
04eff6c
to
cae91d7
May 24, 2016
This comment has been minimized.
This comment has been minimized.
|
@bors: r=aturon |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
May 25, 2016
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@bors: retry Praying that's spurious, I'll open an issue if I see it again |
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
May 25, 2016
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
May 26, 2016
This comment has been minimized.
This comment has been minimized.
bors
merged commit cae91d7
into
rust-lang:master
May 26, 2016
This was referenced May 26, 2016
alexcrichton
deleted the
alexcrichton:stabilize-1.10
branch
May 26, 2016
alexcrichton
added
beta-nominated
beta-accepted
labels
May 26, 2016
This comment has been minimized.
This comment has been minimized.
|
Tagging beta nominated/accepted to ensure we backport |
alexcrichton commentedMay 17, 2016
•
edited
This commit applies the FCP decisions made by the libs team for the 1.10 cycle,
including both new stabilizations and deprecations. Specifically, the list of
APIs is:
Stabilized:
os::windows::fs::OpenOptionsExt::access_modeos::windows::fs::OpenOptionsExt::share_modeos::windows::fs::OpenOptionsExt::custom_flagsos::windows::fs::OpenOptionsExt::attributesos::windows::fs::OpenOptionsExt::security_qos_flagsos::unix::fs::OpenOptionsExt::custom_flagssync::Weak::newDefault for sync::Weakpanic::set_hookpanic::take_hookpanic::PanicInfopanic::PanicInfo::payloadpanic::PanicInfo::locationpanic::Locationpanic::Location::filepanic::Location::lineffi::CStr::from_bytes_with_nulffi::CStr::from_bytes_with_nul_uncheckedffi::FromBytesWithNulErrorfs::Metadata::modifiedfs::Metadata::accessedfs::Metadata::createdsync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchangesync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange_weakcollections::{btree,hash}_map::{Occupied,Vacant,}Entry::keyos::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}SocketAddr::is_unnamedSocketAddr::as_pathnameUnixStream::connectUnixStream::pairUnixStream::try_cloneUnixStream::local_addrUnixStream::peer_addrUnixStream::set_read_timeoutUnixStream::set_write_timeoutUnixStream::read_timeoutUnixStream::write_TimeoutUnixStream::set_nonblockingUnixStream::take_errorUnixStream::shutdownUnixStreamUnixListener::bindUnixListener::acceptUnixListener::try_cloneUnixListener::local_addrUnixListener::set_nonblockingUnixListener::take_errorUnixListener::incomingUnixListenerUnixDatagram::bindUnixDatagram::unboundUnixDatagram::pairUnixDatagram::connectUnixDatagram::try_cloneUnixDatagram::local_addrUnixDatagram::peer_addrUnixDatagram::recv_fromUnixDatagram::recvUnixDatagram::send_toUnixDatagram::sendUnixDatagram::set_read_timeoutUnixDatagram::set_write_timeoutUnixDatagram::read_timeoutUnixDatagram::write_timeoutUnixDatagram::set_nonblockingUnixDatagram::take_errorUnixDatagram::shutdownUnixDatagram{BTree,Hash}Map::values_mut<[_]>::binary_search_by_keyDeprecated:
StaticCondvar- this, and all other static synchronization primitivesbelow, are usable today through the lazy-static crate on
stable Rust today. Additionally, we'd like the non-static
versions to be directly usable in a static context one day,
so they're unlikely to be the final forms of the APIs in any
case.
CONDVAR_INITStaticMutexMUTEX_INITStaticRwLockRWLOCK_INITiter::Peekable::is_emptyCloses #27717
Closes #27720
Closes #30014
Closes #30425
Closes #30449
Closes #31190
Closes #31399
Closes #31767
Closes #32111
Closes #32281
Closes #32312
Closes #32551
Closes #33018