about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-03-20 15:36:17 +0100
committerGitHub <noreply@github.com>2025-03-20 15:36:17 +0100
commitd9aec19589eb1f2f9631ff89059acb20a2b00799 (patch)
tree6190803603c109d264931ff8fd27f1352e33f8d6 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent919e7679f8544a0571b3a4070632b76cb4bb65b1 (diff)
parentdd92647f33e153b7a1feed1afbcd2c658c32b334 (diff)
downloadrust-d9aec19589eb1f2f9631ff89059acb20a2b00799.tar.gz
rust-d9aec19589eb1f2f9631ff89059acb20a2b00799.zip
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``
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions