Skip to content

Commit

Permalink
tests: ui: compile-fail: init: add guard_access
Browse files Browse the repository at this point in the history
  • Loading branch information
y86-dev committed Apr 18, 2024
1 parent fe3eb38 commit a20d238
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/ui/compile-fail/init/guard_access.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use pinned_init::*;

struct Foo {
x: usize,
y: usize,
}

fn main() {
let _ = init!(Foo {
x: 0,
y: {
let _ = __x_guard;
0
},
});
}
5 changes: 5 additions & 0 deletions tests/ui/compile-fail/init/guard_access.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
error[E0425]: cannot find value `__x_guard` in this scope
--> tests/ui/compile-fail/init/guard_access.rs:12:21
|
12 | let _ = __x_guard;
| ^^^^^^^^^ not found in this scope

0 comments on commit a20d238

Please sign in to comment.