diff options
| author | Pavel Grigorenko <GrigorenkoPV@ya.ru> | 2024-10-16 22:19:56 +0300 |
|---|---|---|
| committer | Pavel Grigorenko <GrigorenkoPV@ya.ru> | 2024-10-28 14:16:05 +0300 |
| commit | c69894eaec2a29f9db023cbfff63e48266de4ee5 (patch) | |
| tree | 503a18333c8b8f4a1d968c28154f4c3942df67db /compiler/rustc_lint/src/lints.rs | |
| parent | 81d6652e741f091f4ee0b7a660120d204e0417b8 (diff) | |
| download | rust-c69894eaec2a29f9db023cbfff63e48266de4ee5.tar.gz rust-c69894eaec2a29f9db023cbfff63e48266de4ee5.zip | |
New lint: `dangling_pointers_from_temporaries`
Diffstat (limited to 'compiler/rustc_lint/src/lints.rs')
| -rw-r--r-- | compiler/rustc_lint/src/lints.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 16cfae17d40..000f4b697bd 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -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 |
