Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some compile-fail tests. #68

Merged
merged 1 commit into from
Oct 10, 2022
Merged

Add some compile-fail tests. #68

merged 1 commit into from
Oct 10, 2022

Conversation

Gilnaa
Copy link
Owner

@Gilnaa Gilnaa commented Oct 10, 2022

Ticket:

The compilation failures look like this: (after applying this suggestion)

successes:

---- src/raw_field.rs - raw_field::_memoffset__field_check_tuple (line 82) stdout ----
error[E0308]: mismatched types
 --> src/raw_field.rs:85:1
  |
6 | _memoffset__field_check_tuple!(i32, 0);
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---^^^^
  | |                              |
  | |                              expected due to this
  | expected `i32`, found tuple
  |
  = note: expected type `i32`
            found tuple `(_,)`
  = note: this error originates in the macro `_memoffset__field_check_tuple` (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0308`.
---- src/raw_field.rs - raw_field::_memoffset__field_check (line 46) stdout ----
error[E0026]: struct `Box` does not have a field named `foo`
 --> src/raw_field.rs:52:36
  |
9 | _memoffset__field_check!(BoxedFoo, foo);
  |                                    ^^^ struct `Box` does not have this field

error: aborting due to previous error

For more information about this error, try `rustc --explain E0026`.
---- src/raw_field.rs - raw_field::_memoffset__field_check_union (line 111) stdout ----
error[E0769]: tuple variant `BoxedFoo` written as struct variant
  --> src/raw_field.rs:120:1
   |
12 | _memoffset__field_check_union!(BoxedFoo, variant_a);
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the macro `_memoffset__field_check_union` (in Nightly builds, run with -Z macro-backtrace for more info)
help: use the tuple variant pattern syntax instead
  --> /home/gilad/src/memoffset/src/raw_field.rs:134:36
   |
134|             let $type { $field: _ }(_, _);
   |                                    ++++++

error: aborting due to previous error

For more information about this error, try `rustc --explain E0769`.

---- src/offset_of.rs - offset_of::offset_of_tuple (line 104) stdout ----

@Gilnaa Gilnaa requested a review from RalfJung October 10, 2022 18:05
src/raw_field.rs Outdated Show resolved Hide resolved
@RalfJung RalfJung merged commit af66895 into master Oct 10, 2022
@RalfJung RalfJung deleted the compile-fail-23 branch October 10, 2022 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants