Skip to content

Commit 8eed401

Browse files
ojedaKaz205
authored andcommitted
rust: upgrade to Rust 1.66.0
Reviewed-by: Björn Roy Baron <bjorn3_gh@protonmail.com> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Tested-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Gary Guo <gary@garyguo.net> Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 84b531f commit 8eed401

40 files changed

+1377
-471
lines changed

Documentation/process/changes.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ you probably needn't concern yourself with pcmciautils.
3131
====================== =============== ========================================
3232
GNU C 5.1 gcc --version
3333
Clang/LLVM (optional) 11.0.0 clang --version
34-
Rust (optional) 1.62.0 rustc --version
34+
Rust (optional) 1.66.0 rustc --version
3535
bindgen (optional) 0.56.0 bindgen --version
3636
GNU make 3.82 make --version
3737
bash 4.2 bash --version

drivers/android/process.rs

+2
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ impl ProcessInner {
149149
thread: Option<&Thread>,
150150
) -> NodeRef {
151151
self.update_node_refcount(&node, true, strong, false, thread);
152+
#[allow(clippy::bool_to_int_with_if)]
152153
let strong_count = if strong { 1 } else { 0 };
153154
NodeRef::new(node, strong_count, 1 - strong_count)
154155
}
@@ -430,6 +431,7 @@ impl Process {
430431
}
431432

432433
// Find id.
434+
#[allow(clippy::bool_to_int_with_if)]
433435
let mut target = if is_mananger { 0 } else { 1 };
434436
for handle in refs.by_handle.keys() {
435437
if *handle > target {

drivers/android/thread.rs

+1
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,7 @@ impl DeliverToRead for ThreadError {
858858
let code = self.error_code.load(Ordering::Relaxed);
859859

860860
// Return the `ThreadError` to the thread.
861+
#[allow(clippy::explicit_auto_deref)]
861862
(self.return_fn)(&mut *thread.inner.lock(), self);
862863

863864
// Deliver the error code to userspace.

rust/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ rust-analyzer:
394394

395395
$(obj)/core.o: private skip_clippy = 1
396396
$(obj)/core.o: private skip_flags = -Dunreachable_pub
397-
$(obj)/core.o: private rustc_target_flags = $(core-cfgs)
397+
$(obj)/core.o: private rustc_target_flags = $(core-cfgs) -Aunused-imports
398398
$(obj)/core.o: $(RUST_LIB_SRC)/core/src/lib.rs $(obj)/target.json FORCE
399399
$(call if_changed_dep,rustc_library)
400400

rust/alloc/alloc.rs

+18-8
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,23 @@ extern "Rust" {
2727
// (the code expanding that attribute macro generates those functions), or to call
2828
// the default implementations in libstd (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
2929
// otherwise.
30-
// The rustc fork of LLVM also special-cases these function names to be able to optimize them
30+
// The rustc fork of LLVM 14 and earlier also special-cases these function names to be able to optimize them
3131
// like `malloc`, `realloc`, and `free`, respectively.
3232
#[rustc_allocator]
33-
#[rustc_allocator_nounwind]
33+
#[cfg_attr(not(bootstrap), rustc_nounwind)]
34+
#[cfg_attr(bootstrap, rustc_allocator_nounwind)]
3435
fn __rust_alloc(size: usize, align: usize) -> *mut u8;
35-
#[rustc_allocator_nounwind]
36+
#[rustc_deallocator]
37+
#[cfg_attr(not(bootstrap), rustc_nounwind)]
38+
#[cfg_attr(bootstrap, rustc_allocator_nounwind)]
3639
fn __rust_dealloc(ptr: *mut u8, size: usize, align: usize);
37-
#[rustc_allocator_nounwind]
40+
#[rustc_reallocator]
41+
#[cfg_attr(not(bootstrap), rustc_nounwind)]
42+
#[cfg_attr(bootstrap, rustc_allocator_nounwind)]
3843
fn __rust_realloc(ptr: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
39-
#[rustc_allocator_nounwind]
44+
#[rustc_allocator_zeroed]
45+
#[cfg_attr(not(bootstrap), rustc_nounwind)]
46+
#[cfg_attr(bootstrap, rustc_allocator_nounwind)]
4047
fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;
4148
}
4249

@@ -72,11 +79,14 @@ pub use std::alloc::Global;
7279
/// # Examples
7380
///
7481
/// ```
75-
/// use std::alloc::{alloc, dealloc, Layout};
82+
/// use std::alloc::{alloc, dealloc, handle_alloc_error, Layout};
7683
///
7784
/// unsafe {
7885
/// let layout = Layout::new::<u16>();
7986
/// let ptr = alloc(layout);
87+
/// if ptr.is_null() {
88+
/// handle_alloc_error(layout);
89+
/// }
8090
///
8191
/// *(ptr as *mut u16) = 42;
8292
/// assert_eq!(*(ptr as *mut u16), 42);
@@ -400,13 +410,13 @@ pub mod __alloc_error_handler {
400410

401411
// if there is no `#[alloc_error_handler]`
402412
#[rustc_std_internal_symbol]
403-
pub unsafe extern "C-unwind" fn __rdl_oom(size: usize, _align: usize) -> ! {
413+
pub unsafe fn __rdl_oom(size: usize, _align: usize) -> ! {
404414
panic!("memory allocation of {size} bytes failed")
405415
}
406416

407417
// if there is an `#[alloc_error_handler]`
408418
#[rustc_std_internal_symbol]
409-
pub unsafe extern "C-unwind" fn __rg_oom(size: usize, align: usize) -> ! {
419+
pub unsafe fn __rg_oom(size: usize, align: usize) -> ! {
410420
let layout = unsafe { Layout::from_size_align_unchecked(size, align) };
411421
extern "Rust" {
412422
#[lang = "oom"]

rust/alloc/borrow.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use Cow::*;
2323
impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B>
2424
where
2525
B: ToOwned,
26-
<B as ToOwned>::Owned: 'a,
2726
{
2827
fn borrow(&self) -> &B {
2928
&**self
@@ -62,21 +61,20 @@ pub trait ToOwned {
6261

6362
/// Uses borrowed data to replace owned data, usually by cloning.
6463
///
65-
/// This is borrow-generalized version of `Clone::clone_from`.
64+
/// This is borrow-generalized version of [`Clone::clone_from`].
6665
///
6766
/// # Examples
6867
///
6968
/// Basic usage:
7069
///
7170
/// ```
72-
/// # #![feature(toowned_clone_into)]
7371
/// let mut s: String = String::new();
7472
/// "hello".clone_into(&mut s);
7573
///
7674
/// let mut v: Vec<i32> = Vec::new();
7775
/// [1, 2][..].clone_into(&mut v);
7876
/// ```
79-
#[unstable(feature = "toowned_clone_into", reason = "recently added", issue = "41263")]
77+
#[stable(feature = "toowned_clone_into", since = "1.63.0")]
8078
fn clone_into(&self, target: &mut Self::Owned) {
8179
*target = self.to_owned();
8280
}

0 commit comments

Comments
 (0)