Rollup merge of #81922 - magurotuna:issue81522, r=matthewjasper
Let `#[allow(unstable_name_collisions)]` work for things other than function
Fixes #81522
In addition to the report in #81522, currently `#[allow(unstable_name_collisions)]` doesn't suppress the corresponding diagnostics even if this attribute is appended to an expression statement or a let statement. It seems like this is because the wrong `HirId` is passed to `struct_span_lint_hir`.
It's fixed in this PR, and a regression test for it is also added.