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

Fix Issue #30 (Empty arr![] compiler error) #31

Merged
merged 1 commit into from Dec 22, 2016

Conversation

millardjn
Copy link
Contributor

Added example to arr![] doc
Return a helpful error when empty macro is invoked. Syntax error hack.
Added some test cases to make sure actual zero and unit length arrays weren't broken.

Compiler Error after fix on rustc 1.13.0

../generic-array>cargo test
   Compiling generic-array v0.5.1 
error: macro expansion ignores token `"Macro requires a type, e.g. `let array = arr![u32; 1, 2, 3];`"` and any following
 --> <generic_array macros>:4:4
  |
4 | "" "Macro requires a type, e.g. `let array = arr![u32; 1, 2, 3];`" )
  |    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: caused by the macro expansion here; the usage of `arr!` is likely invalid in expression context
 --> tests/mod.rs:81:15
  |
81|     let arr = arr![];
  |               ^^^^^^

Alternative strategy would be to return a unit type (empty tuple) array of length 0.

Added example to arr![] doc
Return a helpful error when empty macro is invoked. Syntax error hack.
Added some test cases to make sure actual zero and unit length arrays weren't broken.
@fizyk20 fizyk20 merged commit 0c56150 into fizyk20:master Dec 22, 2016
@fizyk20
Copy link
Owner

fizyk20 commented Dec 22, 2016

Thanks!

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.

None yet

2 participants