Skip to content

[WIP] str is dead, long live str([u8])! #19612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
681bbd3
librustc: add "str" lang item
Dec 4, 2014
f63b8e4
librustc: use "str" lang item in `mk_str`/`mk_str_slice`
Dec 5, 2014
5c73c5d
librustc[_trans]: fix fallout of changing `mk_str_slice` signature
Dec 5, 2014
c977921
librustc: add `is_str` utility function
Dec 5, 2014
c00d178
librustc: kill `ty_str`
Dec 5, 2014
b00cc6b
librustc_trans: kill `ty_str`
Dec 5, 2014
b4b2551
libsyntax: kill `TyStr`
Dec 5, 2014
10b2f55
librustc: kill `TyStr`
Dec 5, 2014
a55ae0e
libsyntax: use the full path of `str` in `format_args!`
Dec 5, 2014
2727aa1
libcore: use full path of `str` in `panic!` macro
Dec 5, 2014
52cae4c
libcore: make `str` a library type
Dec 5, 2014
6e5f5d9
libunicode: fix fallout
Dec 5, 2014
8608ac7
librand: fix fallout
Dec 5, 2014
8ad9238
libcollections: fix fallout
Dec 5, 2014
be8c54c
librustrt: fix fallout
Dec 5, 2014
31a3b28
libstd: use full path of `str` in `panic!` macro
Dec 5, 2014
e373977
libstd: fix fallout
Dec 5, 2014
005cdb7
libfmt_macros: fix fallout
Dec 5, 2014
54c55cf
libserialize: fix fallout
Dec 5, 2014
7f6b844
librbml: fix fallout
Dec 5, 2014
adab4be
libsyntax: fix fallout
Dec 5, 2014
bd7ccae
librustc_back: fix fallout
Dec 6, 2014
1174f1c
librustc: fix fallout
Dec 6, 2014
d3d5374
librustc_trans: fix fallout
Dec 6, 2014
99fb6c1
librustdoc: kill `ty_str` and `TyStr`
Dec 6, 2014
d11d28d
librustdoc: fix fallout
Dec 6, 2014
ca8649f
compiletest: fix fallout
Dec 6, 2014
c73df95
Fix run-pass tests
Dec 6, 2014
fd0a965
FIXME I broke run-pass/unsized3
Dec 6, 2014
c373b72
Fix compile-fail tests
Dec 6, 2014
ce37ad9
libstd: fix unit tests
Dec 6, 2014
47fb373
libcollections: fix unit tests
Dec 6, 2014
d49859f
libgraphviz: fix unit tests
Dec 6, 2014
702031c
libsyntax: fix unit tests
Dec 6, 2014
de8d4a4
libserialize: fix doc tests
Dec 6, 2014
f53120d
Fix bench
Dec 6, 2014
7620208
Fix guides
Dec 6, 2014
80ca6e5
Fix pretty test
Dec 6, 2014
cebddbb
libstd: fix fallout
Dec 6, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix run-pass tests
  • Loading branch information
Jorge Aparicio committed Dec 6, 2014
commit c73df951233b349e9dce04280a0d76da528cd160
3 changes: 3 additions & 0 deletions src/test/auxiliary/lang-item-public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#[lang="sized"]
pub trait Sized for Sized? {}

#[lang="str"]
struct str([u8]);

#[lang="panic"]
fn panic(_: &(&'static str, &'static str, uint)) -> ! { loop {} }

Expand Down
2 changes: 1 addition & 1 deletion src/test/auxiliary/weak-lang-items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ pub fn foo() {
}

mod std {
pub use core::{option, fmt};
pub use core::{option, fmt, str};
}

10 changes: 5 additions & 5 deletions src/test/run-pass/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use std::os;
use std::io::process::Command;
use std::finally::Finally;
use std::str;
use std::str as str_;

#[inline(never)]
fn foo() {
Expand All @@ -40,23 +40,23 @@ fn runtest(me: &str) {
let p = template.clone().arg("fail").env("RUST_BACKTRACE", "1").spawn().unwrap();
let out = p.wait_with_output().unwrap();
assert!(!out.status.success());
let s = str::from_utf8(out.error.as_slice()).unwrap();
let s = str_::from_utf8(out.error.as_slice()).unwrap();
assert!(s.contains("stack backtrace") && s.contains("foo::h"),
"bad output: {}", s);

// Make sure the stack trace is *not* printed
let p = template.clone().arg("fail").spawn().unwrap();
let out = p.wait_with_output().unwrap();
assert!(!out.status.success());
let s = str::from_utf8(out.error.as_slice()).unwrap();
let s = str_::from_utf8(out.error.as_slice()).unwrap();
assert!(!s.contains("stack backtrace") && !s.contains("foo::h"),
"bad output2: {}", s);

// Make sure a stack trace is printed
let p = template.clone().arg("double-fail").spawn().unwrap();
let out = p.wait_with_output().unwrap();
assert!(!out.status.success());
let s = str::from_utf8(out.error.as_slice()).unwrap();
let s = str_::from_utf8(out.error.as_slice()).unwrap();
// loosened the following from double::h to double:: due to
// spurious failures on mac, 32bit, optimized
assert!(s.contains("stack backtrace") && s.contains("double::"),
Expand All @@ -67,7 +67,7 @@ fn runtest(me: &str) {
.env("RUST_BACKTRACE", "1").spawn().unwrap();
let out = p.wait_with_output().unwrap();
assert!(!out.status.success());
let s = str::from_utf8(out.error.as_slice()).unwrap();
let s = str_::from_utf8(out.error.as_slice()).unwrap();
let mut i = 0;
for _ in range(0i, 2) {
i += s.slice_from(i + 10).find_str("stack backtrace").unwrap() + 10;
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/core-run-destroy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ extern crate libc;

use std::io::{Process, Command, timer};
use std::time::Duration;
use std::str;

macro_rules! succeed( ($e:expr) => (
match $e { Ok(..) => {}, Err(e) => panic!("panic: {}", e) }
Expand Down Expand Up @@ -58,7 +57,6 @@ pub fn test_destroy_actually_kills(force: bool) {
use std::io::process::{Command, ProcessOutput, ExitStatus, ExitSignal};
use std::io::timer;
use libc;
use std::str;

#[cfg(all(unix,not(target_os="android")))]
static BLOCK_COMMAND: &'static str = "cat";
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/foreign-fn-linkname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ mod mlibc {
}
}

fn strlen(str: String) -> uint {
fn strlen(s: String) -> uint {
// C string is terminated with a zero
str.as_slice().with_c_str(|buf| {
s.as_slice().with_c_str(|buf| {
unsafe {
mlibc::my_strlen(buf) as uint
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/issue-18353.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ struct Str {
}

fn main() {
let str: Option<&Str> = None;
str.is_some();
let s: Option<&Str> = None;
s.is_some();
}
4 changes: 2 additions & 2 deletions src/test/run-pass/move-out-of-field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ pub fn main() {
};
sb.append("Hello, ");
sb.append("World!");
let str = to_string(sb);
assert_eq!(str.as_slice(), "Hello, World!");
let s = to_string(sb);
assert_eq!(s.as_slice(), "Hello, World!");
}