1
Fork 0
rust/compiler/rustc_trait_selection/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
..
error_reporting Use Option<Ident> for lowered param names. 2025-03-19 20:54:10 +11:00
errors Teach structured errors to display short Ty 2025-02-25 16:56:03 +00:00
solve Fold visit into ty 2025-03-15 06:34:36 +00:00
traits Remove existing AFIDT implementation 2025-03-18 17:35:26 +00:00
errors.rs Move hir::Item::ident into hir::ItemKind. 2025-03-18 06:29:50 +11:00
infer.rs Fix next solver handling of shallow trait impl check 2025-03-19 14:40:14 +00:00
lib.rs Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
regions.rs Only use implied bounds hack if bevy, and use deeply normalize in implied bounds hack 2025-03-04 18:18:48 +00:00
solve.rs impossible obligations check fast path 2024-10-10 06:09:50 -04:00