Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.40 KB | None | 0 0
  1. const std = @import("std");
  2.  
  3. const Union = union(enum) {
  4.     First: void,
  5.     Second: void,
  6. };
  7.  
  8. // Outputs:
  9. //  Union{ .First = void }
  10. //  Union{ .First = void }
  11. // When I'm expecting:
  12. //  Union{ .First = void }
  13. //  Union{ .Second = void }
  14.  
  15. pub fn main() void {
  16.     var x = Union{ .First = {} };
  17.     std.debug.warn("{}\n", x);
  18.     x = Union { .Second = {} };
  19.     std.debug.warn("{}\n", x);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement