Skip to content

Commit

Permalink
Add repetition test with array of array
Browse files Browse the repository at this point in the history
    error[E0599]: the method `quote_into_iter` exists for struct `RepInterp<&[u8; 2]>`, but its trait bounds were not satisfied
       --> tests/test.rs:110:13
        |
    110 |     let _ = quote!(#(#(#array_of_array)*)*);
        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ method cannot be called on `RepInterp<&[u8; 2]>` due to unsatisfied trait bounds
        |
       ::: /git/quote/src/runtime.rs:158:1
        |
    158 | pub struct RepInterp<T>(pub T);
        | ----------------------- doesn't satisfy 5 bounds
        |
    note: there's an earlier shadowed binding `array_of_array` of type `[[u8; 2]; 2]` that has method `quote_into_iter` available
       --> tests/test.rs:109:9
        |
    109 |     let array_of_array: [[u8; 2]; 2] = [[0; 2]; 2];
        |         ^^^^^^^^^^^^^^ `array_of_array` of type `[[u8; 2]; 2]` that has method `quote_into_iter` defined earlier here
    110 |     let _ = quote!(#(#(#array_of_array)*)*);
        |             ------------------------------- earlier `array_of_array` shadowed here with type `RepInterp<&[u8; 2]>`
        = note: the following trait bounds were not satisfied:
                `RepInterp<&[u8; 2]>: Iterator`
                which is required by `RepInterp<&[u8; 2]>: ext::RepIteratorExt`
                `&RepInterp<&[u8; 2]>: Iterator`
                which is required by `&RepInterp<&[u8; 2]>: ext::RepIteratorExt`
                `RepInterp<&[u8; 2]>: quote::ToTokens`
                which is required by `RepInterp<&[u8; 2]>: ext::RepToTokensExt`
                `&[u8; 2]: ext::RepAsIteratorExt<'_>`
                which is required by `RepInterp<&[u8; 2]>: ext::RepAsIteratorExt<'_>`
                `&mut RepInterp<&[u8; 2]>: Iterator`
                which is required by `&mut RepInterp<&[u8; 2]>: ext::RepIteratorExt`
        = note: this error originates in the macro `$crate::quote_bind_into_iter` which comes from the expansion of the macro `quote` (in Nightly builds, run with -Z macro-backtrace for more info)
  • Loading branch information
dtolnay committed Dec 26, 2024
1 parent aafba72 commit 5bba89f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ fn test_array() {

let ref_slice: &[X] = &[X, X];
let _ = quote!(#(#ref_slice #ref_slice)*);

let array_of_array: [[u8; 2]; 2] = [[0; 2]; 2];
let _ = quote!(#(#(#array_of_array)*)*);
}

#[test]
Expand Down

0 comments on commit 5bba89f

Please sign in to comment.