Skip to content

panics with “range end index out of range” when called as all_tuples_enumerated!(impl_baz, 3, 10, T) #37

@kingwingfly

Description

@kingwingfly

variadics_please version

variadics_please = { version = "1.1.0" }

What you did

variadics_please::all_tuples_enumerated!(impl_baz, 3, 10, T);

What went wrong

I hope it generate code like:

impl_baz!((0, T0), (1, T1), (2, T2));
...
impl_baz!((0, T0), (1, T1), (2, T2), .. (9, T9));

(begin with impl_baz!((0, T0), (1, T1), (2, T2));)

But I got error:

error: proc macro panicked
   --> impl_trait_for_tuple/src/lib.rs:202:1
    |
202 | variadics_please::all_tuples_enumerated!(impl_baz, 3, 10, T);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: message: range end index 10 out of range for slice of length 9

I know there's no documentation telling me I can use variadics_please in this way.

But I wonder if it is actually supported and is this actually a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AllTuplesA change to the all_tuples*! macros.C-BugSomething isn't workingS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions