summaryrefslogtreecommitdiffstats
path: root/src/test/ui/codegen
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/codegen
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/codegen')
-rw-r--r--src/test/ui/codegen/auxiliary/issue-97708-aux.rs41
-rw-r--r--src/test/ui/codegen/auxiliary/llvm_pr32379.rs5
-rw-r--r--src/test/ui/codegen/init-large-type.rs23
-rw-r--r--src/test/ui/codegen/issue-101585-128bit-repeat.rs14
-rw-r--r--src/test/ui/codegen/issue-16602-1.rs6
-rw-r--r--src/test/ui/codegen/issue-16602-2.rs12
-rw-r--r--src/test/ui/codegen/issue-16602-3.rs28
-rw-r--r--src/test/ui/codegen/issue-28950.rs22
-rw-r--r--src/test/ui/codegen/issue-63787.rs36
-rw-r--r--src/test/ui/codegen/issue-64401.rs51
-rw-r--r--src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs35
-rw-r--r--src/test/ui/codegen/issue-97708.rs9
-rw-r--r--src/test/ui/codegen/issue-99551.rs20
-rw-r--r--src/test/ui/codegen/llvm-pr32379.rs14
14 files changed, 0 insertions, 316 deletions
diff --git a/src/test/ui/codegen/auxiliary/issue-97708-aux.rs b/src/test/ui/codegen/auxiliary/issue-97708-aux.rs
deleted file mode 100644
index e296bd391..000000000
--- a/src/test/ui/codegen/auxiliary/issue-97708-aux.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-use std::{ptr::NonNull, task::Poll};
-
-struct TaskRef;
-
-struct Header {
- vtable: &'static Vtable,
-}
-
-struct Vtable {
- poll: unsafe fn(TaskRef) -> Poll<()>,
- deallocate: unsafe fn(NonNull<Header>),
-}
-
-// in the "Header" type, which is a private type in maitake
-impl Header {
- pub(crate) const fn new_stub() -> Self {
- unsafe fn nop(_ptr: TaskRef) -> Poll<()> {
- Poll::Pending
- }
-
- unsafe fn nop_deallocate(ptr: NonNull<Header>) {
- unreachable!("stub task ({ptr:p}) should never be deallocated!");
- }
-
- Self { vtable: &Vtable { poll: nop, deallocate: nop_deallocate } }
- }
-}
-
-// This is a public type in `maitake`
-#[repr(transparent)]
-#[cfg_attr(loom, allow(dead_code))]
-pub struct TaskStub {
- hdr: Header,
-}
-
-impl TaskStub {
- /// Create a new unique stub [`Task`].
- pub const fn new() -> Self {
- Self { hdr: Header::new_stub() }
- }
-}
diff --git a/src/test/ui/codegen/auxiliary/llvm_pr32379.rs b/src/test/ui/codegen/auxiliary/llvm_pr32379.rs
deleted file mode 100644
index 8e4297670..000000000
--- a/src/test/ui/codegen/auxiliary/llvm_pr32379.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-pub fn pr32379(mut data: u64, f1: bool, f2: bool) -> u64 {
- if f1 { data &= !2; }
- if f2 { data |= 2; }
- data
-}
diff --git a/src/test/ui/codegen/init-large-type.rs b/src/test/ui/codegen/init-large-type.rs
deleted file mode 100644
index ce905572f..000000000
--- a/src/test/ui/codegen/init-large-type.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// compile-flags: -O
-// run-pass
-
-#![allow(unused_must_use)]
-// Makes sure that zero-initializing large types is reasonably fast,
-// Doing it incorrectly causes massive slowdown in LLVM during
-// optimisation.
-
-// pretty-expanded FIXME #23616
-// ignore-emscripten no threads support
-
-#![feature(intrinsics)]
-
-use std::{mem, thread};
-
-const SIZE: usize = 1024 * 1024;
-
-fn main() {
- // do the test in a new thread to avoid (spurious?) stack overflows
- thread::spawn(|| {
- let _memory: [u8; SIZE] = unsafe { mem::zeroed() };
- }).join();
-}
diff --git a/src/test/ui/codegen/issue-101585-128bit-repeat.rs b/src/test/ui/codegen/issue-101585-128bit-repeat.rs
deleted file mode 100644
index c6a686597..000000000
--- a/src/test/ui/codegen/issue-101585-128bit-repeat.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Regression test for issue 101585.
-// run-pass
-
-fn main() {
- fn min_array_ok() -> [i128; 1] {
- [i128::MIN]
- }
- assert_eq!(min_array_ok(), [-170141183460469231731687303715884105728i128]);
-
- fn min_array_nok() -> [i128; 1] {
- [i128::MIN; 1]
- }
- assert_eq!(min_array_nok(), [-170141183460469231731687303715884105728i128]);
-}
diff --git a/src/test/ui/codegen/issue-16602-1.rs b/src/test/ui/codegen/issue-16602-1.rs
deleted file mode 100644
index dd64ee75b..000000000
--- a/src/test/ui/codegen/issue-16602-1.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-// run-pass
-fn main() {
- let mut t = [1; 2];
- t = [t[1] * 2, t[0] * 2];
- assert_eq!(&t[..], &[2, 2]);
-}
diff --git a/src/test/ui/codegen/issue-16602-2.rs b/src/test/ui/codegen/issue-16602-2.rs
deleted file mode 100644
index 6364630ff..000000000
--- a/src/test/ui/codegen/issue-16602-2.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// run-pass
-struct A {
- pub x: u32,
- pub y: u32,
-}
-
-fn main() {
- let mut a = A { x: 1, y: 1 };
- a = A { x: a.y * 2, y: a.x * 2 };
- assert_eq!(a.x, 2);
- assert_eq!(a.y, 2);
-}
diff --git a/src/test/ui/codegen/issue-16602-3.rs b/src/test/ui/codegen/issue-16602-3.rs
deleted file mode 100644
index ca1ab3cc7..000000000
--- a/src/test/ui/codegen/issue-16602-3.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// run-pass
-#![allow(unused_variables)]
-#![allow(unused_assignments)]
-#[derive(Debug)]
-#[allow(unused_tuple_struct_fields)]
-enum Foo {
- Bar(u32, u32),
- Baz(&'static u32, &'static u32)
-}
-
-static NUM: u32 = 100;
-
-fn main () {
- let mut b = Foo::Baz(&NUM, &NUM);
- b = Foo::Bar(f(&b), g(&b));
-}
-
-static FNUM: u32 = 1;
-
-fn f (b: &Foo) -> u32 {
- FNUM
-}
-
-static GNUM: u32 = 2;
-
-fn g (b: &Foo) -> u32 {
- GNUM
-}
diff --git a/src/test/ui/codegen/issue-28950.rs b/src/test/ui/codegen/issue-28950.rs
deleted file mode 100644
index 8b55f42f3..000000000
--- a/src/test/ui/codegen/issue-28950.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// run-pass
-// ignore-emscripten no threads
-// compile-flags: -O
-
-// Tests that the `vec!` macro does not overflow the stack when it is
-// given data larger than the stack.
-
-// FIXME(eddyb) Improve unoptimized codegen to avoid the temporary,
-// and thus run successfully even when compiled at -C opt-level=0.
-
-const LEN: usize = 1 << 15;
-
-use std::thread::Builder;
-
-fn main() {
- assert!(Builder::new().stack_size(LEN / 2).spawn(|| {
- // FIXME(eddyb) this can be vec![[0: LEN]] pending
- // https://llvm.org/bugs/show_bug.cgi?id=28987
- let vec = vec![unsafe { std::mem::zeroed::<[u8; LEN]>() }];
- assert_eq!(vec.len(), 1);
- }).unwrap().join().is_ok());
-}
diff --git a/src/test/ui/codegen/issue-63787.rs b/src/test/ui/codegen/issue-63787.rs
deleted file mode 100644
index cba079b23..000000000
--- a/src/test/ui/codegen/issue-63787.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// run-pass
-// compile-flags: -O
-
-// Make sure that `Ref` and `RefMut` do not make false promises about aliasing,
-// because once they drop, their reference/pointer can alias other writes.
-
-// Adapted from comex's proof of concept:
-// https://github.com/rust-lang/rust/issues/63787#issuecomment-523588164
-
-use std::cell::RefCell;
-use std::ops::Deref;
-
-pub fn break_if_r_is_noalias(rc: &RefCell<i32>, r: impl Deref<Target = i32>) -> i32 {
- let ptr1 = &*r as *const i32;
- let a = *r;
- drop(r);
- *rc.borrow_mut() = 2;
- let r2 = rc.borrow();
- let ptr2 = &*r2 as *const i32;
- if ptr2 != ptr1 {
- panic!();
- }
- // If LLVM knows the pointers are the same, and if `r` was `noalias`,
- // then it may replace this with `a + a`, ignoring the earlier write.
- a + *r2
-}
-
-fn main() {
- let mut rc = RefCell::new(1);
- let res = break_if_r_is_noalias(&rc, rc.borrow());
- assert_eq!(res, 3);
-
- *rc.get_mut() = 1;
- let res = break_if_r_is_noalias(&rc, rc.borrow_mut());
- assert_eq!(res, 3);
-}
diff --git a/src/test/ui/codegen/issue-64401.rs b/src/test/ui/codegen/issue-64401.rs
deleted file mode 100644
index 53f85c63b..000000000
--- a/src/test/ui/codegen/issue-64401.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-// build-pass
-// The ICE didn't happen with `cargo check` but `cargo build`.
-
-use std::marker::PhantomData;
-
-trait Owned<'a> {
- type Reader;
-}
-
-impl<'a> Owned<'a> for () {
- type Reader = ();
-}
-
-trait Handler {
- fn handle(&self);
-}
-
-struct CtxHandlerWithoutState<M, F> {
- message_type: PhantomData<M>,
- _function: F,
-}
-
-impl<M, F> CtxHandlerWithoutState<M, F> {
- pub fn new(_function: F) -> Self {
- Self {
- message_type: PhantomData,
- _function,
- }
- }
-}
-
-impl<'a, M, F> Handler for CtxHandlerWithoutState<M, F>
-where
- F: Fn(<M as Owned<'a>>::Reader),
- M: Owned<'a>,
-{
- fn handle(&self) {}
-}
-
-fn e_to_i<M: for<'a> Owned<'a>>(_: <M as Owned<'_>>::Reader) {}
-
-fn send_external_to_internal<M>()
-where
- M: for<'a> Owned<'a>,
-{
- let _: Box<dyn Handler> = Box::new(CtxHandlerWithoutState::<M, _>::new(e_to_i::<M>));
-}
-
-fn main() {
- send_external_to_internal::<()>()
-}
diff --git a/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs b/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs
deleted file mode 100644
index 38dfca347..000000000
--- a/src/test/ui/codegen/issue-88043-bb-does-not-have-terminator.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// build-pass
-// compile-flags: -Copt-level=0
-
-// Regression test for #88043: LLVM crash when the RemoveZsts mir-opt pass is enabled.
-// We should not see the error:
-// `Basic Block in function '_ZN4main10take_until17h0067b8a660429bc9E' does not have terminator!`
-
-fn bump() -> Option<usize> {
- unreachable!()
-}
-
-fn take_until(terminate: impl Fn() -> bool) {
- loop {
- if terminate() {
- return;
- } else {
- bump();
- }
- }
-}
-
-// CHECK-LABEL: @main
-fn main() {
- take_until(|| true);
- f(None);
-}
-
-fn f(_a: Option<String>) -> Option<u32> {
- loop {
- g();
- ()
- }
-}
-
-fn g() -> Option<u32> { None }
diff --git a/src/test/ui/codegen/issue-97708.rs b/src/test/ui/codegen/issue-97708.rs
deleted file mode 100644
index 8cb28e9f1..000000000
--- a/src/test/ui/codegen/issue-97708.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// build-pass
-// aux-build:issue-97708-aux.rs
-
-extern crate issue_97708_aux;
-use issue_97708_aux::TaskStub;
-
-static TASK_STUB: TaskStub = TaskStub::new();
-
-fn main() {}
diff --git a/src/test/ui/codegen/issue-99551.rs b/src/test/ui/codegen/issue-99551.rs
deleted file mode 100644
index b223aff4e..000000000
--- a/src/test/ui/codegen/issue-99551.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// build-pass
-#![feature(trait_upcasting)]
-
-pub trait A {}
-pub trait B {}
-
-pub trait C: A + B {}
-impl<X: A + B> C for X {}
-
-pub fn test<'a, T>(view: T) -> Option<&'a mut dyn B>
-where
- T: IntoIterator<Item = &'a mut dyn B>,
-{
- return Some(view.into_iter().next().unwrap());
-}
-
-fn main() {
- let mut a: Vec<Box<dyn C>> = Vec::new();
- test(a.iter_mut().map(|c| c.as_mut() as &mut dyn B));
-}
diff --git a/src/test/ui/codegen/llvm-pr32379.rs b/src/test/ui/codegen/llvm-pr32379.rs
deleted file mode 100644
index 8a1f03241..000000000
--- a/src/test/ui/codegen/llvm-pr32379.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// run-pass
-// aux-build:llvm_pr32379.rs
-
-// LLVM PR #32379 (https://bugs.llvm.org/show_bug.cgi?id=32379), which
-// applies to upstream LLVM 3.9.1, is known to cause rustc itself to be
-// miscompiled on ARM (Rust issue #40593). Because cross builds don't test
-// our *compiler* on ARM, have a test for the miscompilation directly.
-
-extern crate llvm_pr32379;
-
-pub fn main() {
- let val = llvm_pr32379::pr32379(2, false, false);
- assert_eq!(val, 2);
-}