Change:
From: src/test/compile- Error E0061 needs a span_label, updating it from: To: Bonus: the types could be incorporated into the label rather than a note (though we may want to avoid types with long names in the label)
Planning on tackling the bonus here. Is there a prefered max length for output on the console. In the case it would exceed this should i truncate the typename or just not include?
- great point. If you want to work on truncation, feel free to add it, too. I'm not sure if the term crate will tell you the current terminal size, but it may.
I'm fixing and I noticed that it and this issue currently share the same code for generating this error, and adding code to add a to the message in would fix both.
Did you do the bonus as well? I can tackle that if you haven't.
I haven't yet - I can fix the issue (currently testing/fixing unit tests) and you can take on the bonus part of the issue.
Sounds great to me! Thanks.
- I opened up issue to track the bonus portion of the work for you.

Discussion:
arg_count, if arg_count == 1 {" was"} else {"s were"}), error_code); <ins> err.span_label(sp, &format!("expected {}{} parameter{}", if variadic {"at least "} else {""}, expected_count, if expected_count == 1 {""} else {"s"})); </ins> let input_types = fn_inputs.iter().map(|i| format!("{:?}", i)).collect::<Vec<String>>(); if input_types.len() > 0 { err.note(&format!("the following parameter type{} expected: {}",

} fn main() { <del> unsafe { printf(); } //~ ERROR E0060 </del> <ins> unsafe { printf(); } //~^ ERROR E0060 //~| NOTE expected at least 1 parameter //~| NOTE the following parameter type was expected </ins> }

fn f(a: u16, b: &str) {} fn main() { <del> f(0); //~ ERROR E0061 </del> <ins> f(0); //~^ ERROR E0061 //~| NOTE expected 2 parameters //~| NOTE the following parameter types were expected </ins> }

} fn main() { <del> print_x(X);  //~error this function takes 2 parameters but 1 parameter was supplied //~^ NOTE the following parameter types were expected: &Foo<Item=bool>, &str </del> <ins> print_x(X); //~^ ERROR this function takes 2 parameters but 1 parameter was supplied //~| NOTE the following parameter types were expected: &Foo<Item=bool>, &str //~| NOTE expected 2 parameters </ins> }

needlesArr.iter().fold(|x, y| { }); //~^^ ERROR this function takes 2 parameters but 1 parameter was supplied <del> //~^^^ NOTE the following parameter types were expected // </del> <ins> //~| NOTE the following parameter types were expected //~| NOTE expected 2 parameters </ins> // the first error is, um, non-ideal. }

// Regression test for issue #4935 fn foo(a: usize) {} <del> fn main() { foo(5, 6) } //~ ERROR this function takes 1 parameter but 2 parameters were supplied //~^ NOTE the following parameter type was expected </del> <ins> fn main() { foo(5, 6) } //~^ ERROR this function takes 1 parameter but 2 parameters were supplied //~| NOTE the following parameter type was expected //~| NOTE expected 1 parameter </ins>

fn main() { let x = Foo; x.zero(0)   //~ ERROR this function takes 0 parameters but 1 parameter was supplied <ins> //~^ NOTE expected 0 parameters </ins> .one()     //~ ERROR this function takes 1 parameter but 0 parameters were supplied //~^ NOTE the following parameter type was expected <ins> //~| NOTE expected 1 parameter </ins> .two(0);   //~ ERROR this function takes 2 parameters but 1 parameter was supplied //~^ NOTE the following parameter types were expected <ins> //~| NOTE expected 2 parameters </ins> let y = Foo; y.zero()

fn main() { foo(1, 2, 3); //~^ ERROR this function takes 4 parameters but 3 <del> //~^^ NOTE the following parameter types were expected </del> <ins> //~| NOTE the following parameter types were expected //~| NOTE expected 4 parameters </ins> }

let ans = s(); //~^ ERROR this function takes 1 parameter but 0 parameters were supplied //~| NOTE the following parameter type was expected <ins> //~| NOTE expected 1 parameter </ins> let ans = s("burma", "shave"); //~^ ERROR this function takes 1 parameter but 2 parameters were supplied //~| NOTE the following parameter type was expected <ins> //~| NOTE expected 1 parameter </ins> }

unsafe { foo(); //~ ERROR: this function takes at least 2 parameters but 0 parameters were supplied //~^ NOTE the following parameter types were expected <ins> //~| NOTE expected at least 2 parameters </ins> foo(1); //~ ERROR: this function takes at least 2 parameters but 1 parameter was supplied //~^ NOTE the following parameter types were expected <ins> //~| NOTE expected at least 2 parameters </ins> let x: unsafe extern "C" fn(f: isize, x: u8) = foo; //~^ ERROR: mismatched types