Skip to content

Commit

Permalink
Merge pull request #1769 from aviad-dev/patch-2
Browse files Browse the repository at this point in the history
rename `y` to `_y` to get the correct compile error
  • Loading branch information
marioidival authored Nov 18, 2023
2 parents 8957a71 + 3dffa1e commit a658124
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scope/lifetime/explicit.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ fn failed_borrow<'a>() {
let _x = 12;
// ERROR: `_x` does not live long enough
let y: &'a i32 = &_x;
let _y: &'a i32 = &_x;
// Attempting to use the lifetime `'a` as an explicit type annotation
// inside the function will fail because the lifetime of `&_x` is shorter
// than that of `y`. A short lifetime cannot be coerced into a longer one.
// than that of `_y`. A short lifetime cannot be coerced into a longer one.
}
fn main() {
Expand Down

0 comments on commit a658124

Please sign in to comment.