Skip to content
This repository

Can declare two methods with the same name and different arguments #3099

Emm opened this Issue August 03, 2012 · 3 comments

3 participants

Emmanuel Surleau Tim Chevalier Gareth Smith
Emmanuel Surleau
Emm commented August 03, 2012
fn a(x: ~str) -> ~str {
    #fmt("First function with %s", x)

fn a(x: ~str, y: ~str) -> ~str {
    #fmt("Second function with %s and %s", x, y)

fn main() {
    #info("Result: ");

Compiles with a recent rust master (899400c) (but using a(x: ~str) does not compile)

Gareth Smith

You can also declare different types with the same name. This compiles and runs:

enum x {}

trait x {}

type x = int;

struct x { a: int; }

fn main() {
    let x:x = fail;
Tim Chevalier

I'm working on fixing both of these issues.

Gareth Smith

Thats great @catamorphism, thanks!

Tim Chevalier catamorphism closed this in 6bd01d0 August 06, 2012
Jay Anderson jayanderson referenced this issue from a commit November 10, 2013
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.