about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-14 13:19:39 -0700
committerGitHub <noreply@github.com>2020-07-14 13:19:39 -0700
commitdbe7ed33cd14166ed52ff02f4db145e199c348cd (patch)
tree873851698947a162abdd85a971618981b1e19b2a /src/test
parentc4fcf5a7a4e70073e2229641fedfd57a63f3dfed (diff)
parentcccc3109ffc61a742bcaa9241e457ceadb96ce95 (diff)
downloadrust-dbe7ed33cd14166ed52ff02f4db145e199c348cd.tar.gz
rust-dbe7ed33cd14166ed52ff02f4db145e199c348cd.zip
Rollup merge of #74340 - davidtwco:issue-73747-improper-ctypes-defns-is-zst-with-params, r=pnkfelix
lint: use `transparent_newtype_field` to avoid ICE

Fixes #73747.

This PR re-uses the `transparent_newtype_field` function instead of manually calling `is_zst` on normalized fields to determine which field in a transparent type is the non-zero-sized field, thus avoiding an ICE.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/lint/lint-ctypes-73747.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/lint/lint-ctypes-73747.rs b/src/test/ui/lint/lint-ctypes-73747.rs
new file mode 100644
index 00000000000..293ffd5c28e
--- /dev/null
+++ b/src/test/ui/lint/lint-ctypes-73747.rs
@@ -0,0 +1,14 @@
+// check-pass
+
+#[repr(transparent)]
+struct NonNullRawComPtr<T: ComInterface> {
+    inner: std::ptr::NonNull<<T as ComInterface>::VTable>,
+}
+
+trait ComInterface {
+    type VTable;
+}
+
+extern "C" fn invoke<T: ComInterface>(_: Option<NonNullRawComPtr<T>>) {}
+
+fn main() {}