Skip to content

Commit

Permalink
Avoid decoding from metadata if not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Nov 26, 2024
1 parent dff3e7c commit 9b040e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/dangling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 9b040e9

Please sign in to comment.