1
Fork 0

New lint: dangling_pointers_from_temporaries

This commit is contained in:
Pavel Grigorenko 2024-10-16 22:19:56 +03:00
parent 81d6652e74
commit c69894eaec
33 changed files with 1093 additions and 128 deletions

View file

@ -1137,16 +1137,19 @@ pub(crate) struct IgnoredUnlessCrateSpecified<'a> {
pub name: Symbol,
}
// methods.rs
// dangling.rs
#[derive(LintDiagnostic)]
#[diag(lint_cstring_ptr)]
#[diag(lint_dangling_pointers_from_temporaries)]
#[note]
#[help]
pub(crate) struct CStringPtr {
#[label(lint_as_ptr_label)]
pub as_ptr: Span,
#[label(lint_unwrap_label)]
pub unwrap: Span,
// FIXME: put #[primary_span] on `ptr_span` once it does not cause conflicts
pub(crate) struct DanglingPointersFromTemporaries<'tcx> {
pub callee: Symbol,
pub ty: Ty<'tcx>,
#[label(lint_label_ptr)]
pub ptr_span: Span,
#[label(lint_label_temporary)]
pub temporary_span: Span,
}
// multiple_supertrait_upcastable.rs