Update lifetimes.md

pull/464/head
nomicon-kr 10 months ago committed by GitHub
parent 09e580ab61
commit f65e77e90d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -23,7 +23,7 @@ let y = &x;
let z = &y; let z = &y;
``` ```
"빌림 검사기"는 항상 수명의 길이를 최소화하려고 하기 때문에, 아마 이런 식으로 해독할 것입니다: 대여 검사기는 항상 수명의 길이를 최소화하려고 하기 때문에, 아마 이런 식으로 해독할 것입니다:
<!-- ignore: desugared code --> <!-- ignore: desugared code -->
```rust,ignore ```rust,ignore
@ -31,17 +31,17 @@ let z = &y;
'a: { 'a: {
let x: i32 = 0; let x: i32 = 0;
'b: { 'b: {
// lifetime used is 'b because that's good enough.
let y: &'b i32 = &'b x; let y: &'b i32 = &'b x;
'c: { 'c: {
// ditto on 'c let z: &'c &'b i32 = &'c y; // "i32의 레퍼런스의 레퍼런스" (수명이 표시되어 있음)
let z: &'c &'b i32 = &'c y; // "a reference to a reference to an i32" (with lifetimes annotated)
} }
} }
} }
``` ```
Wow. That's... awful. Let's all take a moment to thank Rust for making this easier. 와. 이건... 별로네요. 러스트가 이런 것들을 간단하게 만들어 준다는 것을 감사하는 우리가 됩시다.
Actually passing references to outer scopes will cause Rust to infer Actually passing references to outer scopes will cause Rust to infer
a larger lifetime: a larger lifetime:

Loading…
Cancel
Save