Square brackets in compiler code

What do square brackets in macros code in rustc?
println!("{}","some string")[]
I doesn't follow the str and file, there is this code.

It will try to call Index::index on the "value" of println which is () and give you a compile error since you aren't specifying any index or tell you than the Index trait isn't implemented for () if you specify it.

You can however call println (like all declarative macros) with square brackets, curly brackets or parentheses.

println!["{}","some string"];
println!{"{}","some string"};
println!("{}","some string");

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.