mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
6a2a6feca8
If no method is found when checking method call, we check if we called a method with signature (&mut T, ...) -> (). If this is the case then we emit a diagnostic message
9 lines
376 B
Rust
9 lines
376 B
Rust
fn main() {
|
|
let x: Vec<i32> = vec![1, 2, 3].into_iter().collect::<Vec<i32>>().sort_by_key(|i| i); //~ ERROR mismatched types
|
|
vec![1, 2, 3].into_iter().collect::<Vec<i32>>().sort_by_key(|i| i).sort(); //~ ERROR no method named `sort` found for unit type `()` in the current scope
|
|
}
|
|
|
|
fn foo(mut s: String) -> String {
|
|
s.push_str("asdf") //~ ERROR mismatched types
|
|
}
|