add UI regression test for offset_of! recovery

This commit is contained in:
Takayuki Maeda
2026-03-06 22:19:11 +09:00
parent f824853889
commit ca2178dd9f
2 changed files with 22 additions and 0 deletions
@@ -0,0 +1,14 @@
use std::mem::offset_of;
struct S {
x: (),
}
impl S {
fn a() {
offset_of!(Self, Self::x);
//~^ ERROR offset_of expects dot-separated field and variant names
}
}
fn main() {}
@@ -0,0 +1,8 @@
error: offset_of expects dot-separated field and variant names
--> $DIR/offset-of-error-recovery.rs:9:26
|
LL | offset_of!(Self, Self::x);
| ^^^^^^^
error: aborting due to 1 previous error