about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Markeffsky <@>2022-10-12 18:54:14 +0200
committerLukas Markeffsky <@>2022-10-12 18:54:14 +0200
commitf3d7b39cdf483ae543757fbef369c166650e66f2 (patch)
tree89b4de6a56542245bf8a2240ed6a91fbd9351261
parenta02ec4cf1817b6ec7f154e11521cb76507cd4a3c (diff)
downloadrust-f3d7b39cdf483ae543757fbef369c166650e66f2.tar.gz
rust-f3d7b39cdf483ae543757fbef369c166650e66f2.zip
add regression test
-rw-r--r--src/test/ui/array-slice-vec/slice_is_sorted_by_borrow.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/array-slice-vec/slice_is_sorted_by_borrow.rs b/src/test/ui/array-slice-vec/slice_is_sorted_by_borrow.rs
new file mode 100644
index 00000000000..073280d0fab
--- /dev/null
+++ b/src/test/ui/array-slice-vec/slice_is_sorted_by_borrow.rs
@@ -0,0 +1,20 @@
+// check-pass
+// regression test for https://github.com/rust-lang/rust/issues/53485#issuecomment-885393452
+
+#![feature(is_sorted)]
+
+struct A {
+    name: String,
+}
+
+fn main() {
+    let a = &[
+        A {
+            name: "1".to_string(),
+        },
+        A {
+            name: "2".to_string(),
+        },
+    ];
+    assert!(a.is_sorted_by_key(|a| a.name.as_str()));
+}