Skip to content

Commit 34a8dbb

Browse files
committed
Removed the lifetime anchor on CStr::from_raw_ptr
RFC PR rust-lang#556 is likely to get discarded.
1 parent 9565b47 commit 34a8dbb

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

text/0000-c-str-deref.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,10 @@ made workable in static expressions through a compiler plugin.
113113
In cases when an FFI function returns a pointer to a non-owned C string,
114114
it might be preferable to wrap the returned string safely as a 'thin'
115115
`&CStr` rather than scan it into a slice up front. To facilitate this,
116-
conversion from a raw pointer should be added (using the
117-
[lifetime anchor](https://github.com/rust-lang/rfcs/pull/556) convention):
116+
conversion from a raw pointer should be added:
118117
```rust
119118
impl CStr {
120-
pub unsafe fn from_raw_ptr<'a, T: ?Sized>(ptr: *const libc::c_char,
121-
life_anchor: &'a T)
122-
-> &'a CStr
119+
pub unsafe fn from_raw_ptr<'a>(ptr: *const libc::c_char) -> &'a CStr
123120
{ ... }
124121
}
125122
```

0 commit comments

Comments
 (0)