rust/compiler/rustc_resolve/src
Matthias Krüger 00f3ad0c88
Rollup merge of #138685 - nnethercote:use-Option-Ident-for-lowered-param-names, r=compiler-errors
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.

r? ```@compiler-errors```
2025-03-20 22:34:02 +01:00
..
late Use Option<Ident> for lowered param names. 2025-03-19 20:54:10 +11:00
build_reduced_graph.rs resolve: Avoid some unstable iteration 2025-03-14 18:34:08 +03:00
check_unused.rs Run clippy --fix for unnecessary_map_or lint 2025-01-19 19:15:00 +00:00
def_collector.rs Pass Option<Symbol> to def_path_data/create_def methods. 2025-03-07 20:53:00 +11:00
diagnostics.rs resolve: Avoid some unstable iteration 2025-03-14 18:34:08 +03:00
effective_visibilities.rs rustc_resolve: reduce rightwards drift with let..else 👉💨 2025-01-21 13:42:32 +00:00
errors.rs Allow builtin macros to be used more than once. 2025-03-19 14:12:47 +01:00
ident.rs resolve: Avoid some unstable iteration 2025-03-14 18:34:08 +03:00
imports.rs Rollup merge of #137529 - klensy:unused3, r=lcnr 2025-02-26 04:15:04 +01:00
late.rs resolve: Avoid some unstable iteration 2025-03-14 18:34:08 +03:00
lib.rs Allow builtin macros to be used more than once. 2025-03-19 14:12:47 +01:00
macros.rs Allow builtin macros to be used more than once. 2025-03-19 14:12:47 +01:00
rustdoc.rs rustdoc: improve refdef handling in the unresolved link lint 2025-02-15 12:21:35 -07:00