Skip to content

Commit e80ee05

Browse files
committedNov 12, 2020
Auto merge of #78998 - m-ou-se:rollup-6r4pt9m, r=m-ou-se
Rollup of 7 pull requests Successful merges: - #76730 (Fix rustdoc rendering of by-value mutable arguments in async fn) - #78836 (Implement destructuring assignment for structs and slices) - #78857 (Improve BinaryHeap performance) - #78950 (Add asm register information for SPIR-V) - #78970 (update rustfmt to v1.4.25) - #78972 (Update cargo) - #78987 (extend min_const_generics param ty tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents 9722952 + 38ca6e3 commit e80ee05

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+839
-133
lines changed
 

‎Cargo.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4329,7 +4329,7 @@ dependencies = [
43294329

43304330
[[package]]
43314331
name = "rustfmt-nightly"
4332-
version = "1.4.24"
4332+
version = "1.4.25"
43334333
dependencies = [
43344334
"annotate-snippets 0.6.1",
43354335
"anyhow",

‎compiler/rustc_ast/src/ast.rs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ pub struct Expr {
10611061

10621062
// `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
10631063
#[cfg(target_arch = "x86_64")]
1064-
rustc_data_structures::static_assert_size!(Expr, 112);
1064+
rustc_data_structures::static_assert_size!(Expr, 120);
10651065

10661066
impl Expr {
10671067
/// Returns `true` if this expression would be valid somewhere that expects a value;
@@ -1218,6 +1218,16 @@ pub enum RangeLimits {
12181218
Closed,
12191219
}
12201220

1221+
#[derive(Clone, Encodable, Decodable, Debug)]
1222+
pub enum StructRest {
1223+
/// `..x`.
1224+
Base(P<Expr>),
1225+
/// `..`.
1226+
Rest(Span),
1227+
/// No trailing `..` or expression.
1228+
None,
1229+
}
1230+
12211231
#[derive(Clone, Encodable, Decodable, Debug)]
12221232
pub enum ExprKind {
12231233
/// A `box x` expression.
@@ -1312,7 +1322,7 @@ pub enum ExprKind {
13121322
Field(P<Expr>, Ident),
13131323
/// An indexing operation (e.g., `foo[2]`).
13141324
Index(P<Expr>, P<Expr>),
1315-
/// A range (e.g., `1..2`, `1..`, `..2`, `1..=2`, `..=2`).
1325+
/// A range (e.g., `1..2`, `1..`, `..2`, `1..=2`, `..=2`; and `..` in destructuring assingment).
13161326
Range(Option<P<Expr>>, Option<P<Expr>>, RangeLimits),
13171327

13181328
/// Variable reference, possibly containing `::` and/or type
@@ -1340,9 +1350,8 @@ pub enum ExprKind {
13401350

13411351
/// A struct literal expression.
13421352
///
1343-
/// E.g., `Foo {x: 1, y: 2}`, or `Foo {x: 1, .. base}`,
1344-
/// where `base` is the `Option<Expr>`.
1345-
Struct(Path, Vec<Field>, Option<P<Expr>>),
1353+
/// E.g., `Foo {x: 1, y: 2}`, or `Foo {x: 1, .. rest}`.
1354+
Struct(Path, Vec<Field>, StructRest),
13461355

13471356
/// An array literal constructed from one repeated element.
13481357
///

0 commit comments

Comments
 (0)