Skip to content

Commit

Permalink
跟随上游 PR #438 更新
Browse files Browse the repository at this point in the history
  • Loading branch information
PureWhiteWu committed Jan 3, 2024
1 parent a0607a9 commit 45ef9f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
>
> 如果大家对于翻译有更好的建议或者想法,欢迎直接 PR~
>
> 目前翻译基于 commit:f6bd083c4ccfc4ce6699b8b4154e3c45c5a27a8c,基于时间:2023/12/18
> 目前翻译基于 commit:6bc2415218d4dd0cb01433d8320f5ccf79c343a1,基于时间:2024/1/4
>
> Q:为什么不基于之前已有的中文版进行改进?
>
Expand Down
9 changes: 3 additions & 6 deletions src/subtyping.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,7 @@ thread_local! {
/// 将给定的输入保存到一个thread local的 `Vec<&'static str>`
fn store(input: &'static str) {
StaticVecs.with(|v| {
v.borrow_mut().push(input);
})
StaticVecs.with_borrow_mut(|v| v.push(input));
}
/// 用有着相同生命周期的参数 `input` 去调用给定的函数
Expand All @@ -291,9 +289,8 @@ fn main() {
demo(&smuggle, store);
}
StaticVecs.with(|v| {
println!("{:?}", v.borrow()); // 使用在被释放后的值 😿
});
// use after free 😿
StaticVecs.with_borrow(|v| println!("{v:?}"));
}
```

Expand Down

0 comments on commit 45ef9f6

Please sign in to comment.