mirror of
https://github.com/rust-lang/book.git
synced 2026-09-15 10:10:42 -04:00
@@ -291,7 +291,7 @@ Because `s` is created inside `dangle`, when the code of `dangle` is finished,
|
||||
this reference would be pointing to an invalid `String`! That’s no good. Rust
|
||||
won’t let us do this.
|
||||
|
||||
The correct code here is to return the `String` directly:
|
||||
The solution here is to return the `String` directly:
|
||||
|
||||
```rust
|
||||
fn no_dangle() -> String {
|
||||
|
||||
@@ -284,7 +284,7 @@ println!("1 new tweet: {}", tweet.summary());
|
||||
This will print `1 new tweet: (Read more from @horse_ebooks...)`.
|
||||
|
||||
Note that it is not possible to call the default implementation from an
|
||||
overridden implementation.
|
||||
overriding implementation.
|
||||
|
||||
### Trait Bounds
|
||||
|
||||
|
||||
Reference in New Issue
Block a user