Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor inner allocation logic of temp dangling pointer lint #133263

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Nov 20, 2024

This PR refactors the inner allocation logic of the dangling_pointers_from_temporaries lint by removing the hardcoded list of types and instead taking advantage of the semantics of the as_ptr{,_mut} methods and derefs.

cc @GrigorenkoPV
r? compiler

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 20, 2024
@GrigorenkoPV
Copy link
Contributor

Okay, I've checked, [&u8; 10] gets linted, as it should.

The MaybeUninit<&u8> does not, even though I think it should. See above.

Anyways, with this change we can now remove the diagnostic item that was added for SyncUnsafeCell in #132732.

Also cc #132281 & #128985.

@Urgau Urgau changed the title Refactor inner allocation logic of temp dandling pointer lint Refactor inner allocation logic of temp dangling pointer lint Nov 21, 2024
use rustc_hir::{Block, Body, Expr, ExprKind, FnDecl, LangItem};
use rustc_middle::ty::{Ty, TyCtxt};
use rustc_hir::{Block, Body, Expr, ExprKind, FnDecl};
// use rustc_middle::ty::{self, Ty};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A leftover comment, probably no big deal

@GrigorenkoPV
Copy link
Contributor

Anyways, with this change we can now remove the diagnostic item that was added for SyncUnsafeCell in #132732.

And Cell too, added in #128985.
https://github.com/rust-lang/rust/pull/128985/files#diff-75a679ddd1aae61c8b60e45cea1fb213a086caee3600993c68af9f7a09785e9eR307
Well, unless someone else started using it since then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants