Latest in branch 1.34
1.34.2
Released 14 May 2019
(7 years ago)
SoftwareRust
Version1.34
Initial release1.34.0
11 Apr 2019
(7 years ago)
Latest release1.34.2
14 May 2019
(7 years ago)
Support status24 May 2019
(Ended 7 years ago)
Release noteshttps://github.com/rust-lang/rust/releases/tag/1.34.2
Source codehttps://github.com/rust-lang/rust/tree/1.34.2
Downloadhttps://github.com/rust-lang/rust/releases/tag/1.34.2
Rust 1.34 ReleasesView full list

What Is New in Rust 1.34

CategoryHighlights
New FeaturesAlternative cargo registries, ? operator in doctests, arbitrary token streams in custom attributes, TryFrom/TryInto stabilization, new atomic integer types (AtomicU8-AtomicU64), signed NonZero integer types, iter::from_fn and iter::successors
ImprovementsDocumentation test ergonomics, procedural-macro attribute ergonomics, expanded atomic and non-zero integer support
DeprecationsCommandExt::before_exec deprecated in favor of unsafe fn pre_exec

How can I publish and consume crates from a private Cargo registry?

You can publish to and depend on crates from a private Cargo registry by configuring Cargo with a registry entry and using the registry key in Cargo.toml. Add a [registries] table to ~/.cargo/config (or a project-local config) that points at your index server, then reference that name in dependency specifications.

# ~/.cargo/config
[registries]
my-registry = { index = "https://my-intranet:8080/git/index" }

# Cargo.toml
[dependencies]
my-crate = { version = "1.2.3", registry = "my-registry" }

To publish, store an authentication token with cargo login --registry=my-registry and then run cargo publish --registry=my-registry. This workflow lets large organizations keep proprietary crates behind a firewall while still benefiting from Cargo's version solving.

Can I use the ? operator directly in Rust documentation tests?

Yes, Rust 1.34 adds full support for the ? operator in doctests, so you no longer need an explicit fn main() wrapper.

/// ```rust
/// use std::io;
/// let mut input = String::new();
/// io::stdin().read_line(&mut input)?;
/// # Ok::<(), io::Error>(())
/// ```
fn example() {}

Remember to end the doctest with a line that yields the appropriate Result type (often Ok(())) so the test can compile and run.

Do custom attribute macros now accept arbitrary token streams?

Yes, procedural-macro attributes can now take any token stream, eliminating the need to pass complex syntax as a string literal.

#[range(0..10)]          // valid in 1.34
#[bound(T: MyTrait)]    // valid in 1.34

If you maintain a macro crate, audit your attribute definitions and replace string-based parsers with direct token-stream handling for a cleaner API.

What new conversion traits and atomic types are stable in Rust 1.34?

The TryFrom and TryInto traits are now stable, and a full set of atomic integer types from AtomicU8 to AtomicU64 as well as signed NonZeroI* types have been added.

use std::convert::TryInto;

let bytes: &[u8] = &[0, 0, 0, 42];
let num: u32 = u32::from_be_bytes(bytes.try_into().unwrap());

These additions simplify fallible conversions and enable lock-free programming on a broader range of integer widths.

Frequently Asked Questions

Does Rust 1.34 require any changes to existing Cargo.toml files?
Most Cargo.toml files continue to work unchanged unless you start using an alternate registry.

How do I log in to a private registry with Cargo?
Run cargo login --registry=my-registry to store the token in ~/.cargo/credentials.

Can I still use CommandExt::before_exec after upgrading to 1.34?
The function is deprecated and will emit a warning; you should switch to the unsafe pre_exec method.

Is the ? operator now usable in all doctest examples?
Yes, you can write a doctest that returns a Result and use ? directly, ending the test with a plain Ok value.

What is the recommended way to convert a slice to an array in Rust 1.34?
Call slice.try_into()? on the slice and then use the resulting array.

Are there any new iterator helpers in Rust 1.34?
Yes, iter::from_fn and iter::successors are now stable and can be used to build custom iterators.

Releases In Branch 1.34

VersionRelease date
1.34.214 May 2019
(7 years ago)
1.34.125 Apr 2019
(7 years ago)
1.34.011 Apr 2019
(7 years ago)