Merge pull request #1501 from 3119369616/patch-1

Update lifetime.md
pull/1504/head
Sunface 3 months ago committed by GitHub
commit d567da47c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -287,7 +287,7 @@ error[E0515]: cannot return value referencing local variable `result` // 返回
那遇到这种情况该怎么办?最好的办法就是返回内部字符串的所有权,然后把字符串的所有权转移给调用者:
```rust
fn longest<'a>(_x: &str, _y: &str) -> String {
fn longest(_x: &str, _y: &str) -> String {
String::from("really long string")
}

Loading…
Cancel
Save