Skip to content

remove the :: after type names in "as" expressions #1686

Closed
@nikomatsakis

Description

@nikomatsakis

Currently, you must write foo as bar::<X> if the type you are casting to contains a type parameter. I find this very unintuitive. I think the rule "type names do not require ::, explicit function type parameters do" is easy enough to explain. But the rule ":: are needed in expressions, but only where it might cause ambiguity" is a bit more troublesome.

I realize there is a kind of ambiguity (foo as uint < 5) but I am ok with having to write (foo as uint) < 5 in this case. I think this will come up less often than casting to parameterized interfaces.

Metadata

Metadata

Assignees

Labels

A-frontendArea: Compiler frontend (errors, parsing and HIR)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions