Skip to content

Commit

Permalink
Merge pull request torvalds#616 from ojeda/rust-1.58
Browse files Browse the repository at this point in the history
Rust 1.58.0
  • Loading branch information
ojeda authored Jan 13, 2022
2 parents 26e876d + c92c4d2 commit 32e5120
Show file tree
Hide file tree
Showing 21 changed files with 157 additions and 136 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
arch: [arm, arm64, ppc64le, riscv64, x86_64]
toolchain: [gcc, clang, llvm]
config: [debug, release]
rustc: [1.57.0]
rustc: [1.58.0]
output: [src] # [src, build]
install: [rustup] # [rustup, standalone]
sysroot: [common] # [common, custom]
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
- arch: arm64
toolchain: gcc
config: debug
rustc: 1.57.0
rustc: 1.58.0
output: build
install: rustup
sysroot: custom
Expand All @@ -59,7 +59,7 @@ jobs:
- arch: arm64
toolchain: llvm
config: debug
rustc: 1.57.0
rustc: 1.58.0
output: build
install: rustup
sysroot: custom
Expand All @@ -68,7 +68,7 @@ jobs:
- arch: arm64
toolchain: llvm
config: release
rustc: 1.57.0
rustc: 1.58.0
output: build
install: rustup
sysroot: custom
Expand All @@ -77,7 +77,7 @@ jobs:
- arch: ppc64le
toolchain: clang
config: release
rustc: 1.57.0
rustc: 1.58.0
output: build
install: standalone
sysroot: common
Expand All @@ -86,7 +86,7 @@ jobs:
- arch: x86_64
toolchain: llvm
config: debug
rustc: 1.57.0
rustc: 1.58.0
output: build
install: standalone
sysroot: custom
Expand All @@ -95,7 +95,7 @@ jobs:
- arch: x86_64
toolchain: llvm
config: debug
rustc: 1.57.0
rustc: 1.58.0
output: src
install: rustup
sysroot: common
Expand All @@ -104,7 +104,7 @@ jobs:
- arch: x86_64
toolchain: llvm
config: release
rustc: 1.57.0
rustc: 1.58.0
output: src
install: rustup
sysroot: common
Expand Down
2 changes: 1 addition & 1 deletion Documentation/process/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ know what you are doing, use the exact version listed here. Please see
====================== =============== ========================================
GNU C 5.1 gcc --version
Clang/LLVM (optional) 10.0.1 clang --version
rustc (optional) 1.57.0 rustc --version
rustc (optional) 1.58.0 rustc --version
bindgen (optional) 0.56.0 bindgen --version
GNU make 3.81 make --version
binutils 2.23 ld -v
Expand Down
2 changes: 1 addition & 1 deletion Documentation/rust/quick-start.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Rust features.
If ``rustup`` is being used, enter the checked out source code directory
and run::

rustup override set 1.57.0
rustup override set 1.58.0

Otherwise, fetch a standalone installer or install ``rustup`` from:

Expand Down
1 change: 1 addition & 0 deletions drivers/android/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub(crate) struct Context {
manager: Mutex<Manager>,
}

#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for Context {}
unsafe impl Sync for Context {}

Expand Down
1 change: 1 addition & 0 deletions drivers/android/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ pub(crate) struct Process {
node_refs: Mutex<ProcessNodeRefs>,
}

#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for Process {}
unsafe impl Sync for Process {}

Expand Down
4 changes: 2 additions & 2 deletions rust/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ $(objtree)/rust/kernel.o: $(srctree)/rust/kernel/lib.rs $(objtree)/rust/alloc.o
# Targets that need to expand twice
.SECONDEXPANSION:
$(objtree)/rust/core.o: private skip_clippy = 1
$(objtree)/rust/core.o: private skip_flags = -Dunreachable_pub
$(objtree)/rust/core.o: private rustc_target_flags = $(core-cfgs)
$(objtree)/rust/core.o: private skip_flags = -Dunreachable_pub --edition=2021
$(objtree)/rust/core.o: private rustc_target_flags = $(core-cfgs) --edition=2018
$(objtree)/rust/core.o: $$(RUST_LIB_SRC)/core/src/lib.rs FORCE
$(call if_changed_dep,rustc_library)

