From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/box/alloc-unstable-fail.rs | 6 ---- src/test/ui/box/alloc-unstable-fail.stderr | 12 ------- src/test/ui/box/alloc-unstable.rs | 8 ----- src/test/ui/box/into-boxed-slice-fail.rs | 14 -------- src/test/ui/box/into-boxed-slice-fail.stderr | 51 ---------------------------- src/test/ui/box/into-boxed-slice.rs | 11 ------ src/test/ui/box/issue-82446.rs | 15 -------- src/test/ui/box/issue-82446.stderr | 12 ------- src/test/ui/box/issue-95036.rs | 22 ------------ src/test/ui/box/large-allocator-ice.rs | 29 ---------------- src/test/ui/box/leak-alloc.rs | 29 ---------------- src/test/ui/box/leak-alloc.stderr | 15 -------- src/test/ui/box/new-box-syntax.rs | 27 --------------- src/test/ui/box/new-box.rs | 30 ---------------- src/test/ui/box/new.rs | 6 ---- src/test/ui/box/thin_align.rs | 26 -------------- src/test/ui/box/thin_drop.rs | 37 -------------------- src/test/ui/box/thin_new.rs | 30 ---------------- src/test/ui/box/thin_zst.rs | 34 ------------------- 19 files changed, 414 deletions(-) delete mode 100644 src/test/ui/box/alloc-unstable-fail.rs delete mode 100644 src/test/ui/box/alloc-unstable-fail.stderr delete mode 100644 src/test/ui/box/alloc-unstable.rs delete mode 100644 src/test/ui/box/into-boxed-slice-fail.rs delete mode 100644 src/test/ui/box/into-boxed-slice-fail.stderr delete mode 100644 src/test/ui/box/into-boxed-slice.rs delete mode 100644 src/test/ui/box/issue-82446.rs delete mode 100644 src/test/ui/box/issue-82446.stderr delete mode 100644 src/test/ui/box/issue-95036.rs delete mode 100644 src/test/ui/box/large-allocator-ice.rs delete mode 100644 src/test/ui/box/leak-alloc.rs delete mode 100644 src/test/ui/box/leak-alloc.stderr delete mode 100644 src/test/ui/box/new-box-syntax.rs delete mode 100644 src/test/ui/box/new-box.rs delete mode 100644 src/test/ui/box/new.rs delete mode 100644 src/test/ui/box/thin_align.rs delete mode 100644 src/test/ui/box/thin_drop.rs delete mode 100644 src/test/ui/box/thin_new.rs delete mode 100644 src/test/ui/box/thin_zst.rs (limited to 'src/test/ui/box') diff --git a/src/test/ui/box/alloc-unstable-fail.rs b/src/test/ui/box/alloc-unstable-fail.rs deleted file mode 100644 index 942757164..000000000 --- a/src/test/ui/box/alloc-unstable-fail.rs +++ /dev/null @@ -1,6 +0,0 @@ -use std::boxed::Box; - -fn main() { - let _boxed: Box = Box::new(10); - //~^ ERROR use of unstable library feature 'allocator_api' -} diff --git a/src/test/ui/box/alloc-unstable-fail.stderr b/src/test/ui/box/alloc-unstable-fail.stderr deleted file mode 100644 index 03ae36e88..000000000 --- a/src/test/ui/box/alloc-unstable-fail.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: use of unstable library feature 'allocator_api' - --> $DIR/alloc-unstable-fail.rs:4:26 - | -LL | let _boxed: Box = Box::new(10); - | ^ - | - = note: see issue #32838 for more information - = help: add `#![feature(allocator_api)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/box/alloc-unstable.rs b/src/test/ui/box/alloc-unstable.rs deleted file mode 100644 index 66388d0d5..000000000 --- a/src/test/ui/box/alloc-unstable.rs +++ /dev/null @@ -1,8 +0,0 @@ -// run-pass -#![feature(allocator_api)] - -use std::boxed::Box; - -fn main() { - let _boxed: Box = Box::new(10); -} diff --git a/src/test/ui/box/into-boxed-slice-fail.rs b/src/test/ui/box/into-boxed-slice-fail.rs deleted file mode 100644 index 49dbb170f..000000000 --- a/src/test/ui/box/into-boxed-slice-fail.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(box_into_boxed_slice)] - -use std::boxed::Box; -use std::fmt::Debug; -fn main() { - let boxed_slice = Box::new([1,2,3]) as Box<[u8]>; - let _ = Box::into_boxed_slice(boxed_slice); - //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time - //~^^ ERROR the size for values of type `[u8]` cannot be known at compilation time - let boxed_trait: Box = Box::new(5u8); - let _ = Box::into_boxed_slice(boxed_trait); - //~^ ERROR the size for values of type `dyn Debug` cannot be known at compilation time - //~^^ ERROR the size for values of type `dyn Debug` cannot be known at compilation time -} diff --git a/src/test/ui/box/into-boxed-slice-fail.stderr b/src/test/ui/box/into-boxed-slice-fail.stderr deleted file mode 100644 index de654fdc1..000000000 --- a/src/test/ui/box/into-boxed-slice-fail.stderr +++ /dev/null @@ -1,51 +0,0 @@ -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/into-boxed-slice-fail.rs:7:35 - | -LL | let _ = Box::into_boxed_slice(boxed_slice); - | --------------------- ^^^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `[u8]` -note: required by a bound in `Box::::into_boxed_slice` - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - | -LL | impl Box { - | ^ required by this bound in `Box::::into_boxed_slice` - -error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/into-boxed-slice-fail.rs:7:13 - | -LL | let _ = Box::into_boxed_slice(boxed_slice); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[u8]` - = note: slice and array elements must have `Sized` type - -error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time - --> $DIR/into-boxed-slice-fail.rs:11:35 - | -LL | let _ = Box::into_boxed_slice(boxed_trait); - | --------------------- ^^^^^^^^^^^ doesn't have a size known at compile-time - | | - | required by a bound introduced by this call - | - = help: the trait `Sized` is not implemented for `dyn Debug` -note: required by a bound in `Box::::into_boxed_slice` - --> $SRC_DIR/alloc/src/boxed.rs:LL:COL - | -LL | impl Box { - | ^ required by this bound in `Box::::into_boxed_slice` - -error[E0277]: the size for values of type `dyn Debug` cannot be known at compilation time - --> $DIR/into-boxed-slice-fail.rs:11:13 - | -LL | let _ = Box::into_boxed_slice(boxed_trait); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `dyn Debug` - = note: slice and array elements must have `Sized` type - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/box/into-boxed-slice.rs b/src/test/ui/box/into-boxed-slice.rs deleted file mode 100644 index 61b3d9152..000000000 --- a/src/test/ui/box/into-boxed-slice.rs +++ /dev/null @@ -1,11 +0,0 @@ -// run-pass -#![feature(box_into_boxed_slice)] - -use std::boxed::Box; -fn main() { - assert_eq!(Box::into_boxed_slice(Box::new(5u8)), Box::new([5u8]) as Box<[u8]>); - assert_eq!(Box::into_boxed_slice(Box::new([25u8])), Box::new([[25u8]]) as Box<[[u8; 1]]>); - let a: Box<[Box<[u8; 1]>]> = Box::into_boxed_slice(Box::new(Box::new([5u8]))); - let b: Box<[Box<[u8; 1]>]> = Box::new([Box::new([5u8])]); - assert_eq!(a, b); -} diff --git a/src/test/ui/box/issue-82446.rs b/src/test/ui/box/issue-82446.rs deleted file mode 100644 index 2960f7fbc..000000000 --- a/src/test/ui/box/issue-82446.rs +++ /dev/null @@ -1,15 +0,0 @@ -// https://github.com/rust-lang/rust/issues/82446 -// Spurious 'help: store this in the heap' regression test -trait MyTrait {} - -struct Foo { - val: Box -} - -fn make_it(val: &Box) { - Foo { - val //~ ERROR [E0308] - }; -} - -fn main() {} diff --git a/src/test/ui/box/issue-82446.stderr b/src/test/ui/box/issue-82446.stderr deleted file mode 100644 index 037473795..000000000 --- a/src/test/ui/box/issue-82446.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-82446.rs:11:9 - | -LL | val - | ^^^ expected struct `Box`, found reference - | - = note: expected struct `Box<(dyn MyTrait + 'static)>` - found reference `&Box<(dyn MyTrait + 'static)>` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/box/issue-95036.rs b/src/test/ui/box/issue-95036.rs deleted file mode 100644 index 0611fabc1..000000000 --- a/src/test/ui/box/issue-95036.rs +++ /dev/null @@ -1,22 +0,0 @@ -// compile-flags: -O -// build-pass - -#![feature(allocator_api)] - -#[inline(never)] -pub fn by_ref(node: &mut Box<[u8; 1], &std::alloc::Global>) { - node[0] = 9u8; -} - -pub fn main() { - let mut node = Box::new_in([5u8], &std::alloc::Global); - node[0] = 7u8; - - std::hint::black_box(node); - - let mut node = Box::new_in([5u8], &std::alloc::Global); - - by_ref(&mut node); - - std::hint::black_box(node); -} diff --git a/src/test/ui/box/large-allocator-ice.rs b/src/test/ui/box/large-allocator-ice.rs deleted file mode 100644 index b3a882ff0..000000000 --- a/src/test/ui/box/large-allocator-ice.rs +++ /dev/null @@ -1,29 +0,0 @@ -// build-pass -#![feature(allocator_api)] -#![allow(unused_must_use)] - -use std::alloc::Allocator; - -struct BigAllocator([usize; 2]); - -unsafe impl Allocator for BigAllocator { - fn allocate( - &self, - _: std::alloc::Layout, - ) -> Result, std::alloc::AllocError> { - todo!() - } - unsafe fn deallocate(&self, _: std::ptr::NonNull, _: std::alloc::Layout) { - todo!() - } -} - -fn main() { - Box::new_in((), &std::alloc::Global); - Box::new_in((), BigAllocator([0; 2])); - generic_function(0); -} - -fn generic_function(val: T) { - *Box::new_in(val, &std::alloc::Global); -} diff --git a/src/test/ui/box/leak-alloc.rs b/src/test/ui/box/leak-alloc.rs deleted file mode 100644 index 3f0f39f44..000000000 --- a/src/test/ui/box/leak-alloc.rs +++ /dev/null @@ -1,29 +0,0 @@ -#![feature(allocator_api)] - -use std::alloc::{AllocError, Allocator, Layout, System}; -use std::ptr::NonNull; - -use std::boxed::Box; - -struct Alloc {} - -unsafe impl Allocator for Alloc { - fn allocate(&self, layout: Layout) -> Result, AllocError> { - System.allocate(layout) - } - - unsafe fn deallocate(&self, ptr: NonNull, layout: Layout) { - System.deallocate(ptr, layout) - } -} - -fn use_value(_: u32) {} - -fn main() { - let alloc = Alloc {}; - let boxed = Box::new_in(10, alloc.by_ref()); - let theref = Box::leak(boxed); - drop(alloc); - //~^ ERROR cannot move out of `alloc` because it is borrowed - use_value(*theref) -} diff --git a/src/test/ui/box/leak-alloc.stderr b/src/test/ui/box/leak-alloc.stderr deleted file mode 100644 index e8a6ad099..000000000 --- a/src/test/ui/box/leak-alloc.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0505]: cannot move out of `alloc` because it is borrowed - --> $DIR/leak-alloc.rs:26:10 - | -LL | let boxed = Box::new_in(10, alloc.by_ref()); - | -------------- borrow of `alloc` occurs here -LL | let theref = Box::leak(boxed); -LL | drop(alloc); - | ^^^^^ move out of `alloc` occurs here -LL | -LL | use_value(*theref) - | ------- borrow later used here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0505`. diff --git a/src/test/ui/box/new-box-syntax.rs b/src/test/ui/box/new-box-syntax.rs deleted file mode 100644 index c56e1dd46..000000000 --- a/src/test/ui/box/new-box-syntax.rs +++ /dev/null @@ -1,27 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -#![allow(dead_code, unused_variables)] - -// Tests that the new `box` syntax works with unique pointers. - -use std::boxed::Box; - -struct Structure { - x: isize, - y: isize, -} - -pub fn main() { - let y: Box = Box::new(2); - let b: Box = Box::new(1 + 2); - let c = Box::new(3 + 4); - - let s: Box = Box::new(Structure { - x: 3, - y: 4, - }); -} diff --git a/src/test/ui/box/new-box.rs b/src/test/ui/box/new-box.rs deleted file mode 100644 index 96a3b197f..000000000 --- a/src/test/ui/box/new-box.rs +++ /dev/null @@ -1,30 +0,0 @@ -// run-pass - -fn f(x: Box) { - let y: &isize = &*x; - println!("{}", *x); - println!("{}", *y); -} - -trait Trait { - fn printme(&self); -} - -struct Struct; - -impl Trait for Struct { - fn printme(&self) { - println!("hello world!"); - } -} - -fn g(x: Box) { - x.printme(); - let y: &dyn Trait = &*x; - y.printme(); -} - -fn main() { - f(Box::new(1234)); - g(Box::new(Struct) as Box); -} diff --git a/src/test/ui/box/new.rs b/src/test/ui/box/new.rs deleted file mode 100644 index be1a40cf7..000000000 --- a/src/test/ui/box/new.rs +++ /dev/null @@ -1,6 +0,0 @@ -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - let _a = Box::new(1); -} diff --git a/src/test/ui/box/thin_align.rs b/src/test/ui/box/thin_align.rs deleted file mode 100644 index 3c61d0090..000000000 --- a/src/test/ui/box/thin_align.rs +++ /dev/null @@ -1,26 +0,0 @@ -#![feature(thin_box)] -// run-pass -use std::boxed::ThinBox; -use std::error::Error; -use std::ops::Deref; -use std::fmt; - -fn main() { - let expected = "Foo error!"; - let a: ThinBox = ThinBox::new_unsize(Foo(expected)); - let a = a.deref(); - let msg = a.to_string(); - assert_eq!(expected, msg); -} - -#[derive(Debug)] -#[repr(align(1024))] -struct Foo(&'static str); - -impl fmt::Display for Foo { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.0) - } -} - -impl Error for Foo {} diff --git a/src/test/ui/box/thin_drop.rs b/src/test/ui/box/thin_drop.rs deleted file mode 100644 index 965613c11..000000000 --- a/src/test/ui/box/thin_drop.rs +++ /dev/null @@ -1,37 +0,0 @@ -#![feature(thin_box)] -// run-pass -use std::boxed::ThinBox; -use std::error::Error; -use std::ops::Deref; -use std::fmt; - -fn main() { - let expected = "Foo error!"; - let mut dropped = false; - { - let foo = Foo(expected, &mut dropped); - let a: ThinBox = ThinBox::new_unsize(foo); - let a = a.deref(); - let msg = a.to_string(); - assert_eq!(expected, msg); - } - assert!(dropped); -} - -#[derive(Debug)] -#[repr(align(1024))] -struct Foo<'a>(&'static str, &'a mut bool); - -impl Drop for Foo<'_> { - fn drop(&mut self) { - *self.1 = true; - } -} - -impl fmt::Display for Foo<'_> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.0) - } -} - -impl Error for Foo<'_> {} diff --git a/src/test/ui/box/thin_new.rs b/src/test/ui/box/thin_new.rs deleted file mode 100644 index 53f46478b..000000000 --- a/src/test/ui/box/thin_new.rs +++ /dev/null @@ -1,30 +0,0 @@ -#![feature(thin_box)] -// run-pass -use std::boxed::ThinBox; -use std::error::Error; -use std::{fmt, mem}; - -fn main() { - let thin_error: ThinBox = ThinBox::new_unsize(Foo); - assert_eq!(mem::size_of::<*const i32>(), mem::size_of_val(&thin_error)); - println!("{:?}", thin_error); - - let thin = ThinBox::new(42i32); - assert_eq!(mem::size_of::<*const i32>(), mem::size_of_val(&thin)); - println!("{:?}", thin); - - let thin_slice = ThinBox::<[i32]>::new_unsize([1, 2, 3, 4]); - assert_eq!(mem::size_of::<*const i32>(), mem::size_of_val(&thin_slice)); - println!("{:?}", thin_slice); -} - -#[derive(Debug)] -struct Foo; - -impl fmt::Display for Foo { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "boooo!") - } -} - -impl Error for Foo {} diff --git a/src/test/ui/box/thin_zst.rs b/src/test/ui/box/thin_zst.rs deleted file mode 100644 index 77c400d17..000000000 --- a/src/test/ui/box/thin_zst.rs +++ /dev/null @@ -1,34 +0,0 @@ -#![feature(thin_box)] -// run-pass -use std::boxed::ThinBox; -use std::error::Error; -use std::{fmt, mem}; -use std::ops::DerefMut; - -const EXPECTED: &str = "boooo!"; - -fn main() { - let thin_error: ThinBox = ThinBox::new_unsize(Foo); - assert_eq!(mem::size_of::<*const i32>(), mem::size_of_val(&thin_error)); - let msg = thin_error.to_string(); - assert_eq!(EXPECTED, msg); - - let mut thin_concrete_error: ThinBox = ThinBox::new(Foo); - assert_eq!(mem::size_of::<*const i32>(), mem::size_of_val(&thin_concrete_error)); - let msg = thin_concrete_error.to_string(); - assert_eq!(EXPECTED, msg); - let inner = thin_concrete_error.deref_mut(); - let msg = inner.to_string(); - assert_eq!(EXPECTED, msg); -} - -#[derive(Debug)] -struct Foo; - -impl fmt::Display for Foo { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", EXPECTED) - } -} - -impl Error for Foo {} -- cgit v1.2.3