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

duplicate doesn't substitute in nested duplicate invocation #48

Closed
Emoun opened this issue Jul 24, 2022 · 1 comment
Closed

duplicate doesn't substitute in nested duplicate invocation #48

Emoun opened this issue Jul 24, 2022 · 1 comment
Labels
D-accepted A decision (D) has been made and the issue will be worked on I-bug This issue (I) regards a (potential) bug in the project T-accepted Triage (T): Initial review accepted issue/PR as valid

Comments

@Emoun
Copy link
Owner

Emoun commented Jul 24, 2022

Situation:

Using duplicate_item, it is possible to substitute things in a nested (or lower) duplicate_item's invocation:

#[duplicate::duplicate_item(
	vals	[val; [41]; [42];];
)]
#[duplicate::duplicate_item(
	vals
)]
impl SomeType<val> for (){}

Here, vals substitutes into a valid invocation val; [41]; [42];. This is then used in the next duplicate_item as the invocation. This works fine and as expected, however, trying to do the same using duplicate doesn't work

Reproduction:

duplicate::duplicate!{
	[vals	[val; [41]; [42];];]
	duplicate!{
		[vals]
		impl SomeType<v2> for (){}
	}
}

Expected Behavior:

Expand to:

impl SomeType<41> for () {}
impl SomeType<42> for () {}

Actual Behavior:

Error is thrown:

error: Unexpected end of code. Expected substitution identifier or ';' instead.
  --> tests\tests.rs:16:1
   |
16 | / duplicate::duplicate!{
17 | |     [vals    [val; [41]; [42];];]
18 | |     duplicate!{
19 | |         [vals]
20 | |         impl SomeType<v2> for (){}
21 | |     }
22 | | }
   | |_^
   |
   = note: this error originates in the macro `duplicate::duplicate` (in Nightly builds, run with -Z macro-backtrace for more info)

Affected Versions:

0.4.1 and likely all since nested invocation was introduced.

Local Environment:

Miscellaneous:

@Emoun Emoun added D-discussion A decision (D) has not been made yet and is open to discussion I-bug This issue (I) regards a (potential) bug in the project labels Jul 24, 2022
@github-actions github-actions bot added the T-new Triage (T): Has yet to be reviewed label Jul 24, 2022
@Emoun Emoun added T-accepted Triage (T): Initial review accepted issue/PR as valid and removed T-new Triage (T): Has yet to be reviewed labels Jul 24, 2022
@Emoun Emoun added D-accepted A decision (D) has been made and the issue will be worked on and removed D-discussion A decision (D) has not been made yet and is open to discussion labels Oct 2, 2022
@Emoun
Copy link
Owner Author

Emoun commented Oct 2, 2022

Fixed awaiting next release.

@Emoun Emoun closed this as completed Oct 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-accepted A decision (D) has been made and the issue will be worked on I-bug This issue (I) regards a (potential) bug in the project T-accepted Triage (T): Initial review accepted issue/PR as valid
Projects
None yet
Development

No branches or pull requests

1 participant