Rollup merge of #132732 - gavincrawford:as_ptr_attribute, r=Urgau
Use attributes for `dangling_pointers_from_temporaries` lint Checking for dangling pointers by function name isn't ideal, and leaves out certain pointer-returning methods that don't follow the `as_ptr` naming convention. Using an attribute for this lint cleans things up and allows more thorough coverage of other methods, such as `UnsafeCell::get()`.
This commit is contained in:
commit
25dc4d0394
13 changed files with 83 additions and 32 deletions
|
@ -162,6 +162,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
self.check_rustc_std_internal_symbol(attr, span, target)
|
||||
}
|
||||
[sym::naked, ..] => self.check_naked(hir_id, attr, span, target, attrs),
|
||||
[sym::rustc_as_ptr, ..] => {
|
||||
self.check_applied_to_fn_or_method(hir_id, attr, span, target)
|
||||
}
|
||||
[sym::rustc_never_returns_null_ptr, ..] => {
|
||||
self.check_applied_to_fn_or_method(hir_id, attr, span, target)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue