File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,7 +119,10 @@ impl U8UtfExt for u8 {
119119
120120
121121/// Methods for working with `u16`s as UTF-16 units.
122- pub trait U16UtfExt {
122+ ///
123+ /// This trait is marked unsafe as avoiding undefined behaviour necessarily
124+ /// depends on the implementation of `utf16_needs_extra_unit` being correct.
125+ pub unsafe trait U16UtfExt {
123126 /// Will you need an extra unit to complete this codepoint?
124127 ///
125128 /// Returns `Err` for trailing surrogates, `Ok(true)` for leading surrogates,
@@ -132,7 +135,7 @@ pub trait U16UtfExt {
132135 /// Is basically an unchecked variant of `utf16_needs_extra_unit()`.
133136 fn is_utf16_leading_surrogate ( self ) -> bool ;
134137}
135- impl U16UtfExt for u16 {
138+ unsafe impl U16UtfExt for u16 {
136139 #[ inline]
137140 fn utf16_needs_extra_unit ( self ) -> Result < bool , Utf16FirstUnitError > {
138141 match self {
You can’t perform that action at this time.
0 commit comments