diff options
| author | Urgau <urgau@numericable.fr> | 2024-11-26 21:25:27 +0100 |
|---|---|---|
| committer | Urgau <urgau@numericable.fr> | 2024-11-26 21:25:27 +0100 |
| commit | 9b040e92aa6d73c6c62ed1c12b59f40eed398aa4 (patch) | |
| tree | 0895558abc5f417c2f12254fa0a51b9e45ee1342 | |
| parent | dff3e7ccd4a18958c938136c4ccdc853fcc86194 (diff) | |
| download | rust-9b040e92aa6d73c6c62ed1c12b59f40eed398aa4.tar.gz rust-9b040e92aa6d73c6c62ed1c12b59f40eed398aa4.zip | |
Avoid decoding from metadata if not necessary
| -rw-r--r-- | compiler/rustc_lint/src/dangling.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/dangling.rs b/compiler/rustc_lint/src/dangling.rs index e3e51ba263d..7b6e79f7137 100644 --- a/compiler/rustc_lint/src/dangling.rs +++ b/compiler/rustc_lint/src/dangling.rs @@ -130,9 +130,9 @@ impl DanglingPointerSearcher<'_, '_> { fn lint_expr(cx: &LateContext<'_>, expr: &Expr<'_>) { if let ExprKind::MethodCall(method, receiver, _args, _span) = expr.kind + && is_temporary_rvalue(receiver) && let Some(fn_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) && cx.tcx.has_attr(fn_id, sym::rustc_as_ptr) - && is_temporary_rvalue(receiver) && let ty = cx.typeck_results().expr_ty(receiver) && owns_allocation(cx.tcx, ty) { |
