Skip to content

Commit 8ef0703

Browse files
author
Thomas Bahn
committed
Follow changes to unconstrained lifetimes in rustc
This touches unsafe code! Fix #7
1 parent 58741c4 commit 8ef0703

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,12 @@ impl OwnedAsciiExt for AsciiString {
475475
}
476476

477477
/// Trait for converting into an ascii type.
478-
pub trait AsciiCast : AsciiExt {
478+
pub trait AsciiCast<'a>: AsciiExt {
479479
type Target;
480480

481481
/// Convert to an ascii type, return Err(()) on non-ASCII input.
482482
#[inline]
483-
fn to_ascii(&self) -> Result<Self::Target, ()> {
483+
fn to_ascii(&'a self) -> Result<Self::Target, ()> {
484484
if self.is_ascii() {
485485
Ok(unsafe { self.to_ascii_nocheck() })
486486
} else {
@@ -489,28 +489,28 @@ pub trait AsciiCast : AsciiExt {
489489
}
490490

491491
/// Convert to an ascii type, not doing any range asserts
492-
unsafe fn to_ascii_nocheck(&self) -> Self::Target;
492+
unsafe fn to_ascii_nocheck(&'a self) -> Self::Target;
493493
}
494494

495-
impl<'a> AsciiCast for [u8] {
495+
impl<'a> AsciiCast<'a> for [u8] {
496496
type Target = &'a AsciiStr;
497497

498498
#[inline]
499-
unsafe fn to_ascii_nocheck(&self) -> &'a AsciiStr {
499+
unsafe fn to_ascii_nocheck(&'a self) -> &'a AsciiStr {
500500
mem::transmute(self)
501501
}
502502
}
503503

504-
impl<'a> AsciiCast for str {
504+
impl<'a> AsciiCast<'a> for str {
505505
type Target = &'a AsciiStr;
506506

507507
#[inline]
508-
unsafe fn to_ascii_nocheck(&self) -> &'a AsciiStr {
508+
unsafe fn to_ascii_nocheck(&'a self) -> &'a AsciiStr {
509509
mem::transmute(self)
510510
}
511511
}
512512

513-
impl AsciiCast for u8 {
513+
impl<'a> AsciiCast<'a> for u8 {
514514
type Target = Ascii;
515515

516516
#[inline]
@@ -519,7 +519,7 @@ impl AsciiCast for u8 {
519519
}
520520
}
521521

522-
impl AsciiCast for char {
522+
impl<'a> AsciiCast<'a> for char {
523523
type Target = Ascii;
524524

525525
#[inline]

0 commit comments

Comments
 (0)