編譯型編程語言Rust v1.9.0 發布

Rust是一個由Mozilla主導開發的通用、編譯型編程語言。它的設計準則為“安全,并發,實用”,支持函數式,并發式,過程式以及面向對象的編程風格。Rust 的設計目標之一,是要使設計大型的互聯網客戶端和服務器的任務變得更容易。因此更加強調安全性、內存配置、以及并發處理等方面的特性。在性能上,具有額外安全保證的代碼會比 C++ 慢一些,但是如果以 C++ 也手工提供保證的情況下,則兩者性能上是相似的。
更新日志
語言
- The
#[deprecated]attribute when applied to an API will generate warnings when used. The warnings may be suppressed with#[allow(deprecated)]. RFC 1270. fnitem types are zero sized, and eachfnnames a unique type. This will break code that transmutesfns, so callingtransmuteon afntype will generate a warning for a few cycles, then will be converted to an error.- Field and method resolution understand visibility, so private fields and methods cannot prevent the proper use of public fields and methods.
- The parser considers unicode codepoints in the
PATTERN_WHITE_SPACEcategory to be whitespace.
穩定的APIs
std::panicstd::panic::catch_unwind(renamed fromrecover)std::panic::resume_unwind(renamed frompropagate)std::panic::AssertUnwindSafe(renamed fromAssertRecoverSafe)std::panic::UnwindSafe(renamed fromRecoverSafe)str::is_char_boundary<*const T>::as_ref<*mut T>::as_ref<*mut T>::as_mutAsciiExt::make_ascii_uppercaseAsciiExt::make_ascii_lowercasechar::decode_utf16char::DecodeUtf16char::DecodeUtf16Errorchar::DecodeUtf16Error::unpaired_surrogateBTreeSet::takeBTreeSet::replaceBTreeSet::getHashSet::takeHashSet::replaceHashSet::getOsString::with_capacityOsString::clearOsString::capacityOsString::reserveOsString::reserve_exactOsStr::is_emptyOsStr::lenstd::os::unix::threadRawPthreadJoinHandleExtJoinHandleExt::as_pthread_tJoinHandleExt::into_pthread_tHashSet::hasherHashMap::hasherCommandExt::execFile::try_cloneSocketAddr::set_ipSocketAddr::set_portSocketAddrV4::set_ipSocketAddrV4::set_portSocketAddrV6::set_ipSocketAddrV6::set_portSocketAddrV6::set_flowinfoSocketAddrV6::set_scope_idslice::copy_from_sliceptr::read_volatileptr::write_volatileOpenOptions::create_newTcpStream::set_nodelayTcpStream::nodelayTcpStream::set_ttlTcpStream::ttlTcpStream::set_only_v6TcpStream::only_v6TcpStream::take_errorTcpStream::set_nonblockingTcpListener::set_ttlTcpListener::ttlTcpListener::set_only_v6TcpListener::only_v6TcpListener::take_errorTcpListener::set_nonblockingUdpSocket::set_broadcastUdpSocket::broadcastUdpSocket::set_multicast_loop_v4UdpSocket::multicast_loop_v4UdpSocket::set_multicast_ttl_v4UdpSocket::multicast_ttl_v4UdpSocket::set_multicast_loop_v6UdpSocket::multicast_loop_v6UdpSocket::set_multicast_ttl_v6UdpSocket::multicast_ttl_v6UdpSocket::set_ttlUdpSocket::ttlUdpSocket::set_only_v6UdpSocket::only_v6UdpSocket::join_multicast_v4UdpSocket::join_multicast_v6UdpSocket::leave_multicast_v4UdpSocket::leave_multicast_v6UdpSocket::take_errorUdpSocket::connectUdpSocket::sendUdpSocket::recvUdpSocket::set_nonblocking
庫
std::sync::Onceis poisoned if its initialization function fails.cell::Refandcell::RefMutcan contain unsized types.- Most types implement
fmt::Debug. - The default buffer size used by
BufReaderandBufWriterwas reduced to 8K, from 64K. This is in line with the buffer size used by other languages. Instant,SystemTimeandDurationimplement+=and-=.Durationadditionally implements*=and/=.Skipis aDoubleEndedIterator.From<[u8; 4]>is implemented forIpv4Addr.ChainimplementsBufRead.HashMap,HashSetand iterators are covariant.
Cargo
- Cargo can now run concurrently.
- Top-level overrides allow specific revisions of crates to be overridden through the entire crate graph. This is intended to make upgrades easier for large projects, by allowing crates to be forked temporarily until they've been upgraded and republished.
- Cargo exports a
CARGO_PKG_AUTHORSenvironment variable. - Cargo will pass the contents of the
RUSTFLAGSvariable torustcon the commandline.rustcarguments can also be specified in thebuild.rustflagsconfiguration key.
性能
- The time complexity of comparing variables for equivalence during type unification is reduced from O(n!) to O(n). This leads to major compilation time improvement in some scenarios.
ToStringis specialized forstr, giving it the same performance asto_owned.- Spawning processes with
Command::outputno longer creates extra threads. #[derive(PartialEq)]and#[derive(PartialOrd)]emit less code for C-like enums.
Misc
- Passing the
--quietflag to a test runner will produce much-abbreviated output. - The Rust Project now publishes std binaries for the
mips-unknown-linux-musl,mipsel-unknown-linux-musl, andi586-pc-windows-msvctargets.
兼容說明
std::sync::Onceis poisoned if its initialization function fails.- It is illegal to define methods with the same name in overlapping inherent
implblocks. fnitem types are zero sized, and eachfnnames a unique type. This will break code that transmutesfns, so callingtransmuteon afntype will generate a warning for a few cycles, then will be converted to an error.- Improvements to const evaluation may trigger new errors when integer literals are out of range.
下載
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!