diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2024-11-20 01:54:24 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-20 01:54:24 -0500 |
| commit | 25dc4d0394df6ca1d4f3637aa4c1fad8c25833ab (patch) | |
| tree | 7c9d4b78935af6a6e3aeb4e5a8e7910f5262aca0 /library/core/src/str/mod.rs | |
| parent | bcfea1f8d253fd43eab36832fa601d192ac603d5 (diff) | |
| parent | 01fd384d5800deb1e96b0d8921e82317e9fcdb8b (diff) | |
| download | rust-25dc4d0394df6ca1d4f3637aa4c1fad8c25833ab.tar.gz rust-25dc4d0394df6ca1d4f3637aa4c1fad8c25833ab.zip | |
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()`.
Diffstat (limited to 'library/core/src/str/mod.rs')
| -rw-r--r-- | library/core/src/str/mod.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 5aecbf303f9..4629b770cb4 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -373,6 +373,7 @@ impl str { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "rustc_str_as_ptr", since = "1.32.0")] #[rustc_never_returns_null_ptr] + #[cfg_attr(not(bootstrap), rustc_as_ptr)] #[must_use] #[inline(always)] pub const fn as_ptr(&self) -> *const u8 { @@ -390,6 +391,7 @@ impl str { #[stable(feature = "str_as_mut_ptr", since = "1.36.0")] #[rustc_const_stable(feature = "const_str_as_mut", since = "1.83.0")] #[rustc_never_returns_null_ptr] + #[cfg_attr(not(bootstrap), rustc_as_ptr)] #[must_use] #[inline(always)] pub const fn as_mut_ptr(&mut self) -> *mut u8 { |
