@@ -54,9 +54,9 @@ use crate::lints::{
54
54
BuiltinEllipsisInclusiveRangePatternsLint , BuiltinExplicitOutlives ,
55
55
BuiltinExplicitOutlivesSuggestion , BuiltinFeatureIssueNote , BuiltinIncompleteFeatures ,
56
56
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 ,
60
60
BuiltinTypeAliasBounds , BuiltinUngatedAsyncFnTrackCaller , BuiltinUnpermittedTypeInit ,
61
61
BuiltinUnpermittedTypeInitSub , BuiltinUnreachablePub , BuiltinUnsafe , BuiltinUnstableFeatures ,
62
62
BuiltinUnusedDocComment , BuiltinUnusedDocCommentSub , BuiltinWhileTrue , InvalidAsmLabel ,
@@ -2987,9 +2987,9 @@ impl<'tcx> LateLintPass<'tcx> for AsmLabels {
2987
2987
}
2988
2988
2989
2989
declare_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.
2993
2993
///
2994
2994
/// ### Example
2995
2995
///
@@ -3000,22 +3000,20 @@ declare_lint! {
3000
3000
/// }
3001
3001
/// ```
3002
3002
///
3003
- /// This will produce:
3004
- ///
3005
3003
/// {{produces}}
3006
3004
///
3007
3005
/// ### Explanation
3008
3006
///
3009
3007
/// Returning a pointer to memory refering to a local variable will always
3010
3008
/// end up in a dangling pointer after returning.
3011
- pub RETURN_LOCAL_VARIABLE_PTR ,
3009
+ pub RETURNING_POINTERS_TO_LOCAL_VARIABLES ,
3012
3010
Warn ,
3013
3011
"returning a pointer to stack memory associated with a local variable" ,
3014
3012
}
3015
3013
3016
- declare_lint_pass ! ( ReturnLocalVariablePointer => [ RETURN_LOCAL_VARIABLE_PTR ] ) ;
3014
+ declare_lint_pass ! ( ReturningPointersToLocalVariables => [ RETURNING_POINTERS_TO_LOCAL_VARIABLES ] ) ;
3017
3015
3018
- impl < ' tcx > LateLintPass < ' tcx > for ReturnLocalVariablePointer {
3016
+ impl < ' tcx > LateLintPass < ' tcx > for ReturningPointersToLocalVariables {
3019
3017
fn check_fn (
3020
3018
& mut self ,
3021
3019
cx : & LateContext < ' tcx > ,
@@ -3061,7 +3059,7 @@ impl<'tcx> LateLintPass<'tcx> for ReturnLocalVariablePointer {
3061
3059
}
3062
3060
}
3063
3061
3064
- impl ReturnLocalVariablePointer {
3062
+ impl ReturningPointersToLocalVariables {
3065
3063
/// Evaluates the return expression of a function and emits a lint if it
3066
3064
/// returns a pointer to a local variable.
3067
3065
fn maybe_lint_return_expr < ' tcx > ( cx : & LateContext < ' tcx > , return_expr : & hir:: Expr < ' tcx > ) {
@@ -3078,9 +3076,9 @@ impl ReturnLocalVariablePointer {
3078
3076
) = addr_expr. kind
3079
3077
{
3080
3078
cx. emit_span_lint (
3081
- RETURN_LOCAL_VARIABLE_PTR ,
3079
+ RETURNING_POINTERS_TO_LOCAL_VARIABLES ,
3082
3080
return_expr. span ,
3083
- BuiltinLocalVariablePointerImpl ,
3081
+ BuiltinReturningPointersToLocalVariables ,
3084
3082
) ;
3085
3083
}
3086
3084
}
0 commit comments