blob: a6eab536a6b0957d8823c33a64aea2736968d620 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// fn foo() -> String {
// String::new()
// }
fn test(s: &str) {
println!("{}", s);
}
fn test2(s: String) {
println!("{}", s);
}
fn main() {
let x = foo(); //~ERROR cannot find function `foo` in this scope
test(&x);
test2(x); // Does not complain about `x` being a `&str`.
}
|