diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-04-24 11:56:44 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-05-09 13:57:49 +1000 |
| commit | 0984db553ddd25c0d16ef68b91bd731825309ac5 (patch) | |
| tree | 10a2604358948af0479da4124a1387739a3c3e49 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 667247db71ea18c4130dd018d060e7f09d589490 (diff) | |
| download | rust-0984db553ddd25c0d16ef68b91bd731825309ac5.tar.gz rust-0984db553ddd25c0d16ef68b91bd731825309ac5.zip | |
Remove `Ident::empty`.
All uses have been removed. And it's nonsensical: an identifier by definition has at least one char. The commits adds an is-non-empty assertion to `Ident::new` to enforce this, and converts some `Ident` constructions to use `Ident::new`. Adding the assertion requires making `Ident::new` and `Ident::with_dummy_span` non-const, which is no great loss. The commit amends a couple of places that do path splitting to ensure no empty identifiers are created.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index f3b53971b29..2a7910a6af4 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -3828,7 +3828,7 @@ impl<'a> Parser<'a> { // Convert `label` -> `'label`, // so that nameres doesn't complain about non-existing label let label = format!("'{}", ident.name); - let ident = Ident { name: Symbol::intern(&label), span: ident.span }; + let ident = Ident::new(Symbol::intern(&label), ident.span); self.dcx().emit_err(errors::ExpectedLabelFoundIdent { span: ident.span, |
