diff options
| author | Philipp Krones <hello@philkrones.com> | 2024-06-13 12:18:48 +0200 |
|---|---|---|
| committer | Philipp Krones <hello@philkrones.com> | 2024-06-13 12:24:08 +0200 |
| commit | cc63143bbf5ae28daae127902090492560313ca1 (patch) | |
| tree | 3cf8901da2767e0e330b32ef8a1f8a3bf75adc0c /clippy_lints/src/reference.rs | |
| parent | 35f54fd439432f56c749fbb34f1326e34ed1fc42 (diff) | |
| parent | aaade2d12d3cf78fd9eb24bf7973e86433d6373d (diff) | |
Merge remote-tracking branch 'upstream/master' into rustup
Diffstat (limited to 'clippy_lints/src/reference.rs')
| -rw-r--r-- | clippy_lints/src/reference.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clippy_lints/src/reference.rs b/clippy_lints/src/reference.rs index 16086ba6637..8f32cf5f2a1 100644 --- a/clippy_lints/src/reference.rs +++ b/clippy_lints/src/reference.rs @@ -48,6 +48,9 @@ impl EarlyLintPass for DerefAddrOf { fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &Expr) { if let ExprKind::Unary(UnOp::Deref, ref deref_target) = e.kind && let ExprKind::AddrOf(_, ref mutability, ref addrof_target) = without_parens(deref_target).kind + // NOTE(tesuji): `*&` forces rustc to const-promote the array to `.rodata` section. + // See #12854 for details. + && !matches!(addrof_target.kind, ExprKind::Array(_)) && deref_target.span.eq_ctxt(e.span) && !addrof_target.span.from_expansion() { |
