summaryrefslogtreecommitdiffstats
path: root/tests/coverage/uses_crate.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/coverage/uses_crate.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/coverage/uses_crate.rs')
-rw-r--r--tests/coverage/uses_crate.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/coverage/uses_crate.rs b/tests/coverage/uses_crate.rs
new file mode 100644
index 000000000..ab203ad78
--- /dev/null
+++ b/tests/coverage/uses_crate.rs
@@ -0,0 +1,19 @@
+// This test was failing on Linux for a while due to #110393 somehow making
+// the unused functions not instrumented, but it seems to be fine now.
+
+// Validates coverage now works with optimizations
+// compile-flags: -C opt-level=3
+
+#![allow(unused_assignments, unused_variables)]
+
+// aux-build:used_crate.rs
+extern crate used_crate;
+
+fn main() {
+ used_crate::used_function();
+ let some_vec = vec![1, 2, 3, 4];
+ used_crate::used_only_from_bin_crate_generic_function(&some_vec);
+ used_crate::used_only_from_bin_crate_generic_function("used from bin uses_crate.rs");
+ used_crate::used_from_bin_crate_and_lib_crate_generic_function(some_vec);
+ used_crate::used_with_same_type_from_bin_crate_and_lib_crate_generic_function("interesting?");
+}