mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
![]() 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`` |
||
---|---|---|
.. | ||
early | ||
nonstandard_style | ||
types | ||
async_closures.rs | ||
async_fn_in_trait.rs | ||
builtin.rs | ||
context.rs | ||
dangling.rs | ||
default_could_be_derived.rs | ||
deref_into_dyn_supertrait.rs | ||
drop_forget_useless.rs | ||
early.rs | ||
enum_intrinsics_non_enums.rs | ||
errors.rs | ||
expect.rs | ||
for_loops_over_fallibles.rs | ||
foreign_modules.rs | ||
hidden_unicode_codepoints.rs | ||
if_let_rescope.rs | ||
impl_trait_overcaptures.rs | ||
internal.rs | ||
invalid_from_utf8.rs | ||
late.rs | ||
let_underscore.rs | ||
levels.rs | ||
lib.rs | ||
lints.rs | ||
macro_expr_fragment_specifier_2024_migration.rs | ||
map_unit_fn.rs | ||
multiple_supertrait_upcastable.rs | ||
non_ascii_idents.rs | ||
non_fmt_panic.rs | ||
non_local_def.rs | ||
nonstandard_style.rs | ||
noop_method_call.rs | ||
opaque_hidden_inferred_bound.rs | ||
pass_by_value.rs | ||
passes.rs | ||
precedence.rs | ||
ptr_nulls.rs | ||
redundant_semicolon.rs | ||
reference_casting.rs | ||
shadowed_into_iter.rs | ||
static_mut_refs.rs | ||
tests.rs | ||
traits.rs | ||
types.rs | ||
unit_bindings.rs | ||
unqualified_local_imports.rs | ||
unused.rs |