Passing String.as_str to &str.map() fails to compile with type mismatch error

The second map statement in this code fails to compile.

fn main() {     let hello = Some("hello");     let _switcheroo = hello.map(str::to_string); //ok       let hello = Some("hello".to_string());     let _switcheroo = hello.map(String::as_str); //not ok  } 

The error is:

error[E0631]: type mismatch in function arguments  --> src/main.rs:6:29   | 6 |     let _switcheroo = hello.map(String::as_str);   |                             ^^^   |                             |   |                             expected signature of `fn(std::string::String) -> _`   |                             found signature of `for<'r> fn(&'r std::string::String) -> _`  error: aborting due to previous error 

I would expect an error about borrowing some moved data.

What is this error trying to say?

By the way, this compiles:

let hello = Some("hello".to_string()); let _switcheroo = hello.as_ref().map(String::as_str); //ok