Skip to content

Commit

Permalink
Fix missing lifetime error in dangling reference example
Browse files Browse the repository at this point in the history
  • Loading branch information
randomPoison committed May 22, 2024
1 parent 3d99966 commit 452488d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/references/shared.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Rust will statically forbid dangling references:
<!-- mdbook-xgettext: skip -->

```rust,editable,compile_fail
fn x_axis(x: i32) -> &(i32, i32) {
let point = (x, 0);
fn x_axis(x: &i32) -> &(i32, i32) {
let point = (*x, 0);
return &point;
}
```
Expand Down

0 comments on commit 452488d

Please sign in to comment.