From 1ae4ee60d568ebdf84f85413ce4e7b8127e9d9f1 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 7 May 2025 14:19:32 +0200 Subject: [PATCH 1/3] Update reference for https://github.com/rust-lang/rust/pull/140593 --- src/destructors.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/destructors.md b/src/destructors.md index dbf1dcd1d..5cb5afd2b 100644 --- a/src/destructors.md +++ b/src/destructors.md @@ -374,6 +374,7 @@ expression which is one of the following: expression], [braced struct][struct expression], or [tuple][tuple expression] expression. * The final expression of any extending [block expression]. +* The arguments to [tuple struct][tuple struct] and [tuple variant][tuple variant] constructors. So the borrow expressions in `&mut 0`, `(&1, &mut 2)`, and `Some { 0: &mut 3 }` are all extending expressions. The borrows in `&0 + &1` and `Some(&mut 0)` are @@ -467,6 +468,8 @@ There is one additional case to be aware of: when a panic reaches a [non-unwindi [struct pattern]: patterns.md#struct-patterns [tuple pattern]: patterns.md#tuple-patterns [tuple struct pattern]: patterns.md#tuple-struct-patterns +[tuple struct]: struct.md#r-type.struct.tuple +[tuple variant]: enum.md#r-type.enum.declaration [array expression]: expressions/array-expr.md#array-expressions [block expression]: expressions/block-expr.md From 83cb1a0e22085932bcf5bce4a6c5505024227353 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Wed, 7 May 2025 14:36:37 +0200 Subject: [PATCH 2/3] Fix links. --- src/destructors.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/destructors.md b/src/destructors.md index 5cb5afd2b..7a3de2bcd 100644 --- a/src/destructors.md +++ b/src/destructors.md @@ -468,8 +468,8 @@ There is one additional case to be aware of: when a panic reaches a [non-unwindi [struct pattern]: patterns.md#struct-patterns [tuple pattern]: patterns.md#tuple-patterns [tuple struct pattern]: patterns.md#tuple-struct-patterns -[tuple struct]: struct.md#r-type.struct.tuple -[tuple variant]: enum.md#r-type.enum.declaration +[tuple struct]: types/struct.md#r-type.struct.tuple +[tuple variant]: types/enum.md#r-type.enum.declaration [array expression]: expressions/array-expr.md#array-expressions [block expression]: expressions/block-expr.md From ea11029e70fbd25f4b0336d20bb38177c82291a8 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 8 May 2025 06:36:31 +0200 Subject: [PATCH 3/3] Updated outdated text. --- src/destructors.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/destructors.md b/src/destructors.md index 7a3de2bcd..16f4dd5a1 100644 --- a/src/destructors.md +++ b/src/destructors.md @@ -376,9 +376,8 @@ expression which is one of the following: * The final expression of any extending [block expression]. * The arguments to [tuple struct][tuple struct] and [tuple variant][tuple variant] constructors. -So the borrow expressions in `&mut 0`, `(&1, &mut 2)`, and `Some { 0: &mut 3 }` -are all extending expressions. The borrows in `&0 + &1` and `Some(&mut 0)` are -not: the latter is syntactically a function call expression. +So the borrow expressions in `&mut 0`, `(&1, &mut 2)`, and `Some(&mut 3)` +are all extending expressions. The borrows in `&0 + &1` and `f(&mut 0)` are not. The operand of any extending borrow expression has its temporary scope extended.