Expand Down
3 changes: 3 additions & 0 deletions rust/alloc/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pub use std::alloc::Global;
/// }
/// ```
#[stable(feature = "global_alloc", since = "1.28.0")]
#[must_use = "losing the pointer will leak memory"]
#[inline]
pub unsafe fn alloc(layout: Layout) -> *mut u8 {
unsafe { __rust_alloc(layout.size(), layout.align()) }
Expand Down Expand Up @@ -119,6 +120,7 @@ pub unsafe fn dealloc(ptr: *mut u8, layout: Layout) {
///
/// See [`GlobalAlloc::realloc`].
#[stable(feature = "global_alloc", since = "1.28.0")]
#[must_use = "losing the pointer will leak memory"]
#[inline]
pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
unsafe { __rust_realloc(ptr, layout.size(), layout.align(), new_size) }
Expand Down Expand Up @@ -152,6 +154,7 @@ pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
/// }
/// ```
#[stable(feature = "global_alloc", since = "1.28.0")]
#[must_use = "losing the pointer will leak memory"]
#[inline]
pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8 {
unsafe { __rust_alloc_zeroed(layout.size(), layout.align()) }
Expand Down
3 changes: 3 additions & 0 deletions rust/alloc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ use crate::vec::Vec;
#[lang = "owned_box"]
#[fundamental]
#[stable(feature = "rust1", since = "1.0.0")]
// The declaration of the `Box` struct must be kept in sync with the
// `alloc::alloc::box_free` function or ICEs will happen. See the comment
// on `box_free` for more details.
pub struct Box<
T: ?Sized,
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator = Global,
Expand Down
1 change: 1 addition & 0 deletions rust/alloc/collections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub struct TryReserveError {
impl TryReserveError {
/// Details about the allocation that caused the error
#[inline]
#[must_use]
#[unstable(
feature = "try_reserve_kind",
reason = "Uncertain how much info should be exposed",
Expand Down
18 changes: 18 additions & 0 deletions rust/alloc/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
//! format!("The number is {}", 1); // => "The number is 1"
//! format!("{:?}", (3, 4)); // => "(3, 4)"
//! format!("{value}", value=4); // => "4"
//! let people = "Rustaceans";
//! format!("Hello {people}!"); // => "Hello Rustaceans!"
//! format!("{} {}", 1, 2); // => "1 2"
//! format!("{:04}", 42); // => "0042" with leading zeros
//! format!("{:#?}", (100, 200)); // => "(
Expand Down Expand Up @@ -82,6 +84,19 @@
//! format!("{a} {c} {b}", a="a", b='b', c=3); // => "a 3 b"
//! ```
//!
//! If a named parameter does not appear in the argument list, `format!` will
//! reference a variable with that name in the current scope.
//!
//! ```
//! let argument = 2 + 2;
//! format!("{argument}"); // => "4"
//!
//! fn make_string(a: u32, b: &str) -> String {
//! format!("{b} {a}")
//! }
//! make_string(927, "label"); // => "label 927"
//! ```
//!
//! It is not valid to put positional parameters (those without names) after
//! arguments that have names. Like with positional parameters, it is not
//! valid to provide named parameters that are unused by the format string.
Expand All @@ -100,6 +115,8 @@
//! println!("Hello {:1$}!", "x", 5);
//! println!("Hello {1:0$}!", 5, "x");
//! println!("Hello {:width$}!", "x", width = 5);
//! let width = 5;
//! println!("Hello {:width$}!", "x");
//! ```
//!
//! This is a parameter for the "minimum width" that the format should take up.
Expand Down Expand Up @@ -574,6 +591,7 @@ use crate::string;
/// [`format_args!`]: core::format_args
/// [`format!`]: crate::format
#[cfg(not(no_global_oom_handling))]
#[must_use]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn format(args: Arguments<'_>) -> string::String {
let capacity = args.estimated_capacity();
Expand Down
97 changes: 51 additions & 46 deletions rust/alloc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,87 +82,91 @@
)]
#![no_std]
#![needs_allocator]
//
// Lints:
#![deny(unsafe_op_in_unsafe_fn)]
#![warn(deprecated_in_future)]
#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
#![warn(missing_docs)]
#![allow(explicit_outlives_requirements)]
#![deny(unsafe_op_in_unsafe_fn)]
#![feature(rustc_allow_const_fn_unstable)]
#![cfg_attr(not(test), feature(generator_trait))]
#![cfg_attr(test, feature(test))]
#![cfg_attr(test, feature(new_uninit))]
//
// Library features:
#![feature(alloc_layout_extra)]
#![feature(allocator_api)]
#![feature(array_chunks)]
#![feature(array_methods)]
#![feature(array_windows)]
#![feature(allow_internal_unstable)]
#![feature(arbitrary_self_types)]
#![feature(async_stream)]
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(cfg_sanitize)]
#![feature(cfg_target_has_atomic)]
#![feature(coerce_unsized)]
#![cfg_attr(not(no_global_oom_handling), feature(const_btree_new))]
#![feature(const_fn_trait_bound)]
#![feature(cow_is_borrowed)]
#![feature(const_cow_is_borrowed)]
#![feature(const_trait_impl)]
#![feature(destructuring_assignment)]
#![feature(dispatch_from_dyn)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
#![feature(dispatch_from_dyn)]
#![feature(exact_size_is_empty)]
#![feature(exclusive_range_pattern)]
#![feature(extend_one)]
#![feature(fmt_internals)]
#![feature(fn_traits)]
#![feature(fundamental)]
#![feature(inherent_ascii_escape)]
#![cfg_attr(bootstrap, feature(format_args_capture))]
#![feature(inplace_iteration)]
// Technically, this is a bug in rustdoc: rustdoc sees the documentation on `#[lang = slice_alloc]`
// blocks is for `&[T]`, which also has documentation using this feature in `core`, and gets mad
// that the feature-gate isn't enabled. Ideally, it wouldn't check for the feature gate for docs
// from other crates, but since this can only appear for lang items, it doesn't seem worth fixing.
#![feature(intra_doc_pointers)]
#![feature(iter_advance_by)]
#![feature(iter_zip)]
#![feature(lang_items)]
#![feature(layout_for_ptr)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(nll)]
#![feature(maybe_uninit_extra)]
#![feature(maybe_uninit_slice)]
#![cfg_attr(test, feature(new_uninit))]
#![feature(nonnull_slice_from_raw_parts)]
#![feature(auto_traits)]
#![feature(option_result_unwrap_unchecked)]
#![feature(pattern)]
#![feature(ptr_internals)]
#![feature(rustc_attrs)]
#![feature(receiver_trait)]
#![feature(min_specialization)]
#![feature(set_ptr_value)]
#![feature(slice_group_by)]
#![feature(slice_ptr_get)]
#![feature(slice_ptr_len)]
#![feature(slice_range)]
#![feature(staged_api)]
#![feature(str_internals)]
#![feature(trusted_len)]
#![feature(unboxed_closures)]
#![feature(trusted_random_access)]
#![feature(try_trait_v2)]
#![feature(unicode_internals)]
#![feature(unsize)]
#![feature(unsized_fn_params)]
//
// Language features:
#![feature(allocator_internals)]
#![feature(slice_partition_dedup)]
#![feature(maybe_uninit_extra, maybe_uninit_slice, maybe_uninit_uninit_array)]
#![feature(alloc_layout_extra)]
#![feature(trusted_random_access)]
#![feature(try_trait_v2)]
#![feature(allow_internal_unstable)]
#![feature(associated_type_bounds)]
#![feature(slice_group_by)]
#![feature(decl_macro)]
#![feature(box_syntax)]
#![feature(cfg_sanitize)]
#![feature(cfg_target_has_atomic)]
#![feature(const_fn_trait_bound)]
#![feature(const_trait_impl)]
#![feature(destructuring_assignment)]
#![feature(dropck_eyepatch)]
#![feature(exclusive_range_pattern)]
#![feature(fundamental)]
#![cfg_attr(not(test), feature(generator_trait))]
#![feature(lang_items)]
#![feature(min_specialization)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(nll)] // Not necessary, but here to test the `nll` feature.
#![feature(rustc_allow_const_fn_unstable)]
#![feature(rustc_attrs)]
#![feature(staged_api)]
#![cfg_attr(test, feature(test))]
#![feature(unboxed_closures)]
#![feature(unsized_fn_params)]
//
// Rustdoc features:
#![feature(doc_cfg)]
#![cfg_attr(not(bootstrap), feature(doc_cfg_hide))]
// Allow testing this library
#![feature(doc_cfg_hide)]
// Technically, this is a bug in rustdoc: rustdoc sees the documentation on `#[lang = slice_alloc]`
// blocks is for `&[T]`, which also has documentation using this feature in `core`, and gets mad
// that the feature-gate isn't enabled. Ideally, it wouldn't check for the feature gate for docs
// from other crates, but since this can only appear for lang items, it doesn't seem worth fixing.
#![feature(intra_doc_pointers)]

// Allow testing this library
#[cfg(test)]
#[macro_use]
extern crate std;
Expand All @@ -173,6 +177,8 @@ extern crate test;
#[macro_use]
mod macros;

mod raw_vec;

// Heaps provided for low-level allocation strategies

pub mod alloc;
Expand All @@ -191,7 +197,6 @@ mod boxed {
pub mod borrow;
pub mod collections;
pub mod fmt;
pub mod raw_vec;
#[cfg(not(no_rc))]
pub mod rc;
pub mod slice;
Expand Down
Loading

0 comments on commit 32e5120

Please sign in to comment.