Rust 1.30.0
Released on October 25, 2018
What's Changed
- [Procedural macros are now available.][52081] These kinds of macros allow for
- [You can now use keywords as identifiers using the raw identifiers
- [Using anonymous parameters in traits is now deprecated with a warning and
- [You can now use
cratein paths.][54404] This allows you to refer to the - [Using a external crate no longer requires being prefixed with
::.][54404] - [You can now apply the
#[used]attribute to static items to prevent the - [You can now import and reexport macros from other crates with the
use - [You can now catch visibility keywords (e.g.
pub,pub(crate)) in macros - [Non-macro attributes now allow all forms of literals, not just
- [You can now specify a function to handle a panic in the Rust runtime with the
- [Added the
riscv32imc-unknown-none-elftarget.][53822] - [Added the
aarch64-unknown-netbsdtarget][53165] - [Upgraded to LLVM 8.][53611]
- [
ManuallyDropnow allows the inner type to be unsized.][53033] - [
Ipv4Addr::BROADCAST] - [
Ipv4Addr::LOCALHOST] - [
Ipv4Addr::UNSPECIFIED] - [
Ipv6Addr::LOCALHOST] - [
Ipv6Addr::UNSPECIFIED] - [
Iterator::find_map] - [
str::trim_end_matches] - [
str::trim_end] - [
str::trim_start_matches] - [
str::trim_start]
- [
cargo rundoesn't require specifying a package in workspaces.][cargo/5877] - [
cargo docnow supports--message-format=json.][cargo/5878] This is - [Cargo will now provide a progress bar for builds.][cargo/5995]
- [
rustdocallows you to specify what edition to treat your code as with the - [
rustdocnow has the--color(specify whether to output color) and - [We now distribute a
rust-gdbguiscript that invokesgdbguiwith Rust - [Attributes from Rust tools such as
rustfmtorclippyare now
Full Changelog
Language
--------
- [Procedural macros are now available.][52081] These kinds of macros allow for
more powerful code generation. There is a [new chapter available][proc-macros]
in the Rust Programming Language book that goes further in depth.
- [You can now use keywords as identifiers using the raw identifiers
syntax (r#),][53236] e.g. let r#for = true;
- [Using anonymous parameters in traits is now deprecated with a warning and
will be a hard error in the 2018 edition.][53272]
- [You can now use crate in paths.][54404] This allows you to refer to the
crate root in the path, e.g. use crate::foo; refers to foo in src/lib.rs.
- [Using a external crate no longer requires being prefixed with ::.][54404]
Previously, using a external crate in a module without a use statement
required let json = ::serde_json::from_str(foo); but can now be written
as let json = serde_json::from_str(foo);.
- [You can now apply the #[used] attribute to static items to prevent the
compiler from optimising them away, even if they appear to be unused,][51363]
e.g. #[used] static FOO: u32 = 1;
- [You can now import and reexport macros from other crates with the use
syntax.][50911] Macros exported with #[macro_export] are now placed into
the root module of the crate. If your macro relies on calling other local
macros, it is recommended to export with the
#[macro_export(local_inner_macros)] attribute so users won't have to import
those macros.
- [You can now catch visibility keywords (e.g. pub, pub(crate)) in macros
using the vis specifier.][53370]
- [Non-macro attributes now allow all forms of literals, not just
strings.][53044] Previously, you would write #[attr("true")], and you can now
write #[attr(true)].
- [You can now specify a function to handle a panic in the Rust runtime with the
#[panic_handler] attribute.][51366]
Compiler
--------
- [Added the riscv32imc-unknown-none-elf target.][53822]
- [Added the aarch64-unknown-netbsd target][53165]
- [Upgraded to LLVM 8.][53611]
Libraries
---------
- [ManuallyDrop now allows the inner type to be unsized.][53033]
Stabilized APIs
---------------
- [Ipv4Addr::BROADCAST]
- [Ipv4Addr::LOCALHOST]
- [Ipv4Addr::UNSPECIFIED]
- [Ipv6Addr::LOCALHOST]
- [Ipv6Addr::UNSPECIFIED]
- [Iterator::find_map]
The following methods are replacement methods for trim_left, trim_right,
trim_left_matches, and trim_right_matches, which will be deprecated
in 1.33.0:
- [str::trim_end_matches]
- [str::trim_end]
- [str::trim_start_matches]
- [str::trim_start]
Cargo
----
- [cargo run doesn't require specifying a package in workspaces.][cargo/5877]
- [cargo doc now supports --message-format=json.][cargo/5878] This is
equivalent to calling rustdoc --error-format=json.
- [Cargo will now provide a progress bar for builds.][cargo/5995]
Misc
----
- [rustdoc allows you to specify what edition to treat your code as with the
--edition option.][54057]
- [rustdoc now has the --color (specify whether to output color) and
--error-format (specify error format, e.g. json) options.][53003]
- [We now distribute a rust-gdbgui script that invokes gdbgui with Rust
debug symbols.][53774]
- [Attributes from Rust tools such as rustfmt or clippy are now
available,][53459] e.g. #[rustfmt::skip] will skip formatting the next item.
[50911]: https://github.com/rust-lang/rust/pull/50911/
[51363]: https://github.com/rust-lang/rust/pull/51363/
[51366]: https://github.com/rust-lang/rust/pull/51366/
[52081]: https://github.com/rust-lang/rust/pull/52081/
[53003]: https://github.com/rust-lang/rust/pull/53003/
[53033]: https://github.com/rust-lang/rust/pull/53033/
[53044]: https://github.com/rust-lang/rust/pull/53044/
[53165]: https://github.com/rust-lang/rust/pull/53165/
[53611]: https://github.com/rust-lang/rust/pull/53611/
[53236]: https://github.com/rust-lang/rust/pull/53236/
[53272]: https://github.com/rust-lang/rust/pull/53272/
[53370]: https://github.com/rust-lang/rust/pull/53370/
[53459]: https://github.com/rust-lang/rust/pull/53459/
[53774]: https://github.com/rust-lang/rust/pull/53774/
[53822]: https://github.com/rust-lang/rust/pull/53822/
[54057]: https://github.com/rust-lang/rust/pull/54057/
[54404]: https://github.com/rust-lang/rust/pull/54404/
[cargo/5877]: https://github.com/rust-lang/cargo/pull/5877/
[cargo/5878]: https://github.com/rust-lang/cargo/pull/5878/
[cargo/5995]: https://github.com/rust-lang/cargo/pull/5995/
[proc-macros]: https://doc.rust-lang.org/nightly/book/2018-edition/ch19-06-macros.html
[Ipv4Addr::BROADCAST]: https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#associatedconstant.BROADCAST
[Ipv4Addr::LOCALHOST]: https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#associatedconstant.LOCALHOST
[Ipv4Addr::UNSPECIFIED]: https://doc.rust-lang.org/nightly/std/net/struct.Ipv4Addr.html#associatedconstant.UNSPECIFIED
[Ipv6Addr::LOCALHOST]: https://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#associatedconstant.LOCALHOST
[Ipv6Addr::UNSPECIFIED]: https://doc.rust-lang.org/nightly/std/net/struct.Ipv6Addr.html#associatedconstant.UNSPECIFIED
[Iterator::find_map]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.find_map
[str::trim_end_matches]: https://doc.rust-lang.org/nightly/std/primitive.str.html#method.trim_end_matches
[str::trim_end]: https://doc.rust-lang.org/nightly/std/primitive.str.html#method.trim_end
[str::trim_start_matches]: https://doc.rust-lang.org/nightly/std/primitive.str.html#method.trim_start_matches
[str::trim_start]: https://doc.rust-lang.org/nightly/std/primitive.str.html#method.trim_start