about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorRamon de C Valle <rcvalle@users.noreply.github.com>2023-05-24 15:44:52 +0000
committerRamon de C Valle <rcvalle@users.noreply.github.com>2023-06-01 23:22:54 +0000
commit76ff5ec88624ea61ae49b728ce4d382df8fb7fe3 (patch)
treeff6016743136bc6f863cdead3655ecd8349a8504 /tests
parentd5699874dc07d2dfb262d007293853f73c171f7e (diff)
downloadrust-76ff5ec88624ea61ae49b728ce4d382df8fb7fe3.tar.gz
rust-76ff5ec88624ea61ae49b728ce4d382df8fb7fe3.zip
CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Binde
Fixes #111184 by encoding ty::Generator parent substs only.
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/sanitize/issue-111184-generator-witness.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/sanitize/issue-111184-generator-witness.rs b/tests/ui/sanitize/issue-111184-generator-witness.rs
new file mode 100644
index 00000000000..8f4118057ce
--- /dev/null
+++ b/tests/ui/sanitize/issue-111184-generator-witness.rs
@@ -0,0 +1,17 @@
+// Regression test for issue 111184, where ty::GeneratorWitness were not expected to occur in
+// encode_ty and caused the compiler to ICE.
+//
+// needs-sanitizer-cfi
+// compile-flags: -Clto -Ctarget-feature=-crt-static -Zsanitizer=cfi --edition=2021
+// no-prefer-dynamic
+// only-x86_64-unknown-linux-gnu
+// run-pass
+
+use std::future::Future;
+
+async fn foo() {}
+fn bar<T>(_: impl Future<Output = T>) {}
+
+fn main() {
+    bar(foo());
+}