Releases: pietroalbini/rust
Releases · pietroalbini/rust
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/bin
with thecargo install
command. Among other things this makes it easier to augment Cargo with new subcommands: when a binary named e.g.cargo-foo
is found in$PATH
it 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
AsRef
andAsMut
were 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
Self
are not object safe. Soundness fix. - Target specifications support a
no_default_libraries
setting that controls whether-nodefaultlibs
is passed to the linker, and in turn theis_like_windows
setting no longer affects the-nodefaultlibs
flag. #[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
use
statements 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_ctypes
lint no longer warns about usingisize
andusize
in FFI.
Libraries
Arc<T>
andRc<T>
are covariant with respect toT
instead of invariant.Default
is implemented for mutable slices.FromStr
is implemented forSockAddrV4
andSockAddrV6
.- There are now
From
conversions between floating point types where the conversions are lossless. - There are now
From
conversions between integer types where the conversions are lossless. fs::Metadata
implementsClone
.- The
parse
method accepts a leading "+" when parsing integers. - [
AsMut
is implemented for...
Rust 1.4.0
- ~1200 changes, numerous bugfixes
Highlights
- Windows builds targeting the 64-bit MSVC ABI and linker (instead of GNU) are now supported and recommended for use.
Breaking Changes
- Several changes have been made to fix type soundness and improve the behavior of associated types. See RFC 1214. Although we have mostly introduced these changes as warnings this release, to become errors next release, there are still some scenarios that will see immediate breakage.
- The
str::lines
andBufRead::lines
iterators treat\r\n
as line breaks in addition to\n
. - Loans of
'static
lifetime extend to the end of a function. str::parse
no longer introduces avoidable rounding error when parsing floating point numbers. Together with earlier changes to float formatting/output, "round trips" like f.to_string().parse() now preserve the value of f exactly. Additionally, leading plus signs are now accepted.
Language
use
statements that import multiple items can now rename them, as inuse foo::{bar as kitten, baz as puppy}
.- Binops work correctly on fat pointers.
pub extern crate
, which does not behave as expected, issues a warning until a better solution is found.
Libraries
- Many APIs were stabilized:
<Box<str>>::into_string
,Arc::downgrade
,Arc::get_mut
,Arc::make_mut
,Arc::try_unwrap
,Box::from_raw
,Box::into_raw
,CStr::to_str
,CStr::to_string_lossy
,CString::from_raw
,CString::into_raw
,IntoRawFd::into_raw_fd
,IntoRawFd
,IntoRawHandle::into_raw_handle
,IntoRawHandle
,IntoRawSocket::into_raw_socket
,IntoRawSocket
,Rc::downgrade
,Rc::get_mut
,Rc::make_mut
,Rc::try_unwrap
,Result::expect
,String::into_boxed_str
,TcpStream::read_timeout
,TcpStream::set_read_timeout
,TcpStream::set_write_timeout
,TcpStream::write_timeout
,UdpSocket::read_timeout
,UdpSocket::set_read_timeout
,UdpSocket::set_write_timeout
,UdpSocket::write_timeout
,Vec::append
,Vec::split_off
,VecDeque::append
,VecDeque::retain
,VecDeque::split_off
,rc::Weak::upgrade
,rc::Weak
,slice::Iter::as_slice
,slice::IterMut::into_slice
,str::CharIndices::as_str
,str::Chars::as_str
,str::split_at_mut
,str::split_at
,sync::Weak::upgrade
,sync::Weak
,thread::park_timeout
,thread::sleep
. - Some APIs were deprecated:
BTreeMap::with_b
,BTreeSet::with_b
,Option::as_mut_slice
,Option::as_slice
,Result::as_mut_slice
,Result::as_slice
,f32::from_str_radix
,f64::from_str_radix
. - Reverse-searching strings is faster with the 'two-way' algorithm.
std::io::copy
allows?Sized
arguments.- The
Windows
,Chunks
, andChunksMut
iterators over slices all overridecount
,nth
andlast
with an O(1) implementation. Default
is implemented for arrays up to[T; 32]
.IntoRawFd
has been added to the Unix-specific prelude,IntoRawSocket
andIntoRawHandle
to the Windows-specific prelude.Extend<String>
andFromIterator<String
are both implemented forString
.IntoIterator
is implemented for references toOption
andResult
.HashMap
andHashSet
implementExtend<&T>
whereT: Copy
as part of RFC 839. This will cause type inference breakage in rare situations.BinaryHeap
implementsDebug
.Borrow
andBorrowMut
are implemented for fixed-size arrays.extern fn
s with the "Rust" and "C" ABIs implement common traits includingEq
,Ord
,Debug
,Hash
.- String comparison is faster.
&mut T
whereT: std::fmt::Write
also implementsstd::fmt::Write
.- A stable regression in
VecDeque::push_back
and other capacity-altering methods that caused panics for zero-sized types was fixed. - Function pointers implement traits for up to 12 parameters.
Miscellaneous
- The compiler no longer uses the 'morestack' feature to prevent stack overflow. Instead it uses guard pages and stack probes (though stack probes are not yet implemented on any platform but Windows).
- The compiler matches traits faster when projections are involved.
- The 'improper_ctypes' lint no longer warns about use of
isize
andusize
. - Cargo now displays useful information about what its doing during
cargo update
.
Rust 1.3.0
- ~900 changes, numerous bugfixes
Highlights
- The new object lifetime defaults have been turned on after a cycle of warnings about the change. Now types like
&'a Box<Trait>
(or&'a Rc<Trait>
, etc) will change from being interpreted as&'a Box<Trait+'a>
to&'a Box<Trait+'static>
. - The Rustonomicon is a new book in the official documentation that dives into writing unsafe Rust.
- The
Duration
API, has been stabilized. This basic unit of timekeeping is employed by other std APIs, as well as out-of-tree time crates.
Breaking Changes
- The new object lifetime defaults have been turned on after a cycle of warnings about the change.
- There is a known regression in how object lifetime elision is interpreted, the proper solution for which is undetermined.
- The
#[prelude_import]
attribute, an internal implementation detail, was accidentally stabilized previously. It has been put behind theprelude_import
feature gate. This change is believed to break no existing code. - The behavior of
size_of_val
andalign_of_val
is more sane for dynamically sized types. Code that relied on the previous behavior is thought to be broken. - The
dropck
rules, which checks that destructors can't access destroyed values, have been updated to match the RFC. This fixes some soundness holes, and as such will cause some previously-compiling code to no longer build.
Language
- The new object lifetime defaults have been turned on after a cycle of warnings about the change.
- Semicolons may now follow types and paths in macros.
- The behavior of
size_of_val
andalign_of_val
is more sane for dynamically sized types. Code that relied on the previous behavior is not known to exist, and suspected to be broken. 'static
variables may now be recursive.ref
bindings choose betweenDeref
andDerefMut
implementations correctly.- The
dropck
rules, which checks that destructors can't access destroyed values, have been updated to match the RFC.
Libraries
- The
Duration
API, has been stabilized, as well as thestd::time
module, which presently contains onlyDuration
. Box<str>
andBox<[T]>
both implementClone
.- The owned C string,
CString
, implementsBorrow
and the borrowed C string,CStr
, implementsToOwned
. The two of these allow C strings to be borrowed and cloned in generic code. CStr
implementsDebug
.AtomicPtr
implementsDebug
.Error
trait objects can be downcast to their concrete types in many common configurations, using theis
,downcast
,downcast_ref
anddowncast_mut
methods, similarly to theAny
trait.- Searching for substrings now employs the two-way algorithm instead of doing a naive search. This gives major speedups to a number of methods, including
contains
,find
,rfind
,split
.starts_with
andends_with
are also faster. - The performance of
PartialEq
for slices is much faster. - The
Hash
trait offers the default method,hash_slice
, which is overridden and optimized by the implementations for scalars. - The
Hasher
trait now has a number of specializedwrite_*
methods for primitive types, for efficiency. - The I/O-specific error type,
std::io::Error
, gained a set of methods for accessing the 'inner error', if any:get_ref
,get_mut
,into_inner
. As well, the implementation ofstd::error::Error::cause
also delegates to the inner error. process::Child
gained theid
method, which returns au32
representing the platform-specific process identifier.- The
connect
method on slices is deprecated, replaced by the newjoin
method (note that both of these are on the unstableSliceConcatExt
trait, but through the magic of the prelude are available to stable code anyway). - The
Div
operator is implemented forWrapping
types. DerefMut
is implemented forString
.- Performance of SipHash (the default hasher for
HashMap
) is better for long data. AtomicPtr
implementsSend
.- The
read_to_end
implementations forStdin
andFile
are now specialized to use uninitialized buffers for increased performance. - Lifetime parameters of foreign functions are now resolved properly.
Misc
- Rust can now, with some coercion, produce programs that run on Windows XP, though XP is not considered a supported platform.
- Porting Rust on Windows from the GNU toolchain to MSVC continues (1, 2, 3, 4). It is still not recommended for use in 1.3, though should be fully-functional in the 64-bit 1.4 beta.
- On Fedora-based systems installation will properly configure the dynamic linker.
- The compiler gained many new extended error descriptions, which can be accessed with the
--explain
flag. - The
dropck
pass, which checks that destructors can't access destroyed values, has been rewritten. Th...
Rust 1.2.0
- ~1200 changes, numerous bugfixes
Highlights
- Dynamically-sized-type coercions allow smart pointer types like
Rc
to contain types without a fixed size, arrays and trait objects, finally enabling use ofRc<[T]>
and completing the implementation of DST. - Parallel codegen is now working again, which can substantially speed up large builds in debug mode; It also gets another ~33% speedup when bootstrapping on a 4 core machine (using 8 jobs). It's not enabled by default, but will be "in the near future". It can be activated with the
-C codegen-units=N
flag torustc
. - This is the first release with experimental support for linking with the MSVC linker and lib C on Windows (instead of using the GNU variants via MinGW). It is yet recommended only for the most intrepid Rustaceans.
- Benchmark compilations are showing a 30% improvement in bootstrapping over 1.1.
Breaking Changes
- The
to_uppercase
andto_lowercase
methods onchar
now do unicode case mapping, which is a previously-planned change in behavior and considered a bugfix. mem::align_of
now specifies the minimum alignment for T, which is usually the alignment programs are interested in, and the same value reported by clang'salignof
.mem::min_align_of
is deprecated. This is not known to break real code.- The
#[packed]
attribute is no longer silently accepted by the compiler. This attribute did nothing and code that mentioned it likely did not work as intended. - Associated type defaults are now behind the
associated_type_defaults
feature gate. In 1.1 associated type defaults did not work, but could be mentioned syntactically. As such this breakage has minimal impact.
Language
- Patterns with
ref mut
now correctly invokeDerefMut
when matching against dereferenceable values.
Libraries
- The
Extend
trait, which grows a collection from an iterator, is implemented over iterators of references, forString
,Vec
,LinkedList
,VecDeque
,EnumSet
,BinaryHeap
,VecMap
,BTreeSet
andBTreeMap
. RFC. - The
iter::once
function returns an iterator that yields a single element, anditer::empty
returns an iterator that yields no elements. - The
matches
andrmatches
methods onstr
return iterators over substring matches. Cell
andRefCell
both implementEq
.- A number of methods for wrapping arithmetic are added to the integral types,
wrapping_div
,wrapping_rem
,wrapping_neg
,wrapping_shl
,wrapping_shr
. These are in addition to the existingwrapping_add
,wrapping_sub
, andwrapping_mul
methods, and alternatives to theWrapping
type.. It is illegal for the default arithmetic operations in Rust to overflow; the desire to wrap must be explicit. - The
{:#?}
formatting specifier displays the alternate, pretty-printed form of theDebug
formatter. This feature was actually introduced prior to 1.0 with little fanfare. fmt::Formatter
implementsfmt::Write
, afmt
-specific trait for writing data to formatted strings, similar toio::Write
.fmt::Formatter
adds 'debug builder' methods,debug_struct
,debug_tuple
,debug_list
,debug_set
,debug_map
. These are used by code generators to emit implementations ofDebug
.str
has newto_uppercase
andto_lowercase
methods that convert case, following Unicode case mapping.- It is now easier to handle poisoned locks. The
PoisonError
type, returned by failing lock operations, exposesinto_inner
,get_ref
, andget_mut
, which all give access to the inner lock guard, and allow the poisoned lock to continue to operate. Theis_poisoned
method ofRwLock
andMutex
can poll for a poisoned lock without attempting to take the lock. - On Unix the
FromRawFd
trait is implemented forStdio
, andAsRawFd
forChildStdin
,ChildStdout
,ChildStderr
. On Windows theFromRawHandle
trait is implemented forStdio
, andAsRawHandle
forChildStdin
,ChildStdout
,ChildStderr
. io::ErrorKind
has a new variant,InvalidData
, which indicates malformed input.
Misc
rustc
employs smarter heuristics for guessing at typos.rustc
emits more efficient code for no-op conversions between unsafe pointers.- Fat pointers are now passed in pairs of immediate arguments, resulting in faster compile times and smaller code.
Rust 1.1.0
- ~850 changes, numerous bugfixes
Highlights
- The
std::fs
module has been expanded to expand the set of functionality exposed:DirEntry
now supports optimizations likefile_type
andmetadata
which don't incur a syscall on some platforms.- A
symlink_metadata
function has been added. - The
fs::Metadata
structure now lowers to its OS counterpart, providing access to all underlying information.
- The compiler now contains extended explanations of many errors. When an error with an explanation occurs the compiler suggests using the
--explain
flag to read the explanation. Error explanations are also available online. - Thanks to multiple improvements to type checking, as well as other work, the time to bootstrap the compiler decreased by 32%.
Libraries
- The
str::split_whitespace
method splits a string on unicode whitespace boundaries. - On both Windows and Unix, new extension traits provide conversion of I/O types to and from the underlying system handles. On Unix, these traits are
FromRawFd
andAsRawFd
, on WindowsFromRawHandle
andAsRawHandle
. These are implemented forFile
,TcpStream
,TcpListener
, andUpdSocket
. Further implementations forstd::process
will be stabilized later. - On Unix,
std::os::unix::symlink
creates symlinks. On Windows, symlinks can be created withstd::os::windows::symlink_dir
andstd::os::windows::symlink_file
. - The
mpsc::Receiver
type can now be converted into an iterator withinto_iter
on theIntoIterator
trait. Ipv4Addr
can be created fromu32
with theFrom<u32>
implementation of theFrom
trait.- The
Debug
implementation forRangeFull
creates output that is more consistent with other implementations. Debug
is implemented forFile
.- The
Default
implementation forArc
no longer requiresSync + Send
. - The
Iterator
methodscount
,nth
, andlast
have been overridden for slices to have O(1) performance instead of O(n). - Incorrect handling of paths on Windows has been improved in both the compiler and the standard library.
AtomicPtr
gained aDefault
implementation.- In accordance with Rust's policy on arithmetic overflow
abs
now panics on overflow when debug assertions are enabled. - The
Cloned
iterator, which was accidentally left unstable for 1.0 has been stabilized. - The
Incoming
iterator, which iterates over incoming TCP connections, and which was accidentally unnamable in 1.0, is now properly exported. BinaryHeap
no longer corrupts itself when functions called bysift_up
orsift_down
panic.- The
split_off
method ofLinkedList
no longer corrupts the list in certain scenarios.
Misc
- Type checking performance has improved notably with multiple improvements.
- The compiler suggests code changes for more errors.
- rustc and it's build system have experimental support for building toolchains against MUSL instead of glibc on Linux.
- The compiler defines the
target_env
cfg value, which is used for distinguishing toolchains that are otherwise for the same platform. Presently this is set tognu
for common GNU Linux targets and for MinGW targets, andmusl
for MUSL Linux targets. - The
cargo rustc
command invokes a build with custom flags to rustc. - Android executables are always position independent.
- The
drop_with_repr_extern
lint warns about mixingrepr(C)
withDrop
.
Rust 1.0.0
- ~1500 changes, numerous bugfixes
Highlights
- The vast majority of the standard library is now
#[stable]
. It is no longer possible to use unstable features with a stable build of the compiler. - Many popular crates on crates.io now work on the stable release channel.
- Arithmetic on basic integer types now checks for overflow in debug builds.
Language
- Several restrictions have been added to trait coherence in order to make it easier for upstream authors to change traits without breaking downstream code.
- Digits of binary and octal literals are lexed more eagerly to improve error messages and macro behavior. For example,
0b1234
is now lexed as0b1234
instead of two tokens,0b1
and234
. - Trait bounds are always invariant, eliminating the need for the
PhantomFn
andMarkerTrait
lang items, which have been removed. - "-" is no longer a valid character in crate names, the
extern crate "foo" as bar
syntax has been replaced withextern crate foo as bar
, and Cargo now automatically translates "-" in package names to underscore for the crate name. - Lifetime shadowing is an error.
Send
no longer implies'static
.- UFCS now supports trait-less associated paths like
MyType::default()
. - Primitive types now have inherent methods, obviating the need for extension traits like
SliceExt
. - Methods with
Self: Sized
in theirwhere
clause are considered object-safe, allowing many extension traits likeIteratorExt
to be merged into the traits they extended. - You can now refer to associated types whose corresponding trait bounds appear only in a
where
clause. - The final bits of OIBIT landed, meaning that traits like
Send
andSync
are now library-defined. - A Reflect trait was introduced, which means that downcasting via the
Any
trait is effectively limited to concrete types. This helps retain the potentially-important "parametricity" property: generic code cannot behave differently for different type arguments except in minor ways. - The
unsafe_destructor
feature is now deprecated in favor of the newdropck
. This change is a major reduction in unsafe code.
Libraries
- The
thread_local
module has been renamed tostd::thread
. - The methods of
IteratorExt
have been moved to theIterator
trait itself. - Several traits that implement Rust's conventions for type conversions,
AsMut
,AsRef
,From
, andInto
have been centralized in thestd::convert
module. - The
FromError
trait was removed in favor ofFrom
. - The basic sleep function has moved to
std::thread::sleep_ms
. - The
splitn
function now takes ann
parameter that represents the number of items yielded by the returned iterator instead of the number of 'splits'. - On Unix, all file descriptors are
CLOEXEC
by default. - Derived implementations of
PartialOrd
now order enums according to their explicitly-assigned discriminants. - Methods for searching strings are generic over
Pattern
s, implemented presently by&char
,&str
,FnMut(char) -> bool
and some others. - In method resolution, object methods are resolved before inherent methods.
String::from_str
has been deprecated in favor of theFrom
impl,String::from
.io::Error
implementsSync
.- The
words
method on&str
has been replaced withsplit_whitespace
, to avoid answering the tricky question, 'what is a word?' - The new path and IO modules are complete and
#[stable]
. This was the major library focus for this cycle. - The path API was revised to normalize
.
, adjusting the tradeoffs in favor of the most common usage. - A large number of remaining APIs in
std
were also stabilized during this cycle; about 75% of the non-deprecated API surface is now stable. - The new string pattern API landed, which makes the string slice API much more internally consistent and flexible.
- A new set of generic conversion traits replaced many existing ad hoc traits.
- Generic numeric traits were completely removed. This was made possible thanks to inherent methods for primitive types, and the removal gives maximal flexibility for designing a numeric hierarchy in the future.
- The
Fn
traits are now related via inheritance and provide ergonomic blanket implementations. - The
Index
andIndexMut
traits were changed to take the index by value, enabling code likehash_map["string"]
to work. Copy
now inherits fromClone
, meaning that allCopy
data is known to beClone
as well.
Misc
- Many errors now have extended explanations that can be accessed with the
--explain
flag torustc
. - Many new examples have been added to the standard library documentation.
- rustdoc has received a number of improvements focused on completion and polish.
- Metadata was tuned, shrinking binaries by 27%.
- Much headway was made on ecosystem-wide CI, making it possible to compare builds for breakage.
Rust 1.0.0-alpha.2
-
~1300 changes, numerous bugfixes
-
Highlights
- The various I/O modules were overhauled to reduce unnecessary abstractions and provide better interoperation with the underlying platform. The old
io
module remains temporarily atstd::old_io
. - The standard library now participates in feature gating, so use of unstable libraries now requires a
#![feature(...)]
attribute. The impact of this change is described on the forum. RFC.
- The various I/O modules were overhauled to reduce unnecessary abstractions and provide better interoperation with the underlying platform. The old
-
Language
for
loops now operate on theIntoIterator
trait, which eliminates the need to call.iter()
, etc. to iterate over collections. There are some new subtleties to remember though regarding what sort of iterators various types yield, in particular thatfor foo in bar { }
yields values from a move iterator, destroying the original collection. RFC.- Objects now have default lifetime bounds, so you don't have to write
Box<Trait+'static>
when you don't care about storing references. RFC. - In types that implement
Drop
, lifetimes must outlive the value. This will soon make it possible to safely implementDrop
for types where#[unsafe_destructor]
is now required. Read the gorgeous RFC for details. - The fully qualified ::X syntax lets you set the Self type for a trait method or associated type. RFC.
- References to types that implement
Deref<U>
now automatically coerce to references to the dereferenced typeU
, e.g.&T where T: Deref<U>
automatically coerces to&U
. This should eliminate many unsightly uses of&*
, as when converting from references to vectors into references to slices. RFC. - The explicit closure kind syntax (
|&:|
,|&mut:|
,|:|
) is obsolete and closure kind is inferred from context. Self
is a keyword.
-
Libraries
- The
Show
andString
formatting traits have been renamed toDebug
andDisplay
to more clearly reflect their related purposes. Automatically getting a string conversion to use withformat!("{:?}", something_to_debug)
is now written#[derive(Debug)]
. - Abstract OS-specific string types,
std::ff::{OsString, OsStr}
, provide strings in platform-specific encodings for easier interop with system APIs. RFC. - The
boxed::into_raw
andBox::from_raw
functions convert betweenBox<T>
and*mut T
, a common pattern for creating raw pointers.
- The
-
Tooling
- Certain long error messages of the form 'expected foo found bar' are now split neatly across multiple lines. Examples in the PR.
- On Unix Rust can be uninstalled by running
/usr/local/lib/rustlib/uninstall.sh
. - The
#[rustc_on_unimplemented]
attribute, requiring the 'on_unimplemented' feature, lets rustc display custom error messages when a trait is expected to be implemented for a type but is not.
-
Misc
- Rust is tested against a LALR grammar, which parses almost all the Rust files that rustc does.
Rust 1.0.0-alpha
-
~2400 changes, numerous bugfixes
-
Highlights
- The language itself is considered feature complete for 1.0, though there will be many usability improvements and bugfixes before the final release.
- Nearly 50% of the public API surface of the standard library has been declared 'stable'. Those interfaces are unlikely to change before 1.0.
- The long-running debate over integer types has been settled: Rust will ship with types named
isize
andusize
, rather thanint
anduint
, for pointer-sized integers. Guidelines will be rolled out during the alpha cycle. - Most crates that are not
std
have been moved out of the Rust distribution into the Cargo ecosystem so they can evolve separately and don't need to be stabilized as quickly, including 'time', 'getopts', 'num', 'regex', and 'term'. - Documentation continues to be expanded with more API coverage, more examples, and more in-depth explanations. The guides have been consolidated into The Rust Programming Language.
- "Rust By Example" is now maintained by the Rust team.
- All official Rust binary installers now come with Cargo, the Rust package manager.
-
Language
- Closures have been completely redesigned to be implemented in terms of traits, can now be used as generic type bounds and thus monomorphized and inlined, or via an opaque pointer (boxed) as in the old system. The new system is often referred to as 'unboxed' closures.
- Traits now support associated types, allowing families of related types to be defined together and used generically in powerful ways.
- Enum variants are namespaced by their type names.
where
clauses provide a more versatile and attractive syntax for specifying generic bounds, though the previous syntax remains valid.- Rust again picks a fallback (either i32 or f64) for uninferred numeric types.
- Rust no longer has a runtime of any description, and only supports OS threads, not green threads.
- At long last, Rust has been overhauled for 'dynamically-sized types' (DST), which integrates 'fat pointers' (object types, arrays, and
str
) more deeply into the type system, making it more consistent. - Rust now has a general range syntax,
i..j
,i..
, and..j
that produce range types and which, when combined with theIndex
operator and multidispatch, leads to a convenient slice notation,[i..j]
. - The new range syntax revealed an ambiguity in the fixed-length array syntax, so now fixed length arrays are written
[T; N]
. - The
Copy
trait is no longer implemented automatically. Unsafe pointers no longer implementSync
andSend
so types containing them don't automatically either.Sync
andSend
are now 'unsafe traits' so one can "forcibly" implement them viaunsafe impl
if a type confirms to the requirements for them even though the internals do not (e.g. structs containing unsafe pointers likeArc
). These changes are intended to prevent some footguns and are collectively known as opt-in built-in traits (thoughSync
andSend
will soon become pure library types unknown to the compiler). - Operator traits now take their operands by value, and comparison traits can use multidispatch to compare one type against multiple other types, allowing e.g.
String
to be compared with&str
. if let
andwhile let
are no longer feature-gated.- Rust has adopted a more uniform syntax for escaping unicode characters.
macro_rules!
has been declared stable. Though it is a flawed system it is sufficiently popular that it must be usable for 1.0. Effort has gone into future-proofing it in ways that will allow other macro systems to be developed in parallel, and won't otherwise impact the evolution of the language.- The prelude has been pared back significantly such that it is the minimum necessary to support the most pervasive code patterns, and through generalized where clauses many of the prelude extension traits have been consolidated.
- Rust's rudimentary reflection has been removed, as it incurred too much code generation for little benefit.
- Struct variants are no longer feature-gated.
- Trait bounds can be polymorphic over lifetimes. Also known as 'higher-ranked trait bounds', this crucially allows unboxed closures to work.
- Macros invocations surrounded by parens or square brackets and not terminated by a semicolon are parsed as expressions, which makes expressions like
vec![1i32, 2, 3].len()
work as expected. - Trait objects now implement their traits automatically, and traits that can be coerced to objects now must be object safe.
- Automatically deriving traits is now done with
#[derive(...)]
not#[deriving(...)]
for consistency with other naming conventions. - Importing the containing module or enum at the same time as items or variants they contain is now done with
self
instead ofmod
, as in usefoo::{self, bar}
- Glob imports are no longer feature-gated.
- The
box
operator andbox
patterns have been feature-gated pending a redesign. For now unique boxes should be allocated like other containers, withBox::new
.
-
Libraries
- A series of efforts to establish conventions for collections types has resulted in API improvements throughout the standard library.
- New APIs for error handling provide ergonomic interop between error types, and new conventions describe more clearly the recommended error handling strategies in Rust.
- The
fail!
macro has been renamed topanic!
so that it is easier to discuss failure in the context of error handling without making clarifications as to whether you are referring to the 'fail' macro or failure more generally. - On Linux,
OsRng
prefers the new, more reliablegetrandom
syscall when available. - The 'serialize' crate has been renamed 'rustc-serialize' and moved out of the distribution to Cargo. Although it is widely used now, it is expected to be superseded in the near future.
- The
Show
formatter, typically implemented with#[derive(Show)]
is now requested with the{:?}
specifier and is intended for use by all types, for uses such asprintln!
debugging. The newString
formatter must be implemented by hand, uses the{}
specifier, and is intended for full-fidelity conversions of things that can logically be represented as strings.
-
Tooling
- Flexible target specification allows rustc's code generation to be configured to support otherwise-unsupported platforms.
- Rust comes with rust-gdb and rust-lldb scripts that launch their respective debuggers with Rust-appropriate pretty-printing.
- The Windows installation of Rust is distributed with the MinGW components currently required to link binaries on that platform.
-
Misc
- Nullable enum optimizations have been extended to more types so that e.g.
Option<Vec<T>>
andOption<String>
take up no more space than the inner types themselves. - Work has begun on supporting AArch64.
- Nullable enum optimizations have been extended to more types so that e.g.
Rust 0.12.0
-
~1900 changes, numerous bugfixes
-
Highlights
- The introductory documentation (now called The Rust Guide) has been completely rewritten, as have a number of supplementary guides.
- Rust's package manager, Cargo, continues to improve and is sometimes considered to be quite awesome.
- Many API's in
std
have been reviewed and updated for consistency with the in-development Rust coding guidelines. The standard library documentation tracks stabilization progress. - Minor libraries have been moved out-of-tree to the rust-lang org on GitHub: uuid, semver, glob, num, hexfloat, fourcc. They can be installed with Cargo.
- Lifetime elision allows lifetime annotations to be left off of function declarations in many common scenarios.
- Rust now works on 64-bit Windows.
-
Language
- Indexing can be overloaded with the
Index
andIndexMut
traits. - The
if let
construct takes a branch only if thelet
pattern matches, currently behind the 'if_let' feature gate. - 'where clauses', a more flexible syntax for specifying trait bounds that is more aesthetic, have been added for traits and free functions. Where clauses will in the future make it possible to constrain associated types, which would be impossible with the existing syntax.
- A new slicing syntax (e.g.
[0..4]
) has been introduced behind the 'slicing_syntax' feature gate, and can be overloaded with theSlice
orSliceMut
traits. - The syntax for matching of sub-slices has been changed to use a postfix
..
instead of prefix (.e.g.[a, b, c..]
), for consistency with other uses of..
and to future-proof potential additional uses of the syntax. - The syntax for matching inclusive ranges in patterns has changed from
0..3
to0...4
to be consistent with the exclusive range syntax for slicing. - Matching of sub-slices in non-tail positions (e.g.
[a.., b, c]
) has been put behind the 'advanced_slice_patterns' feature gate and may be removed in the future. - Components of tuples and tuple structs can be extracted using the
value.0
syntax, currently behind thetuple_indexing
feature gate. - The
#[crate_id]
attribute is no longer supported; versioning is handled by the package manager. - Renaming crate imports are now written
extern crate foo as bar
instead ofextern crate bar = foo
. - Renaming use statements are now written
use foo as bar
instead ofuse bar = foo
. let
andmatch
bindings and argument names in macros are now hygienic.- The new, more efficient, closure types ('unboxed closures') have been added under a feature gate, 'unboxed_closures'. These will soon replace the existing closure types, once higher-ranked trait lifetimes are added to the language.
move
has been added as a keyword, for indicating closures that capture by value.- Mutation and assignment is no longer allowed in pattern guards.
- Generic structs and enums can now have trait bounds.
- The
Share
trait is now calledSync
to free up the term 'shared' to refer to 'shared reference' (the default reference type. - Dynamically-sized types have been mostly implemented, unifying the behavior of fat-pointer types with the rest of the type system.
- As part of dynamically-sized types, the
Sized
trait has been introduced, which qualifying types implement by default, and which type parameters expect by default. To specify that a type parameter does not need to be sized, write<Sized? T>
. Most types areSized
, notable exceptions being unsized arrays ([T]
) and trait types. - Closures can return
!
, as in|| -> !
orproc() -> !
. - Lifetime bounds can now be applied to type parameters and object types.
- The old, reference counted GC type,
Gc<T>
which was once denoted by the@
sigil, has finally been removed. GC will be revisited in the future.
- Indexing can be overloaded with the
-
Libraries
- Library documentation has been improved for a number of modules.
- Bit-vectors, collections::bitv has been modernized.
- The url crate is deprecated in favor of http://github.com/servo/rust-url, which can be installed with Cargo.
- Most I/O stream types can be cloned and subsequently closed from a different thread.
- A
std::time::Duration
type has been added for use in I/O methods that rely on timers, as well as in the 'time' crate'sTimespec
arithmetic. - The runtime I/O abstraction layer that enabled the green thread scheduler to do non-thread-blocking I/O has been removed, along with the libuv-based implementation employed by the green thread scheduler. This will greatly simplify the future I/O work.
collections::btree
has been rewritten to have a more idiomatic and efficient design.
-
Tooling
- rustdoc output now indicates the stability levels of API's.
- The
--crate-name
flag can specify the name of the crate being compiled, like#[crate_name]
. - The
-C metadata
specifies additional metadata to hash into symbol names, and-C extra-filename
specifies additional information to put into the output filename, for use by the package manager for versioning. - debug info generation has continued to improve and should be more reliable under both gdb and lldb.
- rustc has experimental support for compiling in parallel using the
-C codegen-units
flag. - rustc no longer encodes rpath information into binaries by default.
-
Misc
- Stack usage has been optimized with LLVM lifetime annotations.
- Official Rust binaries on Linux are more compatible with older kernels and distributions, built on CentOS 5.10.
Rust 0.11.0
-
~1700 changes, numerous bugfixes
-
Language
- ~[T] has been removed from the language. This type is superseded by the Vec type.
- ~str has been removed from the language. This type is superseded by the String type.
- ~T has been removed from the language. This type is superseded by the Box type.
- @t has been removed from the language. This type is superseded by the standard library's std::gc::Gc type.
- Struct fields are now all private by default.
- Vector indices and shift amounts are both required to be a
uint
instead of any integral type. - Byte character, byte string, and raw byte string literals are now all supported by prefixing the normal literal with a
b
. - Multiple ABIs are no longer allowed in an ABI string
- The syntax for lifetimes on closures/procedures has been tweaked slightly:
<'a>|A, B|: 'b + K -> T
- Floating point modulus has been removed from the language; however it is still provided by a library implementation.
- Private enum variants are now disallowed.
- The
priv
keyword has been removed from the language. - A closure can no longer be invoked through a &-pointer.
- The
use foo, bar, baz;
syntax has been removed from the language. - The transmute intrinsic no longer works on type parameters.
- Statics now allow blocks/items in their definition.
- Trait bounds are separated from objects with + instead of : now.
- Objects can no longer be read while they are mutably borrowed.
- The address of a static is now marked as insignificant unless the #[inline(never)] attribute is placed it.
- The #[unsafe_destructor] attribute is now behind a feature gate.
- Struct literals are no longer allowed in ambiguous positions such as if, while, match, and for..in.
- Declaration of lang items and intrinsics are now feature-gated by default.
- Integral literals no longer default to
int
, and floating point literals no longer default tof64
. Literals must be suffixed with an appropriate type if inference cannot determine the type of the literal. - The Box type is no longer implicitly borrowed to &mut T.
- Procedures are now required to not capture borrowed references.
-
Libraries
- The standard library is now a "facade" over a number of underlying libraries. This means that development on the standard library should be speedier due to smaller crates, as well as a clearer line between all dependencies.
- A new library, libcore, lives under the standard library's facade which is Rust's "0-assumption" library, suitable for embedded and kernel development for example.
- A regex crate has been added to the standard distribution. This crate includes statically compiled regular expressions.
- The unwrap/unwrap_err methods on Result require a Show bound for better error messages.
- The return types of the std::comm primitives have been centralized around the Result type.
- A number of I/O primitives have gained the ability to time out their operations.
- A number of I/O primitives have gained the ability to close their reading/writing halves to cancel pending operations.
- Reverse iterator methods have been removed in favor of
rev()
on their forward-iteration counterparts. - A bitflags! macro has been added to enable easy interop with C and management of bit flags.
- A debug_assert! macro is now provided which is disabled when
--cfg ndebug
is passed to the compiler. - A graphviz crate has been added for creating .dot files.
- The std::cast module has been migrated into std::mem.
- The std::local_data api has been migrated from freestanding functions to being based on methods.
- The Pod trait has been renamed to Copy.
- jemalloc has been added as the default allocator for types.
- The API for allocating memory has been changed to use proper alignment and sized deallocation
- Connecting a TcpStream or binding a TcpListener is now based on a string address and a u16 port. This allows connecting to a hostname as opposed to an IP.
- The Reader trait now contains a core method, read_at_least(), which correctly handles many repeated 0-length reads.
- The process-spawning API is now centered around a builder-style Command struct.
- The :? printing qualifier has been moved from the standard library to an external libdebug crate.
- Eq/Ord have been renamed to PartialEq/PartialOrd. TotalEq/TotalOrd have been renamed to Eq/Ord.
- The select/plural methods have been removed from format!. The escapes for { and } have also changed from { and } to {{ and }}, respectively.
- The TaskBuilder API has been re-worked to be a true builder, and extension traits for spawning native/green tasks have been added.
-
Tooling
- All breaking changes to the language or libraries now have their commit message annotated with
[breaking-change]
to allow for easy discovery of breaking changes. - The compiler will now try to suggest how to annotate lifetimes if a lifetime-related error occurs.
- Debug info continues to be improved greatly with general bug fixes and better support for situations like link time optimization (LTO).
- Usage of syntax extensions when cross-compiling has been fixed.
- Functionality equivalent to GCC & Clang's -ffunction-sections, -fdata-sections and --gc-sections has been enabled by default
- The compiler is now stricter about where it will load module files from when a module is declared via
mod foo;
. - The #[phase(syntax)] attribute has been renamed to #[phase(plugin)]. Syntax extensions are now discovered via a "plugin registrar" type which will be extended in the future to other various plugins.
- Lints have been restructured to allow for dynamically loadable lints.
- A number of rustdoc improvements:
- The HTML output has been visually redesigned.
- Markdown is now powered by hoedown instead of sundown.
- Searching heuristics have been greatly improved.
- The search index has been reduced in size by a great amount.
- Cross-crate documentation via
pub use
has been greatly improved. - Primitive types are now hyperlinked and documented.
- Documentation has been moved from static.rust-lang.org/doc to doc.rust-lang.org
- A new sandbox, play.rust-lang.org, is available for running and sharing rust code examples on-line.
- Unused attributes are now more robustly warned about.
- The dead_code lint now warns about unused struct fields.
- Cross-compiling to iOS is now supported.
- Cross-compiling to mipsel is now supported.
- Stability attributes are now inherited by default and no longer apply to intra-crate usage, only inter-crate usage.
- Error message related to non-exhaustive match expressions have been greatly improved.
- All breaking changes to the language or libraries now have their commit message annotated with