about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-08 14:15:48 +0000
committerbors <bors@rust-lang.org>2024-04-08 14:15:48 +0000
commitab3dba92db355b8d97db915a2dca161a117e959c (patch)
tree788440fa9a858bba6b4f3743642b7c726e8e7299 /tests/codegen
parent75fd074338801fba74a8cf7f8c48c5c5be362d08 (diff)
parentf8252712a5339d18405a19037b30be23aefeb476 (diff)
downloadrust-ab3dba92db355b8d97db915a2dca161a117e959c.tar.gz
rust-ab3dba92db355b8d97db915a2dca161a117e959c.zip
Auto merge of #123628 - matthiaskrgr:rollup-6otgb94, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #115984 (extending filesystem support for Hermit)
 - #120144 (privacy: Stabilize lint `unnameable_types`)
 - #122807 (Add consistency with phrases "meantime" and "mean time")
 - #123089 (Add invariant to VecDeque::pop_* that len < cap if pop successful)
 - #123595 (Documentation fix)
 - #123625 (Stop exporting `TypeckRootCtxt` and `FnCtxt`.)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/vecdeque_pop_push.rs67
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/codegen/vecdeque_pop_push.rs b/tests/codegen/vecdeque_pop_push.rs
new file mode 100644
index 00000000000..040d5a279dc
--- /dev/null
+++ b/tests/codegen/vecdeque_pop_push.rs
@@ -0,0 +1,67 @@
+//@ compile-flags: -O
+
+#![crate_type = "lib"]
+
+use std::collections::VecDeque;
+
+#[no_mangle]
+// CHECK-LABEL: @noop_back(
+pub fn noop_back(v: &mut VecDeque<u8>) {
+    // CHECK-NOT: grow
+    // CHECK: tail call void @llvm.assume
+    // CHECK-NOT: grow
+    // CHECK: ret
+    if let Some(x) = v.pop_back() {
+        v.push_back(x);
+    }
+}
+
+#[no_mangle]
+// CHECK-LABEL: @noop_front(
+pub fn noop_front(v: &mut VecDeque<u8>) {
+    // CHECK-NOT: grow
+    // CHECK: tail call void @llvm.assume
+    // CHECK-NOT: grow
+    // CHECK: ret
+    if let Some(x) = v.pop_front() {
+        v.push_front(x);
+    }
+}
+
+#[no_mangle]
+// CHECK-LABEL: @move_byte_front_to_back(
+pub fn move_byte_front_to_back(v: &mut VecDeque<u8>) {
+    // CHECK-NOT: grow
+    // CHECK: tail call void @llvm.assume
+    // CHECK-NOT: grow
+    // CHECK: ret
+    if let Some(x) = v.pop_front() {
+        v.push_back(x);
+    }
+}
+
+#[no_mangle]
+// CHECK-LABEL: @move_byte_back_to_front(
+pub fn move_byte_back_to_front(v: &mut VecDeque<u8>) {
+    // CHECK-NOT: grow
+    // CHECK: tail call void @llvm.assume
+    // CHECK-NOT: grow
+    // CHECK: ret
+    if let Some(x) = v.pop_back() {
+        v.push_front(x);
+    }
+}
+
+#[no_mangle]
+// CHECK-LABEL: @push_back_byte(
+pub fn push_back_byte(v: &mut VecDeque<u8>) {
+    // CHECK: call {{.*}}grow
+    v.push_back(3);
+}
+
+#[no_mangle]
+// CHECK-LABEL: @push_front_byte(
+pub fn push_front_byte(v: &mut VecDeque<u8>) {
+    // CHECK: call {{.*}}grow
+    v.push_front(3);
+}