Rollup merge of #134797 - spastorino:ergonomic-ref-counting-1, r=nikomatsakis
Ergonomic ref counting This is an experimental first version of ergonomic ref counting. This first version implements most of the RFC but doesn't implement any of the optimizations. This was left for following iterations. RFC: https://github.com/rust-lang/rfcs/pull/3680 Tracking issue: https://github.com/rust-lang/rust/issues/132290 Project goal: https://github.com/rust-lang/rust-project-goals/issues/107 r? ```@nikomatsakis```
This commit is contained in:
commit
f5a143f796
119 changed files with 1401 additions and 79 deletions
|
@ -1399,6 +1399,7 @@ impl Expr {
|
|||
// Never need parens
|
||||
ExprKind::Array(_)
|
||||
| ExprKind::Await(..)
|
||||
| ExprKind::Use(..)
|
||||
| ExprKind::Block(..)
|
||||
| ExprKind::Call(..)
|
||||
| ExprKind::ConstBlock(_)
|
||||
|
@ -1588,6 +1589,8 @@ pub enum ExprKind {
|
|||
Gen(CaptureBy, P<Block>, GenBlockKind, Span),
|
||||
/// An await expression (`my_future.await`). Span is of await keyword.
|
||||
Await(P<Expr>, Span),
|
||||
/// A use expression (`x.use`). Span is of use keyword.
|
||||
Use(P<Expr>, Span),
|
||||
|
||||
/// A try block (`try { ... }`).
|
||||
TryBlock(P<Block>),
|
||||
|
@ -1757,8 +1760,17 @@ pub enum CaptureBy {
|
|||
/// The span of the `move` keyword.
|
||||
move_kw: Span,
|
||||
},
|
||||
/// `move` keyword was not specified.
|
||||
/// `move` or `use` keywords were not specified.
|
||||
Ref,
|
||||
/// `use |x| y + x`.
|
||||
///
|
||||
/// Note that if you have a regular closure like `|| x.use`, this will *not* result
|
||||
/// in a `Use` capture. Instead, the `ExprUseVisitor` will look at the type
|
||||
/// of `x` and treat `x.use` as either a copy/clone/move as appropriate.
|
||||
Use {
|
||||
/// The span of the `use` keyword.
|
||||
use_kw: Span,
|
||||
},
|
||||
}
|
||||
|
||||
/// Closure lifetime binder, `for<'a, 'b>` in `for<'a, 'b> |_: &'a (), _: &'b ()|`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue