rust/compiler/rustc_metadata/src
Matthias Krüger 915576935a
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 15:36:17 +01:00
..
rmeta Rollup merge of #138685 - nnethercote:use-Option-Ident-for-lowered-param-names, r=compiler-errors 2025-03-20 15:36:17 +01:00
creader.rs Rollup merge of #135501 - tgross35:stdlib-dependencies-private, r=bjorn3 2025-02-23 00:16:18 +01:00
dependency_format.rs Support rmeta inputs for --crate-type=bin --emit=obj 2025-03-07 18:33:05 +01:00
errors.rs Inject compiler_builtins during postprocessing rather than via AST 2025-02-21 17:37:03 +00:00
foreign_modules.rs Move some Map methods onto TyCtxt. 2025-02-17 13:21:02 +11:00
fs.rs Dogfood feature(file_buffered) 2024-09-24 14:25:16 -07:00
lib.rs Rollup merge of #138273 - petrochenkov:nonatroot, r=bjorn3 2025-03-13 10:58:23 +01:00
locator.rs Teach structured errors to display short Ty 2025-02-25 16:56:03 +00:00
native_libs.rs metadata: Ignore sysroot when doing the manual native lib search in rustc 2025-03-09 14:23:41 +03:00