diff options
| author | blake2-ppc <blake2-ppc> | 2013-08-05 17:52:03 +0200 |
|---|---|---|
| committer | blake2-ppc <blake2-ppc> | 2013-08-05 17:55:06 +0200 |
| commit | 476dfc24b311a837f931e678c4bdfbb99d29f4e4 (patch) | |
| tree | c0ec521e48d9b5cb370ca5c3a13bf92e28bee2b0 /src/libstd | |
| parent | dbaca98d78f1458485b36b2565593d7d13e1c90f (diff) | |
| download | rust-476dfc24b311a837f931e678c4bdfbb99d29f4e4.tar.gz rust-476dfc24b311a837f931e678c4bdfbb99d29f4e4.zip | |
std: Use correct lifetime parameter on str::raw::slice_bytes
fn slice_bytes is marked unsafe since it allows violating the valid string encoding property; but the function did also allow extending the lifetime of the slice by mistake, since it's returning `&str`. Use the annotation `slice_bytes<'a>(&'a str, ...) -> &'a str` so that all uses of slice_bytes are region checked correctly.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/str.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 5c6895fea43..f1a44c4b386 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -885,7 +885,7 @@ pub mod raw { /// If begin is greater than end. /// If end is greater than the length of the string. #[inline] - pub unsafe fn slice_bytes(s: &str, begin: uint, end: uint) -> &str { + pub unsafe fn slice_bytes<'a>(s: &'a str, begin: uint, end: uint) -> &'a str { do s.as_imm_buf |sbuf, n| { assert!((begin <= end)); assert!((end <= n)); |
