@@ -54,9 +54,9 @@ use crate::lints::{
5454 BuiltinEllipsisInclusiveRangePatternsLint , BuiltinExplicitOutlives ,
5555 BuiltinExplicitOutlivesSuggestion , BuiltinFeatureIssueNote , BuiltinIncompleteFeatures ,
5656 BuiltinIncompleteFeaturesHelp , BuiltinInternalFeatures , BuiltinKeywordIdents ,
57- BuiltinLocalVariablePointerImpl , BuiltinMissingCopyImpl , BuiltinMissingDebugImpl ,
58- BuiltinMissingDoc , BuiltinMutablesTransmutes , BuiltinNoMangleGeneric ,
59- BuiltinNonShorthandFieldPatterns , BuiltinSpecialModuleNameUsed , BuiltinTrivialBounds ,
57+ BuiltinMissingCopyImpl , BuiltinMissingDebugImpl , BuiltinMissingDoc , BuiltinMutablesTransmutes ,
58+ BuiltinNoMangleGeneric , BuiltinNonShorthandFieldPatterns ,
59+ BuiltinReturningPointersToLocalVariables , BuiltinSpecialModuleNameUsed , BuiltinTrivialBounds ,
6060 BuiltinTypeAliasBounds , BuiltinUngatedAsyncFnTrackCaller , BuiltinUnpermittedTypeInit ,
6161 BuiltinUnpermittedTypeInitSub , BuiltinUnreachablePub , BuiltinUnsafe , BuiltinUnstableFeatures ,
6262 BuiltinUnusedDocComment , BuiltinUnusedDocCommentSub , BuiltinWhileTrue , InvalidAsmLabel ,
@@ -2987,9 +2987,9 @@ impl<'tcx> LateLintPass<'tcx> for AsmLabels {
29872987}
29882988
29892989declare_lint ! {
2990- /// The `return_local_variable_ptr ` lint detects when pointer to stack
2991- /// memory associated with a local variable is returned. That pointer
2992- /// is immediately dangling.
2990+ /// The `returning_pointers_to_local_variables ` lint detects when pointer
2991+ /// to stack memory associated with a local variable is returned. That
2992+ /// pointer is immediately dangling.
29932993 ///
29942994 /// ### Example
29952995 ///
@@ -3000,22 +3000,20 @@ declare_lint! {
30003000 /// }
30013001 /// ```
30023002 ///
3003- /// This will produce:
3004- ///
30053003 /// {{produces}}
30063004 ///
30073005 /// ### Explanation
30083006 ///
30093007 /// Returning a pointer to memory refering to a local variable will always
30103008 /// end up in a dangling pointer after returning.
3011- pub RETURN_LOCAL_VARIABLE_PTR ,
3009+ pub RETURNING_POINTERS_TO_LOCAL_VARIABLES ,
30123010 Warn ,
30133011 "returning a pointer to stack memory associated with a local variable" ,
30143012}
30153013
3016- declare_lint_pass ! ( ReturnLocalVariablePointer => [ RETURN_LOCAL_VARIABLE_PTR ] ) ;
3014+ declare_lint_pass ! ( ReturningPointersToLocalVariables => [ RETURNING_POINTERS_TO_LOCAL_VARIABLES ] ) ;
30173015
3018- impl < ' tcx > LateLintPass < ' tcx > for ReturnLocalVariablePointer {
3016+ impl < ' tcx > LateLintPass < ' tcx > for ReturningPointersToLocalVariables {
30193017 fn check_fn (
30203018 & mut self ,
30213019 cx : & LateContext < ' tcx > ,
@@ -3061,7 +3059,7 @@ impl<'tcx> LateLintPass<'tcx> for ReturnLocalVariablePointer {
30613059 }
30623060}
30633061
3064- impl ReturnLocalVariablePointer {
3062+ impl ReturningPointersToLocalVariables {
30653063 /// Evaluates the return expression of a function and emits a lint if it
30663064 /// returns a pointer to a local variable.
30673065 fn maybe_lint_return_expr < ' tcx > ( cx : & LateContext < ' tcx > , return_expr : & hir:: Expr < ' tcx > ) {
@@ -3078,9 +3076,9 @@ impl ReturnLocalVariablePointer {
30783076 ) = addr_expr. kind
30793077 {
30803078 cx. emit_span_lint (
3081- RETURN_LOCAL_VARIABLE_PTR ,
3079+ RETURNING_POINTERS_TO_LOCAL_VARIABLES ,
30823080 return_expr. span ,
3083- BuiltinLocalVariablePointerImpl ,
3081+ BuiltinReturningPointersToLocalVariables ,
30843082 ) ;
30853083 }
30863084 }
0 commit comments