File tree 2 files changed +10
-2
lines changed
tests/ui/associated-types
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -710,6 +710,14 @@ impl AsRef<CStr> for CStr {
710
710
}
711
711
}
712
712
713
+ impl ops:: Deref for CStr {
714
+ type Target = crate :: bstr:: ByteStr ;
715
+
716
+ fn deref ( & self ) -> & Self :: Target {
717
+ crate :: bstr:: ByteStr :: from_bytes ( self . to_bytes ( ) )
718
+ }
719
+ }
720
+
713
721
/// Calculate the length of a nul-terminated string. Defers to C's `strlen` when possible.
714
722
///
715
723
/// # Safety
Original file line number Diff line number Diff line change @@ -49,10 +49,10 @@ LL - type X = std::ops::Deref::Target;
49
49
LL + type X = <ByteString as Deref>::Target;
50
50
|
51
51
LL - type X = std::ops::Deref::Target;
52
- LL + type X = <CString as Deref>::Target;
52
+ LL + type X = <CStr as Deref>::Target;
53
53
|
54
54
LL - type X = std::ops::Deref::Target;
55
- LL + type X = <IoSlice<'_> as Deref>::Target;
55
+ LL + type X = <CString as Deref>::Target;
56
56
|
57
57
and N other candidates
58
58
You can’t perform that action at this time.
0 commit comments