Releases: rust-lang/rust
Releases · rust-lang/rust
Rust 1.13.0
Language
- Stabilize the
?operator.?is a simple way to propagate errors, like thetry!macro, described in RFC 0243. - Stabilize macros in type position. Described in RFC 873.
- Stabilize attributes on statements. Described in RFC 0016.
- Fix
#[derive]for empty tuple structs/variants - Fix lifetime rules for 'if' conditions
- Avoid loading and parsing unconfigured non-inline modules
Compiler
- Add the
-C link-argargument - Remove the old AST-based backend from rustc_trans
- Don't enable NEON by default on armv7 Linux
- Fix debug line number info for macro expansions
- Do not emit "class method" debuginfo for types that are not DICompositeType
- Warn about multiple conflicting #[repr] hints
- When sizing DST, don't double-count nested struct prefixes
- Default RUST_MIN_STACK to 16MiB for now
- Improve rlib metadata format. Reduces rlib size significantly.
- Reject macros with empty repetitions to avoid infinite loop
- Expand macros without recursing to avoid stack overflows
Diagnostics
- Replace macro backtraces with labeled local uses
- Improve error message for misplaced doc comments
- Buffer unix and lock windows to prevent message interleaving
- Update lifetime errors to specifically note temporaries
- Special case a few colors for Windows
- Suggest
use selfwhen such an import resolves - Be more specific when type parameter shadows primitive type
- Many minor improvements
Compile-time Optimizations
- Compute and cache HIR hashes at beginning
- Don't hash types in loan paths
- Cache projections in trans
- Optimize the parser's last token handling
- Only instantiate #[inline] functions in codegen units referencing them. This leads to big improvements in cases where crates export define many inline functions without using them directly.
- Lazily allocate TypedArena's first chunk
- Don't allocate during default HashSet creation
Stabilized APIs
Libraries
- Add
assert_ne!anddebug_assert_ne! - Make
vec_deque::Drain,hash_map::Drain, andhash_set::Draincovariant - Implement
AsRef<[T]>forstd::slice::Iter - Implement
Debugforstd::vec::IntoIter CString: avoid excessive growth just to 0-terminate- Implement
CoerceUnsizedfor{Cell, RefCell, UnsafeCell} - Use arc4rand on FreeBSD
- memrchr: Correct aligned offset computation
- Improve Demangling of Rust Symbols
- Use monotonic time in condition variables
- Implement
Debugforstd::path::{Components,Iter} - Implement conversion traits for
char - Fix illegal instruction caused by overflow in channel cloning
- Zero first byte of CString on drop
- Inherit overflow checks for sum and product
- Add missing Eq implementations
- Implement
DebugforDirEntry - When
getaddrinforeturnsEAI_SYSTEMretrieve actual error fromerrno SipHasheris deprecated. UseDefaultHasher.- Implement more traits for
std::io::ErrorKind - Optimize BinaryHeap bounds checking
- Work around pointer aliasing issue in
Vec::extend_from_slice,extend_with_element - Fix overflow checking in unsigned pow()
Cargo
- This release includes security fixes to both curl and OpenSSL.
- Fix transitive doctests when panic=abort
- Add --all-features flag to cargo
- Reject path-based dependencies in
cargo package - Don't parse the home directory more than once
- Don't try to generate Cargo.lock on empty workspaces
- Update OpenSSL to 1.0.2j
- Add license and license_file to cargo metadata output
- Make crates-io registry URL optional in config; ignore all changes to source.crates-io
- Don't download dependencies from other platforms
- Build transitive dev-dependencies when needed
- Add support for per-target rustflags in .cargo/config
- Avoid updating registry when adding existing deps
- Warn about path overrides that won't work
- Use workspaces during
cargo install - Leak mspdbsrv.exe processes on Windows
- Add --message-format flag
- Pass target environment for rustdoc
- Use
CommandExt::execforcargo runon Unix - Update curl and curl-sys
- Call rustdoc test with the correct cfg flags of a package
Tooling
- rustdoc: Add the
--sysrootargument - rustdoc: Fix a couple of issues with the search results
- rustdoc: remove the
!from macro URLs and titles - gdb: Fix pretty-printing special-cased Rust types
- rustdoc: Filter more incorrect methods inherited through Deref
Misc
- Remove unmaintained style guide
- Add s390x support
- Initial work at Haiku OS support
- Add mips-uclibc targets
- Crate-ify compiler-rt into compiler-builtins
- Add rustc version info (git hash + date) to dist tarball
- Many documentation improvements
Compatibility Notes
SipHasheris deprecated. UseDefaultHasher.- Deny (by default) transmuting from fn item types to pointer-sized types. Continuing the long transition to zero-sized fn items, per [RFC 401](https://github.com/rust-lang/rfcs/blob/master/text/0...
Rust 1.12.1
Regression Fixes
- ICE: 'rustc' panicked at 'assertion failed: concrete_substs.is_normalized_for_trans()' #36381
- Confusion with double negation and booleans
- rustc 1.12.0 fails with SIGSEGV in release mode (syn crate 0.8.0)
- Rustc 1.12.0 Windows build of
ethcorecrate fails with LLVM error - 1.12.0: High memory usage when linking in release mode with debug info
- Corrupted memory after updated to 1.12
- "Let NullaryConstructor = something;" causes internal compiler error: "tried to overwrite interned AdtDef"
- Fix ICE: inject bitcast if types mismatch for invokes/calls/stores
- debuginfo: Handle spread_arg case in MIR-trans in a more stable way.
Rust 1.12.0
Highlights
rustctranslates code to LLVM IR via its own "middle" IR (MIR). This translation pass is far simpler than the previous AST->LLVM pass, and creates opportunities to perform new optimizations directly on the MIR. It was previously described on the Rust blog.rustcpresents a new, more readable error format, along with machine-readable JSON error output for use by IDEs. Most common editors supporting Rust have been updated to work with it. It was previously described on the Rust blog.
Compiler
rustctranslates code to LLVM IR via its own "middle" IR (MIR). This translation pass is far simpler than the previous AST->LLVM pass, and creates opportunities to perform new optimizations directly on the MIR. It was previously described on the Rust blog.- Print the Rust target name, not the LLVM target name, with
--print target-list - The computation of
TypeIdis correct in some cases where it was previously producing inconsistent results - The
mips-unknown-linux-gnutarget uses hardware floating point by default - The
rustcarguments,--print target-cpus,--print target-features,--print relocation-models, and--print code-modelsprint the available options to the-C target-cpu,-C target-feature,-C relocation-modeland-C code-modelcode generation arguments rustcsupports three new MUSL targets on ARM:arm-unknown-linux-musleabi,arm-unknown-linux-musleabihf, andarmv7-unknown-linux-musleabihf. These targets produce statically-linked binaries. There are no binary release builds yet though.
Diagnostics
rustcpresents a new, more readable error format, along with machine-readable JSON error output for use by IDEs. Most common editors supporting Rust have been updated to work with it. It was previously described on the Rust blog.- In error descriptions, references are now described in plain English, instead of as "&-ptr"
- In error type descriptions, unknown numeric types are named
{integer}or{float}instead of_ rustcemits a clearer error when inner attributes follow a doc comment
Language
macro_rules!invocations can be made withinmacro_rules!invocationsmacro_rules!meta-variables are hygienicmacro_rules!ttmatchers can be reparsed correctly, making them much more usefulmacro_rules!stmtmatchers correctly consume the entire contents when inside non-braces invocations- Semicolons are properly required as statement delimiters inside
macro_rules!invocations cfg_attrworks onpathattributes
Stabilized APIs
Cell::as_ptrRefCell::as_ptrIpAddr::is_unspecifiedIpAddr::is_loopbackIpAddr::is_multicastIpv4Addr::is_unspecifiedIpv6Addr::octetsLinkedList::containsVecDeque::containsExitStatusExt::from_raw. Both on Unix and Windows.Receiver::recv_timeoutRecvTimeoutErrorBinaryHeap::peek_mutPeekMutiter::Productiter::SumOccupiedEntry::remove_entryVacantEntry::into_key
Libraries
- The
format!macro and friends now allow a single argument to be formatted in multiple styles - The lifetime bounds on
[T]::binary_search_byand[T]::binary_search_by_keyhave been adjusted to be more flexible OptionimplementsFromfor its contained typeCell,RefCellandUnsafeCellimplementFromfor their contained typeRwLockpanics if the reader count overflowsvec_deque::Drain,hash_map::Drainandhash_set::Drainare covariantvec::Drainandbinary_heap::Drainare covariantCow<str>implementsFromIteratorforchar,&strandString- Sockets on Linux are correctly closed in subprocesses via
SOCK_CLOEXEC hash_map::Entry,hash_map::VacantEntryandhash_map::OccupiedEntryimplementDebugbtree_map::Entry,btree_map::VacantEntryandbtree_map::OccupiedEntryimplementDebugStringimplementsAddAssign- Variadic
extern fnpointers implement theClone,PartialEq,Eq,PartialOrd,Ord,Hash,fmt::Pointer, andfmt::Debugtraits FileTypeimplementsDebug- References to
MutexandRwLockare unwind-safe mpsc::sync_channelReceivers return any available message before reporting a disconnect- Unicode definitions have been updated to 9.0
enviterators implementDoubleEndedIterator
Cargo
- Support local mirrors of registries
- Add support for command aliases
- Allow
opt-level="s"/opt-level="z"in profile overrides - Make
cargo doc --open --targetwork as expected - Speed up noop registry updates
- Update OpenSSL
- Fix
--panic=abortwith plugins - Always pass
-C metadatato the compiler - Fix depending on git repos with workspaces
- Add a
--libflag tocargo new - Add
http.cainfofor custom certs - Indicate the compilation profile after compiling
- Allow enabling features for dependencies with
--features - Add
--jobsflag tocargo package - Add
--dry-runtocargo publish - Add support for
RUSTDOCFLAGS
Performance
panic::catch_unwindis more optimizedpanic::catch_unwindno longer accesses thread-local storage on entry
Tooling
- Test binaries now support a
--test-threadsargument to specify the number of threads used to run tests, and which acts the same as theRUST_TEST_THREADSenvironment variable - The test runner now emits a warning when tests run over 60 seconds
- rustdoc: Fix methods in search results
rust-lldbwarns about unsupported versions of LLDB- [Rust releases now come with source p...
Rust 1.11.0
Language
- Support nested
cfg_attrattributes - Allow statement-generating braced macro invocations at the end of blocks
- Macros can be expanded inside of trait definitions
#[macro_use]works properly when it is itself expanded from a macro
Stabilized APIs
BinaryHeap::appendBTreeMap::appendBTreeMap::split_offBTreeSet::appendBTreeSet::split_offf32::to_degrees(in libcore - previously stabilized in libstd)f32::to_radians(in libcore - previously stabilized in libstd)f64::to_degrees(in libcore - previously stabilized in libstd)f64::to_radians(in libcore - previously stabilized in libstd)Iterator::sumIterator::productCell::get_mutRefCell::get_mut
Libraries
- The
thread_local!macro supports multiple definitions in a single invocation, and can apply attributes CowimplementsDefaultWrappingimplements binary, octal, lower-hex and upper-hexDisplayformatting- The range types implement
Hash lookup_hostignores unknown address typesassert_eq!accepts a custom error message, likeassert!does- The main thread is now called "main" instead of "<main>"
Cargo
- Disallow specifying features of transitive deps
- Add color support for Windows consoles
- Fix
harness = falseon[lib]sections - Don't panic when
linkscontains a '.' - Build scripts can emit warnings, and
-vvprints warnings for all crates. - Ignore file locks on OS X NFS mounts
- Don't warn about
package.metadatakeys. This provides room for expansion by arbitrary tools. - Add support for cdylib crate types
- Prevent publishing crates when files are dirty
- Don't fetch all crates on clean
- Propagate --color option to rustc
- Fix
cargo doc --openon Windows - Improve autocompletion
- Configure colors of stderr as well as stdout
Performance
- Caching projections speeds up type check dramatically for some workloads
- The default
HashMaphasher is SipHash 1-3 instead of SipHash 2-4 This hasher is faster, but is believed to provide sufficient protection from collision attacks. - Comparison of
Ipv4Addris 10x faster
Rustdoc
- Fix empty implementation section on some module pages
- Fix inlined renamed re-exports in import lists
- Fix search result layout for enum variants and struct fields
- Fix issues with source links to external crates
- Fix redirect pages for renamed re-exports
Tooling
- rustc is better at finding the MSVC toolchain
- When emitting debug info, rustc emits frame pointers for closures, shims and glue, as it does for all other functions
- rust-lldb warns about unsupported versions of LLDB
- Many more errors have been given error codes and extended explanations
- API documentation continues to be improved, with many new examples
Misc
- rustc no longer hangs when dependencies recursively re-export submodules
- rustc requires LLVM 3.7+
- The 'How Safe and Unsafe Interact' chapter of The Rustonomicon was rewritten
- rustc support 16-bit pointer sizes. No targets use this yet, but it works toward AVR support.
Compatibility Notes
consts andstatics may not have unsized types- The new follow-set rules that place restrictions on
macro_rules!in order to ensure syntax forward-compatibility have been enabled This was an amendment to RFC 550, and has been a warning since 1.10. cfgattribute process has been refactored to fix various bugs. This causes breakage in some corner cases.
Rust 1.10.0
Language
Copytypes are required to have a trivial implementation ofClone. RFC 1521.- Single-variant enums support the
#[repr(..)]attribute. - Fix
#[derive(RustcEncodable)]in the presence of otherencodemethods. panic!can be converted to a runtime abort with the-C panic=abortflag. RFC 1513.- Add a new crate type, 'cdylib'. cdylibs are dynamic libraries suitable for loading by non-Rust hosts. RFC 1510. Note that Cargo does not yet directly support cdylibs.
Stabilized APIs
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::shutdown- Read/Write/RawFd impls for
UnixStream UnixListener::bindUnixListener::acceptUnixListener::try_cloneUnixListener::local_addrUnixListener::set_nonblockingUnixListener::take_errorUnixListener::incoming- RawFd impls for
UnixListener UnixDatagram::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::shutdown- RawFd impls for
UnixDatagram {BTree,Hash}Map::values_mut<[_]>::binary_search_by_key
Libraries
- The
abs_submethod of floats is deprecated. The semantics of this minor method are subtle and probably not what most people want. - Add implementation of Ord for Cell and RefCell where T: Ord.
- On Linux, if
HashMaps can't be initialized withgetrandomthey will fall back to/dev/urandomtemporarily to avoid blocking during early boot. - Implemented negation for wrapping numerals.
- Implement
Cloneforbinary_heap::IntoIter. - Implement
DisplayandHashforstd::num::Wrapping. - Add
Defaultimplementation for&CStr,CString. - Implement
From<Vec<T>>andInto<Vec<T>>forVecDeque<T>. - Implement
DefaultforUnsafeCell,fmt::Error,Condvar,Mutex,RwLock.
Cargo
- Cargo.toml supports the
profile.*.panicoption. This controls the runtime behavior of thepanic!macro and can be either "unwind" (the default), or "abort". RFC 1513. - Don't throw away errors with
-parguments. - Report status to stderr instead of stdout.
- Build scripts are passed a
CARGO_MANIFEST_LINKSenvironment variable that corresponds to thelinksfield of the manifest. - Ban keywords from crate names.
- Canonicalize
CARGO_HOMEon Windows. - Retry network requests. By default they are retried twice, which can be customized with the
net.retryvalue in.cargo/config. - [Don't print extra error info for failing subcommands](rust-lang/cargo#267...
Rust 1.9.0
Language
- 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.
Stabilized 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_error- [`UdpSocket:...
Rust 1.8.0
Language
- Rust supports overloading of compound assignment statements like
+=by implementing theAddAssign,SubAssign,MulAssign,DivAssign,RemAssign,BitAndAssign,BitOrAssign,BitXorAssign,ShlAssign, orShrAssigntraits. RFC 953. - Empty structs can be defined with braces, as in
struct Foo { }, in addition to the non-braced form,struct Foo;. RFC 218.
Libraries
- Stabilized APIs:
str::encode_utf16(renamed fromutf16_units)str::EncodeUtf16(renamed fromUtf16Units)Ref::mapRefMut::mapptr::drop_in_placetime::Instanttime::SystemTimeInstant::nowInstant::duration_since(renamed fromduration_from_earlier)Instant::elapsedSystemTime::nowSystemTime::duration_since(renamed fromduration_from_earlier)SystemTime::elapsed- Various
Add/Subimpls forTimeandSystemTime SystemTimeErrorSystemTimeError::duration- Various impls for
SystemTimeError UNIX_EPOCHAddAssign,SubAssign,MulAssign,DivAssign,RemAssign,BitAndAssign,BitOrAssign,BitXorAssign,ShlAssign,ShrAssign.
- The
write!andwriteln!macros correctly emit errors if any of their arguments can't be formatted. - Various I/O functions support large files on 32-bit Linux.
- The Unix-specific
rawmodules, which contain a number of redefined C types are deprecated, includingos::raw::unix,os::raw::macos, andos::raw::linux. These modules defined types such asino_tanddev_t. The inconsistency of these definitions across platforms was making it difficult to implementstdcorrectly. Those that need these definitions should use thelibccrate. RFC 1415. - The Unix-specific
MetadataExttraits, includingos::unix::fs::MetadataExt, which expose values such as inode numbers no longer return platform-specific types, but instead return widened integers. RFC 1415. btree_set::{IntoIter, Iter, Range}are covariant.- Atomic loads and stores are not volatile.
- All types in
sync::mpscimplementfmt::Debug.
Performance
- Inlining hash functions lead to a 3% compile-time improvement in some workloads.
- When using jemalloc, its symbols are unprefixed so that it overrides the libc malloc implementation. This means that for rustc, LLVM is now using jemalloc, which results in a 6% compile-time improvement on a specific workload.
- Avoid quadratic growth in function size due to cleanups.
Misc
- 32-bit MSVC builds finally implement unwinding. i686-pc-windows-msvc is now considered a tier-1 platform.
- The
--print targetsflag prints a list of supported targets. - The
--print cfgflag prints thecfgs defined for the current target. rustccan be built with an new Cargo-based build system, written in Rust. It will eventually replace Rust's Makefile-based build system. To enable it configure withconfigure --rustbuild.- Errors for non-exhaustive
matchpatterns now list up to 3 missing variants while also indicating the total number of missing variants if more than 3. - Executable stacks are disabled on Linux and BSD.
- The Rust Project now publishes binary releases of the standard library for a number of tier-2 targets:
armv7-unknown-linux-gnueabihf,powerpc-unknown-linux-gnu,powerpc64-unknown-linux-gnu,powerpc64le-unknown-linux-gnux86_64-rumprun-netbsd. These can be installed with tools such as multirust.
Cargo
cargo initcreates a new Cargo project in the current directory. It is otherwise likecargo new.- Cargo has configuration keys for
-vand--color.verboseandcolor, respectively, go in the[term]section of.cargo/config. - Configuration keys that evaluate to strings or integers can be set via environment variables. For example the
build.jobskey can be set viaCARGO_BUILD_JOBS. Environment variables take precedence over config files. - Target-specific dependencies support Rust
cfgsyntax for describing targets so that dependencies for multiple targets can be specified together. RFC 1361. - The environment variables
CARGO_TARGET_ROOT,RUSTC, andRUSTDOCtake precedence over thebuild.target-dir,build.rustc, andbuild.rustdocconfiguration values. - The child process tree is killed on Windows when Cargo is killed.
- The
build.targetconfiguration value sets the target platform, like--target.
Compatibility Notes
- Unstable compiler flags have been further restricted. Since 1.0
-Zflags have been considered unstable, and other flags that were considered unstable additionally required passing-Z unstable-optionsto access. Unlike unstable language and library features though, these options have been accessible on the stable release channel. Going forward, new unstable flags will not be available on the stable release channel, and old unstable flags will warn about their usage. In the future, all unstable flags will be unavailable on the stable release channel. - It is no longer possible to
matchon empty enum variants using theVariant(..)syntax. This has been a warning since 1.6. - The Unix-specific
MetadataExttraits, includingos::unix::fs::MetadataExt, which expose values such as inode numbers no longer return platform-specific types, but instead return widened integers. RFC 1415. - Modules sourced from the filesystem cannot appear within arbitrary blocks, but only within other modules.
--cfgcompiler flags are parsed strictly as identifiers.- On Unix, [stack overflow triggers a runtime abort instead...
Rust 1.7.0
Libraries
- Stabilized APIs
PathPath::strip_prefix(renamed from relative_from)path::StripPrefixError(new error type returned from strip_prefix)
Ipv4AddrIpv6AddrVecString- Slices
<[T]>::clone_from_slice, which now requires the two slices to be the same length<[T]>::sort_by_key
- checked, saturated, and overflowing operations
i32::checked_rem,i32::checked_neg,i32::checked_shl,i32::checked_shri32::saturating_muli32::overflowing_add,i32::overflowing_sub,i32::overflowing_mul,i32::overflowing_divi32::overflowing_rem,i32::overflowing_neg,i32::overflowing_shl,i32::overflowing_shru32::checked_rem,u32::checked_neg,u32::checked_shl,u32::checked_shlu32::saturating_mulu32::overflowing_add,u32::overflowing_sub,u32::overflowing_mul,u32::overflowing_divu32::overflowing_rem,u32::overflowing_neg,u32::overflowing_shl,u32::overflowing_shr- and checked, saturated, and overflowing operations for other primitive types
- FFI
ffi::IntoStringErrorCString::into_stringCString::into_bytesCString::into_bytes_with_nulFrom<CString> for Vec<u8>
IntoStringErrorIntoStringError::into_cstringIntoStringError::utf8_errorError for IntoStringError
- Hashing
- Validating UTF-8 is faster by a factor of between 7 and 14x for ASCII input. This means that creating
Strings andstrs from bytes is faster. - The performance of
LineWriter(and thusio::stdout) was improved by usingmemchrto search for newlines. f32::to_degreesandf32::to_radiansare stable. Thef64variants were stabilized previously.BTreeMapwas rewritten to use less memory and improve the performance of insertion and iteration, the latter by as much as 5x.BTreeSetand its iterators,Iter,IntoIter, andRangeare covariant over their contained type.LinkedListand its iterators,IterandIntoIterare covariant over their contained type.str::replacenow accepts aPattern, like other string searching methods.Anyis implemented for unsized types.Hashis implemented forDuration.
Misc
- When running tests with
--test, rustdoc will pass--cfgarguments to the compiler. - The compiler is built with RPATH information by default. This means that it will be possible to run
rustcwhen installed in unusual configurations without configuring the dynamic linker search path explicitly. rustcpasses--enable-new-dtagsto GNU ld. This makes any RPATH entries (emitted with-C rpath) not take precedence overLD_LIBRARY_PATH.
Cargo
cargo rustcaccepts a--profileflag that runsrustcunder any of the compilation profiles, 'dev', 'bench', or 'test'.- The
rerun-if-changedbuild script directive no longer causes the build script to incorrectly run twice in certain scenarios.
Compatibility Notes
- Soundness fixes to the interactions between associated types and lifetimes, specified in RFC 1214, now generate errors for code that violates the new rules. This is a significant change that is known to break existing code, so it has emitted warnings for the new error cases since 1.4 to give crate authors time to adapt. The details of what is changing are subtle; read the RFC for more.
- Several bugs in the compiler's visibility calculations were fixed. Since this was found to br...
Rust 1.6.0
Language
- The
#![no_std]attribute causes a crate to not be linked to the standard library, but only the core library, as described in RFC 1184. The core library defines common types and traits but has no platform dependencies whatsoever, and is the basis for Rust software in environments that cannot support a full port of the standard library, such as operating systems. Most of the core library is now stable.
Libraries
- Stabilized APIs:
Read::read_exact,ErrorKind::UnexpectedEof(renamed fromUnexpectedEOF),fs::DirBuilder,fs::DirBuilder::new,fs::DirBuilder::recursive,fs::DirBuilder::create,os::unix::fs::DirBuilderExt,os::unix::fs::DirBuilderExt::mode,vec::Drain,vec::Vec::drain,string::Drain,string::String::drain,vec_deque::Drain,vec_deque::VecDeque::drain,collections::hash_map::Drain,collections::hash_map::HashMap::drain,collections::hash_set::Drain,collections::hash_set::HashSet::drain,collections::binary_heap::Drain,collections::binary_heap::BinaryHeap::drain,Vec::extend_from_slice(renamed frompush_all),Mutex::get_mut,Mutex::into_inner,RwLock::get_mut,RwLock::into_inner,Iterator::min_by_key(renamed frommin_by),Iterator::max_by_key(renamed frommax_by). - The core library is stable, as are most of its APIs.
- The
assert_eq!macro supports arguments that don't implementSized, such as arrays. In this way it behaves more likeassert!. - Several timer functions that take duration in milliseconds are deprecated in favor of those that take
Duration. These includeCondvar::wait_timeout_ms,thread::sleep_ms, andthread::park_timeout_ms. - The algorithm by which
Vecreserves additional elements was tweaked to not allocate excessive space while still growing exponentially. Fromconversions are implemented from integers to floats in cases where the conversion is lossless. Thus they are not implemented for 32-bit ints tof32, nor for 64-bit ints tof32orf64. They are also not implemented forisizeandusizebecause the implementations would be platform-specific.Fromis also implemented fromf32tof64.From<&Path>andFrom<PathBuf>are implemented forCow<Path>.From<T>is implemented forBox<T>,Rc<T>andArc<T>.IntoIteratoris implemented for&PathBufand&Path.BinaryHeapwas refactored for modest performance improvements.- Sorting slices that are already sorted is 50% faster in some cases.
Cargo
- Cargo will look in
$CARGO_HOME/binfor subcommands by default. - Cargo build scripts can specify their dependencies by emitting the
rerun-if-changedkey. - crates.io will reject publication of crates with dependencies that have a wildcard version constraint. Crates with wildcard dependencies were seen to cause a variety of problems, as described in RFC 1241. Since 1.5 publication of such crates has emitted a warning.
cargo cleanaccepts a--releaseflag to clean the release folder. A variety of artifacts that Cargo failed to clean are now correctly deleted.
Misc
- The
unreachable_codelint warns when a function call's argument diverges. - The parser indicates failures that may be caused by confusingly-similar Unicode characters
- Certain macro errors are reported at definition time, not expansion.
Compatibility Notes
- The compiler no longer makes use of the
RUST_PATHenvironment variable when locating crates. This was a pre-cargo feature for integrating with the package manager that was accidentally never removed. - A number of bugs were fixed in the privacy checker that could cause previously-accepted code to break.
- Modules and unit/tuple structs may not share the same name.
- Bugs in pattern matching unit structs were fixed. The tuple struct pattern syntax (
Foo(..)) can no longer be used to match unit structs. This is a warning now, but will become an error in future releases. Patterns that share the same name as a const are now an error. - A bug was fixed that causes rustc not to apply default type parameters when resolving certain method implementations of traits defined in other crates.
Rust 1.5.0
- ~700 changes, numerous bugfixes
Highlights
- Stabilized APIs:
BinaryHeap::from,BinaryHeap::into_sorted_vec,BinaryHeap::into_vec,Condvar::wait_timeout,FileTypeExt::is_block_device,FileTypeExt::is_char_device,FileTypeExt::is_fifo,FileTypeExt::is_socket,FileTypeExt,Formatter::alternate,Formatter::fill,Formatter::precision,Formatter::sign_aware_zero_pad,Formatter::sign_minus,Formatter::sign_plus,Formatter::width,Iterator::cmp,Iterator::eq,Iterator::ge,Iterator::gt,Iterator::le,Iterator::lt,Iterator::ne,Iterator::partial_cmp,Path::canonicalize,Path::exists,Path::is_dir,Path::is_file,Path::metadata,Path::read_dir,Path::read_link,Path::symlink_metadata,Utf8Error::valid_up_to,Vec::resize,VecDeque::as_mut_slices,VecDeque::as_slices,VecDeque::insert,VecDeque::shrink_to_fit,VecDeque::swap_remove_back,VecDeque::swap_remove_front,slice::split_first_mut,slice::split_first,slice::split_last_mut,slice::split_last,char::from_u32_unchecked,fs::canonicalize,str::MatchIndices,str::RMatchIndices,str::match_indices,str::rmatch_indices,str::slice_mut_unchecked,string::ParseError. - Rust applications hosted on crates.io can be installed locally to
~/.cargo/binwith thecargo installcommand. Among other things this makes it easier to augment Cargo with new subcommands: when a binary named e.g.cargo-foois found in$PATHit can be invoked ascargo foo. - Crates with wildcard (
*) dependencies will emit warnings when published. In 1.6 it will no longer be possible to publish crates with wildcard dependencies.
Breaking Changes
- The rules determining when a particular lifetime must outlive a particular value (known as 'dropck') have been modified to not rely on parametricity.
- Implementations of
AsRefandAsMutwere added toBox,Rc, andArc. Because these smart pointer types implementDeref, this causes breakage in cases where the interior type contains methods of the same name. - Correct a bug in Rc/Arc that caused dropck to be unaware that they could drop their content. Soundness fix.
- All method invocations are properly checked for well-formedness. Soundness fix.
- Traits whose supertraits contain
Selfare not object safe. Soundness fix. - Target specifications support a
no_default_librariessetting that controls whether-nodefaultlibsis passed to the linker, and in turn theis_like_windowssetting no longer affects the-nodefaultlibsflag. #[derive(Show)], long-deprecated, has been removed.- The
#[inline]and#[repr]attributes can only appear in valid locations. - Native libraries linked from the local crate are passed to the linker before native libraries from upstream crates.
- Two rarely-used attributes,
#[no_debug]and#[omit_gdb_pretty_printer_section]are feature gated. - Negation of unsigned integers, which has been a warning for several releases, is now behind a feature gate and will generate errors.
- The parser accidentally accepted visibility modifiers on enum variants, a bug which has been fixed.
- A bug was fixed that allowed
usestatements to import unstable features.
Language
- When evaluating expressions at compile-time that are not compile-time constants (const-evaluating expressions in non-const contexts), incorrect code such as overlong bitshifts and arithmetic overflow will generate a warning instead of an error, delaying the error until runtime. This will allow the const-evaluator to be expanded in the future backwards-compatibly.
- The
improper_ctypeslint no longer warns about usingisizeandusizein FFI.
Libraries
Arc<T>andRc<T>are covariant with respect toTinstead of invariant.Defaultis implemented for mutable slices.FromStris implemented forSockAddrV4andSockAddrV6.- There are now
Fromconversions between floating point types where the conversions are lossless. - There are now
Fromconversions between integer types where the conversions are lossless. fs::MetadataimplementsClone.- The
parsemethod accepts a leading "+" when parsing integers. - [
AsMutis implement...