rust
rust copied to clipboard
Using 'type' as parameter name doesn't work
I tried to declare a function such as:
fn func(type: int) -> int;
This gave me the error "found type in expression position". Shouldn't I be able to use 'type' as a parameter name?
This is not allowed. It would make the following code difficult to parse:
fn foo(&type: int) {
type mytype = int;
type += 1;
}
Hmm ok :( I guess that'll be quite a banana skin for some people.
The manual has a list of keywords in Rust:
http://doc.rust-lang.org/doc/rust.html#keywords