What's new in this version: Rust 1.52.1 - Change log not available for this version
Rust 1.52.0 Language: - Added the unsafe_op_in_unsafe_fn lint, which checks whether the unsafe code in an unsafe fn is wrapped in a unsafe block. This lint is allowed by default, and may become a warning or hard error in a future edition. - You can now cast mutable references to arrays to a pointer of the same type as the element
Compiler: - Upgraded the default LLVM to LLVM 12
Added tier 3* support for the following targets: - s390x-unknown-linux-musl - riscv32gc-unknown-linux-musl & riscv64gc-unknown-linux-musl - powerpc-unknown-openbsd - Refer to Rust's platform support page for more information on Rust's tiered platform support
Libraries: - OsString now implements Extend and FromIterator - cmp::Reverse now has #[repr(transparent)] representation - Arc now implements error::Error - All integer division and remainder operations are now const
Stabilised APIs: - Arguments::as_str - char::MAX - char::REPLACEMENT_CHARACTER - char::UNICODE_VERSION - char::decode_utf16 - char::from_digit - char::from_u32_unchecked - char::from_u32 - slice::partition_point - str::rsplit_once - str::split_once - The following previously stable APIs are now const.: - char::len_utf8 - char::len_utf16 - char::to_ascii_uppercase - char::to_ascii_lowercase - char::eq_ignore_ascii_case - u8::to_ascii_uppercase - u8::to_ascii_lowercase - u8::eq_ignore_ascii_case
Rustdoc: - Rustdoc lints are now treated as a tool lint, meaning that lints are now prefixed with rustdoc:: (e.g. #[warn(rustdoc::non_autolinks)]). Using the old style is still allowed, and will become a warning in a future release. - Rustdoc now supports argument files - Rustdoc now generates smart punctuation for documentation - You can now use "task lists" in Rustdoc Markdown
Misc: - You can now pass multiple filters to tests. E.g. cargo test -- foo bar will run all tests that match foo and bar - Rustup now distributes PDB symbols for the std library on Windows, allowing you to see std symbols when debugging
Internal Only: - These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools - Check the result cache before the DepGraph when ensuring queries - Try fast_reject::simplify_type in coherence before doing full check - Only store a LocalDefId in some HIR nodes - Store HIR attributes in a side table
Compatibility Notes: - Cargo build scripts are now forbidden from setting RUSTC_BOOTSTRAP - Removed support for the x86_64-rumprun-netbsd target - Deprecated the x86_64-sun-solaris target in favor of x86_64-pc-solaris - Rustdoc now only accepts ,, , and t as delimiters for specifying languages in code blocks - Rustc now catches more cases of pub_use_of_private_extern_crate - Changes in how proc macros handle whitespace may lead to panics when used with older proc-macro-hack versions. A cargo update should be sufficient to fix this in all cases.
Rust 1.51.0 Language: - You can now parameterize items such as functions, traits, and structs by constant values in addition to by types and lifetimes. Also known as "const generics" E.g. you can now write the following. Note: Only values of primitive integers, bool, or char types are currently permitted.
Compiler: - Added the -Csplit-debuginfo codegen option for macOS platforms. This option controls whether debug information is split across multiple files or packed into a single file. Note This option is unstable on other platforms. - Added tier 3* support for aarch64_be-unknown-linux-gnu, aarch64-unknown-linux-gnu_ilp32, and aarch64_be-unknown-linux-gnu_ilp32 targets - Added tier 3 support for i386-unknown-linux-gnu and i486-unknown-linux-gnu targets - The target-cpu=native option will now detect individual features of CPUs - Refer to Rust's platform support page for more information on Rust's tiered platform support
Libraries: - Box::downcast is now also implemented for any dyn Any + Send + Sync object - str now implements AsMut - u64 and u128 now implement From - Error is now implemented for &T where T implements Error - Poll::{map_ok, map_err} are now implemented for Poll - unsigned_abs is now implemented for all signed integer types - io::Empty now implements io::Seek - rc::Weak and sync::Weak's methods such as as_ptr are now implemented for T: ?Sized types - Stabilized APIs: - Arc::decrement_strong_count - Arc::increment_strong_count - Once::call_once_force - Peekable::next_if_eq - Peekable::next_if - Seek::stream_position - array::IntoIter - panic::panic_any - ptr::addr_of! - ptr::addr_of_mut! - slice::fill_with - slice::split_inclusive_mut - slice::split_inclusive - slice::strip_prefix - slice::strip_suffix - str::split_inclusive - sync::OnceState - task::Wake
Cargo: - Added the split-debuginfo profile option to control the -Csplit-debuginfo codegen option - Added the resolver field to Cargo.toml to enable the new feature resolver and CLI option behavior. Version 2 of the feature resolver will try to avoid unifying features of dependencies where that unification could be unwanted. Such as using the same dependency with a std feature in a build scripts and proc-macros, while using the no-std feature in the final binary. See the Cargo book documentation for more information on the feature.
Rustdoc: - Rustdoc will now include documentation for methods available from nested Deref traits - You can now provide a --default-theme flag which sets the default theme to use for documentation
Various improvements to intra-doc links: - You can link to non-path primitives such as slice - You can link to associated items - You can now include generic parameters when linking to items, like Vec
Misc: - You can now pass --include-ignored to tests (e.g. with cargo test -- --include-ignored) to include testing tests marked #[ignore]
Compatibility Notes: - WASI platforms no longer use the wasm-bindgen ABI, and instead use the wasm32 ABI - rustc no longer promotes division, modulo and indexing operations to const that could fail - The minimum version of glibc for the following platforms has been bumped to version 2.31 for the distributed artifacts - armv5te-unknown-linux-gnueabi - sparc64-unknown-linux-gnu - thumbv7neon-unknown-linux-gnueabihf - armv7-unknown-linux-gnueabi - x86_64-unknown-linux-gnux32
Internal Only: - Consistently avoid constructing optimized MIR when not doing codegen
Rust 1.50.0 Language: - You can now use const values for x in [x; N] array expressions. This has been technically possible since 1.38.0, as it was unintentionally stabilized - Assignments to ManuallyDrop union fields are now considered safe
Compiler: - Added tier 3* support for the armv5te-unknown-linux-uclibceabi target - Added tier 3 support for the aarch64-apple-ios-macabi target - The x86_64-unknown-freebsd is now built with the full toolset - Refer to Rust's platform support page for more information on Rust's tiered platform support
Libraries: - proc_macro::Punct now implements PartialEq - ops::{Index, IndexMut} are now implemented for fixed sized arrays of any length - On Unix platforms, the std::fs::File type now has a "niche" of -1. This value cannot be a valid file descriptor, and now means Option takes up the same amount of space as File
Stabilized APIs: - bool::then - btree_map::Entry::or_insert_with_key - f32::clamp - f64::clamp - hash_map::Entry::or_insert_with_key - Ord::clamp - RefCell::take - slice::fill - UnsafeCell::get_mut
The following previously stable methods are now const: - IpAddr::is_ipv4 - IpAddr::is_ipv6 - Layout::size - Layout::align - Layout::from_size_align - pow for all integer types - checked_pow for all integer types - saturating_pow for all integer types - wrapping_pow for all integer types - next_power_of_two for all unsigned integer types - checked_power_of_two for all unsigned integer types
Cargo: - Added the [build.rustc-workspace-wrapper] option. This option sets a wrapper to execute instead of rustc, for workspace members only - cargo:rerun-if-changed will now, if provided a directory, scan the entire contents of that directory for changes - Added the --workspace flag to the cargo update command
Misc: - The search results tab and the help button are focusable with keyboard in rustdoc - Running tests will now print the total time taken to execute
Compatibility Notes: - The compare_and_swap method on atomics has been deprecated. It's recommended to use the compare_exchange and compare_exchange_weak methods instead - Changes in how TokenStreams are checked have fixed some cases where you could write unhygenic macro_rules! macros - #![test] as an inner attribute is now considered unstable like other inner macro attributes, and reports an error by default through the soft_unstable lint - Overriding a forbid lint at the same level that it was set is now a hard error - Dropped support for all cloudabi targets - You can no longer intercept panic! calls by supplying your own macro. It's recommended to use the #[panic_handler] attribute to provide your own implementation - Semi-colons after item statements (e.g. struct Foo {};) now produce a warning
Language: - Unions can now implement Drop, and you can now have a field in a union with ManuallyDrop - You can now cast uninhabited enums to integers - You can now bind by reference and by move in patterns. This allows you to selectively borrow individual components of a type. E.g - #[derive(Debug)] - struct Person { - name: String, - age: u8, - let person = Person { - name: String::from("Alice"), - age: 20, - // `name` is moved out of person, but `age` is referenced - let Person { name, ref age } = person; - println!("{} {}", name, age);
Compiler: - Added tier 1* support for aarch64-unknown-linux-gnu - Added tier 2 support for aarch64-apple-darwin - Added tier 2 support for aarch64-pc-windows-msvc - Added tier 3 support for mipsel-unknown-none - Raised the minimum supported LLVM version to LLVM 9 - Output from threads spawned in tests is now captured - Change os and vendor values to "none" and "unknown" for some targets - Refer to Rust's platform support page for more information on Rust's tiered platform support
Libraries: - RangeInclusive now checks for exhaustion when calling contains and indexing - ToString::to_string now no longer shrinks the internal buffer in the default implementation ops::{Index, IndexMut} are now implemented for fixed sized arrays of any length
Stabilized APIs: - slice::select_nth_unstable - slice::select_nth_unstable_by - slice::select_nth_unstable_by_key - The following previously stable methods are now const - Poll::is_ready - Poll::is_pending
Cargo: - Building a crate with cargo-package should now be independently reproducible - cargo-tree now marks proc-macro crates - Added CARGO_PRIMARY_PACKAGE build-time environment variable. This variable will be set if the crate being built is one the user selected to build, either with -p or through defaults - You can now use glob patterns when specifying packages & targets
Compatibility Notes: - Demoted i686-unknown-freebsd from host tier 2 to target tier 2 support - Macros that end with a semi-colon are now treated as statements even if they expand to nothing - Rustc will now check for the validity of some built-in attributes on enum variants. Previously such invalid or unused attributes could be ignored - Leading whitespace is stripped more uniformly in documentation comments, which may change behavior. You read this post about the changes for more details - Trait bounds are no longer inferred for associated types
Internal Only: - These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools - rustc's internal crates are now compiled using the initial-exec Thread Local Storage model - Calculate visibilities once in resolve - Added system to the llvm-libunwind bootstrap config option - Added --color for configuring terminal color support to bootstrap |