rust/compiler/rustc_middle/src
Nicholas Nethercote f27cab806e Use Option<Ident> for lowered param names.
Parameter patterns are lowered to an `Ident` by
`lower_fn_params_to_names`, which is used when lowering bare function
types, trait methods, and foreign functions. Currently, there are two
exceptional cases where the lowered param can become an empty `Ident`.

- If the incoming pattern is an empty `Ident`. This occurs if the
  parameter is anonymous, e.g. in a bare function type.

- If the incoming pattern is neither an ident nor an underscore. Any
  such parameter will have triggered a compile error (hence the
  `span_delayed_bug`), but lowering still occurs.

This commit replaces these empty `Ident` results with `None`, which
eliminates a number of `kw::Empty` uses, and makes it impossible to fail
to check for these exceptional cases.

Note: the `FIXME` comment in `is_unwrap_or_empty_symbol` is removed. It
actually should have been removed in #138482, the precursor to this PR.
That PR changed the lowering of wild patterns to `_` symbols instead of
empty symbols, which made the mentioned underscore check load-bearing.
2025-03-19 20:54:10 +11:00
..
dep_graph Remove impl_for_typed_def_id macro. 2025-02-04 08:34:11 +11:00
hir Use Option<Ident> for lowered param names. 2025-03-19 20:54:10 +11:00
hooks Pretty print pattern type values with transmute if they don't satisfy their pattern 2025-02-05 14:56:41 +00:00
infer Clean up trivial traversal/lift impl generator macro calls. 2025-02-06 13:31:43 +11:00
middle Mark #[rustc_std_internal_symbol] as extern indicator 2025-03-17 14:06:56 +00:00
mir Rollup merge of #137465 - Zalathar:visit-primary, r=oli-obk 2025-03-17 16:34:48 +01:00
query Use Option<Ident> for lowered param names. 2025-03-19 20:54:10 +11:00
thir Implement .use keyword as an alias of clone 2025-03-06 17:58:32 -03:00
traits Fold visit into ty 2025-03-15 06:34:36 +00:00
ty Rollup merge of #138384 - nnethercote:hir-ItemKind-idents, r=fmease 2025-03-17 22:49:04 +01:00
util Simplify intra-crate qualifiers. 2025-02-11 14:59:13 +11:00
arena.rs intern valtrees 2025-02-13 00:38:17 +01:00
error.rs Teach structured errors to display short Ty 2025-02-25 16:56:03 +00:00
lib.rs Auto merge of #138414 - matthiaskrgr:rollup-9ablqdb, r=matthiaskrgr 2025-03-12 17:27:43 +00:00
lint.rs Move methods from Map to TyCtxt, part 3. 2025-02-21 14:31:09 +11:00
macros.rs Fold visit into ty 2025-03-15 06:34:36 +00:00
metadata.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
tests.rs Give an item related to issue 27438 a more meaningful name 2024-04-30 22:27:19 +02:00
thir.rs Split visit_primary_bindings into two variants 2025-03-16 12:10:35 +11:00
values.rs Move some Map methods onto TyCtxt. 2025-02-17 13:21:02 +11:00