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

seq test case 03 fail #73

Closed
apodemakeles opened this issue May 9, 2024 · 1 comment
Closed

seq test case 03 fail #73

apodemakeles opened this issue May 9, 2024 · 1 comment

Comments

@apodemakeles
Copy link

apodemakeles commented May 9, 2024

Hi,
my code failed when executing seq test case 03, the output is:

ACTUAL OUTPUT:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error: error number 0
  --> tests/03-expand-four-errors.rs:19:1
   |
19 | / seq!(N in 0..4 {
20 | |     compile_error!(concat!("error number ", stringify!(N)));
21 | | });
   | |__^
   |
   = note: this error originates in the macro `seq` (in Nightly builds, run with -Z macro-backtrace for more info)

error: error number 1
  --> tests/03-expand-four-errors.rs:19:1
   |
19 | / seq!(N in 0..4 {
20 | |     compile_error!(concat!("error number ", stringify!(N)));
21 | | });
   | |__^
   |
   = note: this error originates in the macro `seq` (in Nightly builds, run with -Z macro-backtrace for more info)

error: error number 2
  --> tests/03-expand-four-errors.rs:19:1
   |
19 | / seq!(N in 0..4 {
20 | |     compile_error!(concat!("error number ", stringify!(N)));
21 | | });
   | |__^
   |
   = note: this error originates in the macro `seq` (in Nightly builds, run with -Z macro-backtrace for more info)

error: error number 3
  --> tests/03-expand-four-errors.rs:19:1
   |
19 | / seq!(N in 0..4 {
20 | |     compile_error!(concat!("error number ", stringify!(N)));
21 | | });
   | |__^
   |
   = note: this error originates in the macro `seq` (in Nightly builds, run with -Z macro-backtrace for more info)

I even tried to print the result TokenStream before returning and it looks totally correct (begin with "compile_error" as ident).
Download someone else's code from github and test, same output...

rust version: 1.75.0

dependencies:

proc-macro2 = "1.0.81"
syn = { version = "2.0.59", features = ["full", "extra-traits"] }
quote = "1.0.36"
prettyplease = "0.2.1"

repository: https://github.com/apodemakeles/proc-macro-workshop/blob/seq/seq/src/lib.rs

@dtolnay
Copy link
Owner

dtolnay commented May 9, 2024

This passes in the reference implementation, so it is definitely possible to implement as shown.

If you take this question to any of the resources shown in https://www.rust-lang.org/community, plenty of people have experience writing macros and should be able to help you sort it out.

@dtolnay dtolnay closed this as completed May 9, 2024
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

No branches or pull requests

2 participants