Skip to content

Commit

Permalink
Merge pull request Rust-for-Linux#947 from ojeda/1.66.0
Browse files Browse the repository at this point in the history
rust: upgrade to Rust 1.66.0
  • Loading branch information
ojeda committed Jan 11, 2023
2 parents bd12347 + c93ddbb commit 84b0fc2
Show file tree
Hide file tree
Showing 41 changed files with 1,393 additions and 472 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
ci:
runs-on: ubuntu-20.04
container: ghcr.io/rust-for-linux/ci:Rust-1.62.0-2
container: ghcr.io/rust-for-linux/ci:Rust-1.66.0
timeout-minutes: 25

strategy:
Expand Down
2 changes: 1 addition & 1 deletion Documentation/process/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ you probably needn't concern yourself with pcmciautils.
====================== =============== ========================================
GNU C 5.1 gcc --version
Clang/LLVM (optional) 11.0.0 clang --version
Rust (optional) 1.62.0 rustc --version
Rust (optional) 1.66.0 rustc --version
bindgen (optional) 0.56.0 bindgen --version
GNU make 3.82 make --version
bash 4.2 bash --version
Expand Down
2 changes: 2 additions & 0 deletions drivers/android/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ impl ProcessInner {
thread: Option<&Thread>,
) -> NodeRef {
self.update_node_refcount(&node, true, strong, false, thread);
#[allow(clippy::bool_to_int_with_if)]
let strong_count = if strong { 1 } else { 0 };
NodeRef::new(node, strong_count, 1 - strong_count)
}
Expand Down Expand Up @@ -430,6 +431,7 @@ impl Process {
}

// Find id.
#[allow(clippy::bool_to_int_with_if)]
let mut target = if is_mananger { 0 } else { 1 };
for handle in refs.by_handle.keys() {
if *handle > target {
Expand Down
1 change: 1 addition & 0 deletions drivers/android/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -858,6 +858,7 @@ impl DeliverToRead for ThreadError {
let code = self.error_code.load(Ordering::Relaxed);

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

// Deliver the error code to userspace.
Expand Down
2 changes: 1 addition & 1 deletion rust/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ rust-analyzer:

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

Expand Down
26 changes: 18 additions & 8 deletions rust/alloc/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,23 @@ extern "Rust" {
// (the code expanding that attribute macro generates those functions), or to call
// the default implementations in libstd (`__rdl_alloc` etc. in `library/std/src/alloc.rs`)
// otherwise.
// The rustc fork of LLVM also special-cases these function names to be able to optimize them
// The rustc fork of LLVM 14 and earlier also special-cases these function names to be able to optimize them
// like `malloc`, `realloc`, and `free`, respectively.
#[rustc_allocator]
#[rustc_allocator_nounwind]
#[cfg_attr(not(bootstrap), rustc_nounwind)]
#[cfg_attr(bootstrap, rustc_allocator_nounwind)]
fn __rust_alloc(size: usize, align: usize) -> *mut u8;
#[rustc_allocator_nounwind]
#[rustc_deallocator]
#[cfg_attr(not(bootstrap), rustc_nounwind)]
#[cfg_attr(bootstrap, rustc_allocator_nounwind)]
fn __rust_dealloc(ptr: *mut u8, size: usize, align: usize);
#[rustc_allocator_nounwind]
#[rustc_reallocator]
#[cfg_attr(not(bootstrap), rustc_nounwind)]
#[cfg_attr(bootstrap, rustc_allocator_nounwind)]
fn __rust_realloc(ptr: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
#[rustc_allocator_nounwind]
#[rustc_allocator_zeroed]
#[cfg_attr(not(bootstrap), rustc_nounwind)]
#[cfg_attr(bootstrap, rustc_allocator_nounwind)]
fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8;
}

Expand Down Expand Up @@ -72,11 +79,14 @@ pub use std::alloc::Global;
/// # Examples
///
/// ```
/// use std::alloc::{alloc, dealloc, Layout};
/// use std::alloc::{alloc, dealloc, handle_alloc_error, Layout};
///
/// unsafe {
/// let layout = Layout::new::<u16>();
/// let ptr = alloc(layout);
/// if ptr.is_null() {
/// handle_alloc_error(layout);
/// }
///
/// *(ptr as *mut u16) = 42;
/// assert_eq!(*(ptr as *mut u16), 42);
Expand Down Expand Up @@ -400,13 +410,13 @@ pub mod __alloc_error_handler {

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

// if there is an `#[alloc_error_handler]`
#[rustc_std_internal_symbol]
pub unsafe extern "C-unwind" fn __rg_oom(size: usize, align: usize) -> ! {
pub unsafe fn __rg_oom(size: usize, align: usize) -> ! {
let layout = unsafe { Layout::from_size_align_unchecked(size, align) };
extern "Rust" {
#[lang = "oom"]
Expand Down
6 changes: 2 additions & 4 deletions rust/alloc/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use Cow::*;
impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B>
where
B: ToOwned,
<B as ToOwned>::Owned: 'a,
{
fn borrow(&self) -> &B {
&**self
Expand Down Expand Up @@ -62,21 +61,20 @@ pub trait ToOwned {

/// Uses borrowed data to replace owned data, usually by cloning.
///
/// This is borrow-generalized version of `Clone::clone_from`.
/// This is borrow-generalized version of [`Clone::clone_from`].
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// # #![feature(toowned_clone_into)]
/// let mut s: String = String::new();
/// "hello".clone_into(&mut s);
///
/// let mut v: Vec<i32> = Vec::new();
/// [1, 2][..].clone_into(&mut v);
/// ```
#[unstable(feature = "toowned_clone_into", reason = "recently added", issue = "41263")]
#[stable(feature = "toowned_clone_into", since = "1.63.0")]
fn clone_into(&self, target: &mut Self::Owned) {
*target = self.to_owned();
}
Expand Down

0 comments on commit 84b0fc2

Please sign in to comment.