rust/compiler/rustc_codegen_ssa/src
bors f206533fd4 Auto merge of #105605 - inquisitivecrystal:attr-validation, r=cjgillot
Don't perform invalid checks in `codegen_attrs`

The attributes `#[track_caller]` and `#[cmse_nonsecure_entry]` are only valid on functions. When validating one of these attributes, codegen_attrs previously called `fn_sig`, [which can only be used on functions](https://github.com/rust-lang/rust/pull/105201), on the item the attribute was attached to, assuming that the item was a function without checking. This led to [ICEs in situations where the attribute was incorrectly used on non-functions](https://github.com/rust-lang/rust/issues/105594).

With this change, we skip calling `fn_sig` if the item the attribute is attached to must be a function but isn't, because `check_attr` will reject such cases without codegen_attrs's intervention.

As a side note, some of the attributes in codegen_attrs are only valid on functions, but that property isn't actually checked. I'm planning to fix that in a follow up PR since it's a behavior change that will need to be validated rather than an obvious bugfix. Thankfully, all the attributes like that I've found so far are unstable.

Fixes #105594.

r? `@cjgillot`
2022-12-26 09:06:51 +00:00
..
back Rollup merge of #105955 - Nilstrieb:no-trivial-opt-wrappers-we-have-field-accesses-for-that, r=cjgillot 2022-12-25 22:15:00 +01:00
coverageinfo Remove in_band_lifetimes from rustc_codegen_ssa 2021-12-15 00:41:41 -05:00
debuginfo fix more clippy::style findings 2022-12-25 17:32:26 +01:00
mir abort immediately on bad mem::zeroed/uninit 2022-12-22 16:37:42 +01:00
traits Auto merge of #105252 - bjorn3:codegen_less_pair_values, r=nagisa 2022-12-12 10:38:31 +00:00
base.rs Remove wrapper functions for some unstable options 2022-12-20 15:02:15 +01:00
codegen_attrs.rs Check fn_sig in more situations per review 2022-12-15 23:55:42 -08:00
common.rs Simplify cast_shift_expr_rhs. 2022-10-25 14:39:20 +11:00
errors.rs Move some codegen-y methods from rustc_hir_analysis::collect -> rustc_codegen_ssa 2022-12-13 05:01:36 +00:00
glue.rs Add 0..=isize::MAX range metadata to size loads from vtables 2022-12-08 01:30:07 -05:00
lib.rs Move some codegen-y methods from rustc_hir_analysis::collect -> rustc_codegen_ssa 2022-12-13 05:01:36 +00:00
meth.rs rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00
mono_item.rs Store a LocalDefId in hir::AnonConst. 2022-11-13 14:06:11 +00:00
target_features.rs rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00