about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/expr.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-08-12 10:08:04 +0200
committerRalf Jung <post@ralfj.de>2024-08-12 10:08:04 +0200
commitc0c6f28cd6ac0d2541f4d546b6098874d375747d (patch)
tree503430bb7d255dfd5e6de45c075e2b216ac31a4c /compiler/rustc_parse/src/parser/expr.rs
parent3652011f54f007855b33a4411234f0a4612d1814 (diff)
parent0aa17a4c4de2daaf44e38e40f3ac8c2b4275d6bd (diff)
downloadrust-c0c6f28cd6ac0d2541f4d546b6098874d375747d.tar.gz
rust-c0c6f28cd6ac0d2541f4d546b6098874d375747d.zip
Merge from rustc
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index ccf8dcdf0b6..cf5d65708ab 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -694,12 +694,12 @@ impl<'a> Parser<'a> {
                         // `foo: `
                         ExprKind::Path(None, ast::Path { segments, .. }),
                         token::Ident(kw::For | kw::Loop | kw::While, IdentIsRaw::No),
-                    ) if segments.len() == 1 => {
+                    ) if let [segment] = segments.as_slice() => {
                         let snapshot = self.create_snapshot_for_diagnostic();
                         let label = Label {
                             ident: Ident::from_str_and_span(
-                                &format!("'{}", segments[0].ident),
-                                segments[0].ident.span,
+                                &format!("'{}", segment.ident),
+                                segment.ident.span,
                             ),
                         };
                         match self.parse_expr_labeled(label, false) {