summary refs log tree commit diff
path: root/tests/ui/offset-of/offset-of-inference.rs
diff options
context:
space:
mode:
authorLukas Markeffsky <@>2023-05-17 22:10:36 +0200
committerLukas Markeffsky <@>2023-05-20 15:20:27 +0200
commit7cdb23b98a58a4e73ab1e4ca5e3bb7d04645bdd7 (patch)
tree39a5ca1cfd00c064f1901e4d886308ff201d0146 /tests/ui/offset-of/offset-of-inference.rs
parent6d1bf733d6d2501fa4f8dd99c7d9a97e2d23d284 (diff)
downloadrust-7cdb23b98a58a4e73ab1e4ca5e3bb7d04645bdd7.tar.gz
rust-7cdb23b98a58a4e73ab1e4ca5e3bb7d04645bdd7.zip
don't skip inference for type in `offset_of!`
Diffstat (limited to 'tests/ui/offset-of/offset-of-inference.rs')
-rw-r--r--tests/ui/offset-of/offset-of-inference.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/offset-of/offset-of-inference.rs b/tests/ui/offset-of/offset-of-inference.rs
new file mode 100644
index 00000000000..ba87574eae0
--- /dev/null
+++ b/tests/ui/offset-of/offset-of-inference.rs
@@ -0,0 +1,11 @@
+// Test that inference types in `offset_of!` don't ICE.
+
+#![feature(offset_of)]
+
+struct Foo<T> {
+    x: T,
+}
+
+fn main() {
+    let _ = core::mem::offset_of!(Foo<_>, x); //~ ERROR: type annotations needed
+}