Skip to content

Commit 5f41e7b

Browse files
authored
Merge pull request #686 from ojeda/rust-1.59.0
Rust 1.59.0
2 parents e2c5979 + 184ab6e commit 5f41e7b

File tree

17 files changed

+404
-174
lines changed

17 files changed

+404
-174
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
ci:
99
runs-on: ubuntu-20.04
10-
container: ghcr.io/rust-for-linux/ci
10+
container: ghcr.io/rust-for-linux/ci:Rust-1.59.0
1111
timeout-minutes: 20
1212

1313
strategy:

Documentation/process/changes.rst

Lines changed: 1 addition & 1 deletion
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.58.0 rustc --version
34+
Rust (optional) 1.59.0 rustc --version
3535
bindgen (optional) 0.56.0 bindgen --version
3636
GNU make 3.81 make --version
3737
binutils 2.23 ld -v

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,8 @@ KBUILD_RUST_TARGET := $(srctree)/arch/$(SRCARCH)/rust/target.json
536536
KBUILD_RUSTFLAGS := --edition=2021 \
537537
-Cpanic=abort -Cembed-bitcode=n -Clto=n -Crpath=n \
538538
-Cforce-unwind-tables=n -Ccodegen-units=1 \
539-
-Zbinary_dep_depinfo=y -Zsymbol-mangling-version=v0 \
539+
-Csymbol-mangling-version=v0 \
540+
-Zbinary_dep_depinfo=y \
540541
-Dunsafe_op_in_unsafe_fn -Drust_2018_idioms \
541542
-Dunreachable_pub -Dnon_ascii_idents \
542543
-Wmissing_docs \

rust/alloc/alloc.rs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,17 +325,21 @@ unsafe fn exchange_malloc(size: usize, align: usize) -> *mut u8 {
325325

326326
#[cfg_attr(not(test), lang = "box_free")]
327327
#[inline]
328+
#[rustc_const_unstable(feature = "const_box", issue = "92521")]
328329
// This signature has to be the same as `Box`, otherwise an ICE will happen.
329330
// When an additional parameter to `Box` is added (like `A: Allocator`), this has to be added here as
330331
// well.
331332
// For example if `Box` is changed to `struct Box<T: ?Sized, A: Allocator>(Unique<T>, A)`,
332333
// this function has to be changed to `fn box_free<T: ?Sized, A: Allocator>(Unique<T>, A)` as well.
333-
pub(crate) unsafe fn box_free<T: ?Sized, A: Allocator>(ptr: Unique<T>, alloc: A) {
334+
pub(crate) const unsafe fn box_free<T: ?Sized, A: ~const Allocator + ~const Drop>(
335+
ptr: Unique<T>,
336+
alloc: A,
337+
) {
334338
unsafe {
335339
let size = size_of_val(ptr.as_ref());
336340
let align = min_align_of_val(ptr.as_ref());
337341
let layout = Layout::from_size_align_unchecked(size, align);
338-
alloc.deallocate(ptr.cast().into(), layout)
342+
alloc.deallocate(From::from(ptr.cast()), layout)
339343
}
340344
}
341345

@@ -363,13 +367,22 @@ extern "Rust" {
363367
/// [`set_alloc_error_hook`]: ../../std/alloc/fn.set_alloc_error_hook.html
364368
/// [`take_alloc_error_hook`]: ../../std/alloc/fn.take_alloc_error_hook.html
365369
#[stable(feature = "global_alloc", since = "1.28.0")]
370+
#[rustc_const_unstable(feature = "const_alloc_error", issue = "92523")]
366371
#[cfg(all(not(no_global_oom_handling), not(test)))]
367372
#[rustc_allocator_nounwind]
368373
#[cold]
369-
pub fn handle_alloc_error(layout: Layout) -> ! {
370-
unsafe {
371-
__rust_alloc_error_handler(layout.size(), layout.align());
374+
pub const fn handle_alloc_error(layout: Layout) -> ! {
375+
const fn ct_error(_: Layout) -> ! {
376+
panic!("allocation failed");
372377
}
378+
379+
fn rt_error(layout: Layout) -> ! {
380+
unsafe {
381+
__rust_alloc_error_handler(layout.size(), layout.align());
382+
}
383+
}
384+
385+
unsafe { core::intrinsics::const_eval_select((layout,), ct_error, rt_error) }
373386
}
374387

375388
// For alloc test `std::alloc::handle_alloc_error` can be used directly.

rust/alloc/borrow.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ where
172172
/// clone_on_write.values.to_mut().push(3);
173173
/// println!("clone_on_write = {:?}", clone_on_write.values);
174174
///
175-
/// // The data was mutated. Let check it out.
175+
/// // The data was mutated. Let's check it out.
176176
/// match clone_on_write {
177177
/// Items { values: Cow::Owned(_) } => println!("clone_on_write contains owned data"),
178178
/// _ => panic!("expect owned data"),

0 commit comments

Comments
 (0)