diff options
| author | Kevin Cantu <me@kevincantu.org> | 2012-02-23 00:45:25 -0800 |
|---|---|---|
| committer | Marijn Haverbeke <marijnh@gmail.com> | 2012-02-23 17:00:19 +0100 |
| commit | 1b957c0942007e60ec9ea6773c964ea7bdc199af (patch) | |
| tree | 4fc4660ec4d8e9fd02a61fcae1ab073f60e89772 /src/comp | |
| parent | cec053487c84e8b5406e24d6f9f72966cdcfd0da (diff) | |
(core::str) replace uses of unsafe::slice_bytes; replace find[_from]_bytes with find[_from]
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/back/link.rs | 6 | ||||
| -rw-r--r-- | src/comp/middle/trans/debuginfo.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/codemap.rs | 2 | ||||
| -rw-r--r-- | src/comp/syntax/parse/lexer.rs | 4 | ||||
| -rw-r--r-- | src/comp/util/ppaux.rs | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/src/comp/back/link.rs b/src/comp/back/link.rs index 5b7d7a35c53..572fde7bd3f 100644 --- a/src/comp/back/link.rs +++ b/src/comp/back/link.rs @@ -478,7 +478,7 @@ fn build_link_meta(sess: session, c: ast::crate, output: str, } fn truncated_sha1_result(sha: sha1) -> str unsafe { - ret str::unsafe::slice_bytes(sha.result_str(), 0u, 16u); + ret str::slice(sha.result_str(), 0u, 16u); } @@ -567,12 +567,12 @@ fn link_binary(sess: session, // Converts a library file name into a cc -l argument fn unlib(config: @session::config, filename: str) -> str unsafe { let rmlib = fn@(filename: str) -> str { - let found = str::find_bytes(filename, "lib"); + let found = str::find(filename, "lib"); if config.os == session::os_macos || (config.os == session::os_linux || config.os == session::os_freebsd) && option::is_some(found) && option::get(found) == 0u { - ret str::unsafe::slice_bytes(filename, 3u, + ret str::slice(filename, 3u, str::len_bytes(filename)); } else { ret filename; } }; diff --git a/src/comp/middle/trans/debuginfo.rs b/src/comp/middle/trans/debuginfo.rs index 39da8cf2c57..dff4f26ae99 100644 --- a/src/comp/middle/trans/debuginfo.rs +++ b/src/comp/middle/trans/debuginfo.rs @@ -167,7 +167,7 @@ fn create_compile_unit(cx: crate_ctxt, full_path: str) let work_dir = cx.sess.working_dir; let file_path = if str::starts_with(full_path, work_dir) { - str::unsafe::slice_bytes(full_path, str::len_bytes(work_dir), + str::slice(full_path, str::len_bytes(work_dir), str::len_bytes(full_path)) } else { full_path diff --git a/src/comp/syntax/codemap.rs b/src/comp/syntax/codemap.rs index abe5a242261..e9b4569df6c 100644 --- a/src/comp/syntax/codemap.rs +++ b/src/comp/syntax/codemap.rs @@ -162,7 +162,7 @@ fn get_line(fm: filemap, line: int) -> str unsafe { some(e) { e } none { str::len_bytes(*fm.src) } }; - str::unsafe::slice_bytes(*fm.src, begin, end) + str::slice(*fm.src, begin, end) } fn lookup_byte_offset(cm: codemap::codemap, chpos: uint) diff --git a/src/comp/syntax/parse/lexer.rs b/src/comp/syntax/parse/lexer.rs index 113ca056ed4..0328afc9f20 100644 --- a/src/comp/syntax/parse/lexer.rs +++ b/src/comp/syntax/parse/lexer.rs @@ -24,7 +24,7 @@ impl reader for reader { fn get_str_from(start: uint) -> str unsafe { // I'm pretty skeptical about this subtraction. What if there's a // multi-byte character before the mark? - ret str::unsafe::slice_bytes(*self.src, start - 1u, self.pos - 1u); + ret str::slice(*self.src, start - 1u, self.pos - 1u); } fn next() -> char { if self.pos < self.len { @@ -611,7 +611,7 @@ fn trim_whitespace_prefix_and_push_line(&lines: [str], let s1; if all_whitespace(s, 0u, col) { if col < str::len_bytes(s) { - s1 = str::unsafe::slice_bytes(s, col, str::len_bytes(s)); + s1 = str::slice(s, col, str::len_bytes(s)); } else { s1 = ""; } } else { s1 = s; } log(debug, "pushing line: " + s1); diff --git a/src/comp/util/ppaux.rs b/src/comp/util/ppaux.rs index 547c2d5ee82..18bd05f2b8d 100644 --- a/src/comp/util/ppaux.rs +++ b/src/comp/util/ppaux.rs @@ -131,7 +131,7 @@ fn ty_to_str(cx: ctxt, typ: t) -> str { fn ty_to_short_str(cx: ctxt, typ: t) -> str unsafe { let s = encoder::encoded_ty(cx, typ); - if str::len_bytes(s) >= 32u { s = str::unsafe::slice_bytes(s, 0u, 32u); } + if str::len_bytes(s) >= 32u { s = str::slice(s, 0u, 32u); } ret s; } |
