Error: generic parameters without surrounding angle brackets

I'm trying to write a proc macro (full code is here, error happens when building the baseconv example).

I keep getting the error from the title, the positional information is useless since it within the macro-generated code, and i have no idea what the text of the error is supposed to mean.

why would the compiler think something is a type parameter unless it is surrounded with angle brackets? there doesn't seem to be any info about this error online, and it's a parsing error, so it doesn't have an error number, and thus, no --explain entry.

does anyone know what this means?

#[proc_macro]
pub fn args(input: TokenStream) -> TokenStream {
	let cmd = parse_macro_input!(input as Cmd);
	let helptext = cmd.helptext();
    // TODO: arbitrary key-value parameters to control various aspects.
    let prelude;
    let options;
    if let Some(the_options) = &cmd.options {
        prelude = quote!{};
        options = the_options.clone();
    } else {
        options = syn::Ident::new("_argmacro_options", Span::call_site());
        prelude = quote!{
            let mut _argmacro_raw_args = ::std::env::args()
-               .skip(1).collect::Vec::<_>();
+               .skip(1).collect::<Vec::<_>>();
            let mut #options =
                ::getargs::Options::new(
                    _argmacro_raw_args.iter().map(|x|x.as_str()));
        };
    }
    ⋮
2 Likes

Yeah, the error is very opaque in your macro use-case. I was only able to understand it by literally searching the rust repo, like this, which finds a rustc UI test case that was close enough to spot the problem in the macro definition quickly

1 Like