关于生命周期的理解 #339
OuYangPaste
started this conversation in
内容建议
关于生命周期的理解
#339
Replies: 1 comment 1 reply
-
因为 'a 确实是一个交集 = , =,NLL属于额外的规则,不应该跟已有的规则混淆在一起,未来可能会有其他的规则,甚至不再有NLL :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
不太明白为什么现在很多关于生命周期的讲解都喜欢从把 'a 的范围推断为 所有标记 'a 的入参的存活交集范围, 我个人来说习惯把 返回接收的引用所存活的范围定性为 'a ,而入参的范围定性为 'b: 'a, 'c: 'a,特别在 rust 有了 NLL 之后,借用检查器对变量的生命周期检查粒度更细了,而生命周期的本质是帮编译器把 返回的引用 和 被引用的资源 重新挪回到借用检查这个体系当中
(emmm 用手机写的不太方便举例子😂, 希望上面的文字能表达清楚我的意思)
Beta Was this translation helpful? Give feedback.
All reactions