Skip to content

Commit 14d82a4

Browse files
committed
---
yaml --- r: 144722 b: refs/heads/try2 c: 4c37537 h: refs/heads/master v: v3
1 parent d0e97c4 commit 14d82a4

File tree

12 files changed

+49
-54
lines changed

12 files changed

+49
-54
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 8827b94e5b02d8f0c9d1d9858f3e387e55711dd4
8+
refs/heads/try2: 4c375373a65b90350216753006ce9f145525e350
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/compiletest/compiletest.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,9 +307,8 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
307307
// Try to elide redundant long paths
308308
fn shorten(path: &Path) -> ~str {
309309
let filename = path.filename();
310-
let p = path.pop();
311-
let dir = p.filename();
312-
fmt!("%s/%s", dir.unwrap_or_default(""), filename.unwrap_or_default(""))
310+
let dir = path.pop().filename();
311+
fmt!("%s/%s", dir.unwrap_or_default(~""), filename.unwrap_or_default(~""))
313312
}
314313

315314
test::DynTestName(fmt!("[%s] %s",

branches/try2/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ fn _arm_push_aux_shared_library(config: &config, testfile: &Path) {
880880
let dirs = os::list_dir_path(&Path(tstr));
881881
for file in dirs.iter() {
882882

883-
if (file.filetype() == Some(".so")) {
883+
if (file.filetype() == Some(~".so")) {
884884

885885
let copy_result = procsrv::run("", config.adb_path,
886886
[~"push", file.to_str(), config.adb_test_dir.clone()],

branches/try2/src/librust/rust.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ fn cmd_help(args: &[~str]) -> ValidUsage {
162162
fn cmd_test(args: &[~str]) -> ValidUsage {
163163
match args {
164164
[ref filename] => {
165-
let p = Path(*filename);
166-
let test_exec = p.filestem().unwrap() + "test~";
165+
let test_exec = Path(*filename).filestem().unwrap() + "test~";
167166
invoke("rustc", &[~"--test", filename.to_owned(),
168167
~"-o", test_exec.to_owned()], rustc::main_args);
169168
let exit_code = run::process_status(~"./" + test_exec, []);
@@ -176,8 +175,7 @@ fn cmd_test(args: &[~str]) -> ValidUsage {
176175
fn cmd_run(args: &[~str]) -> ValidUsage {
177176
match args {
178177
[ref filename, ..prog_args] => {
179-
let p = Path(*filename);
180-
let exec = p.filestem().unwrap() + "~";
178+
let exec = Path(*filename).filestem().unwrap() + "~";
181179
invoke("rustc", &[filename.to_owned(), ~"-o", exec.to_owned()],
182180
rustc::main_args);
183181
let exit_code = run::process_status(~"./"+exec, prog_args);

branches/try2/src/librustc/back/link.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -952,13 +952,13 @@ pub fn link_args(sess: Session,
952952
let cstore = sess.cstore;
953953
let r = cstore::get_used_crate_files(cstore);
954954
for cratepath in r.iter() {
955-
if cratepath.filetype() == Some(".rlib") {
955+
if cratepath.filetype() == Some(~".rlib") {
956956
args.push(cratepath.to_str());
957957
loop;
958958
}
959959
let dir = cratepath.dirname();
960960
if dir != ~"" { args.push(~"-L" + dir); }
961-
let libarg = unlib(sess.targ_cfg, cratepath.filestem().unwrap().to_owned());
961+
let libarg = unlib(sess.targ_cfg, cratepath.filestem().unwrap());
962962
args.push(~"-l" + libarg);
963963
}
964964

branches/try2/src/librustpkg/installed_packages.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ pub fn list_installed_packages(f: &fn(&PkgId) -> bool) -> bool {
1919
for p in workspaces.iter() {
2020
let binfiles = os::list_dir(&p.push("bin"));
2121
for exec in binfiles.iter() {
22-
let p = Path(*exec);
23-
let exec_path = p.filestem();
22+
let exec_path = Path(*exec).filestem();
2423
do exec_path.iter().advance |s| {
2524
f(&PkgId::new(*s))
2625
};
@@ -50,8 +49,8 @@ pub fn has_library(p: &Path) -> Option<~str> {
5049
let files = os::list_dir(p);
5150
for q in files.iter() {
5251
let as_path = Path(*q);
53-
if as_path.filetype() == Some(os::consts::DLL_SUFFIX) {
54-
let stuff : &str = as_path.filestem().expect("has_library: weird path");
52+
if as_path.filetype() == Some(os::consts::DLL_SUFFIX.to_owned()) {
53+
let stuff : ~str = as_path.filestem().expect("has_library: weird path");
5554
let mut stuff2 = stuff.split_str_iter(&"-");
5655
let stuff3: ~[&str] = stuff2.collect();
5756
// argh

branches/try2/src/librustpkg/package_id.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl PkgId {
6868
if path.components.len() < 1 {
6969
return cond.raise((path, ~"0-length pkgid"));
7070
}
71-
let short_name = path.filestem().expect(fmt!("Strange path! %s", s));
71+
let short_name = path.clone().filestem().expect(fmt!("Strange path! %s", s));
7272

7373
let version = match given_version {
7474
Some(v) => v,
@@ -83,8 +83,8 @@ impl PkgId {
8383

8484
debug!("path = %s", path.to_str());
8585
PkgId {
86-
path: path.clone(),
87-
short_name: short_name.to_owned(),
86+
path: path,
87+
short_name: short_name,
8888
version: version
8989
}
9090
}

branches/try2/src/librustpkg/package_source.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl PkgSrc {
119119
return Some(local);
120120
}
121121

122-
if self.id.path.components().len() < 2 {
122+
if (self.id.path.clone()).components().len() < 2 {
123123
// If a non-URL, don't bother trying to fetch
124124
return None;
125125
}
@@ -157,7 +157,7 @@ impl PkgSrc {
157157

158158
/// True if the given path's stem is self's pkg ID's stem
159159
fn stem_matches(&self, p: &Path) -> bool {
160-
p.filestem().map_default(false, |p| { p == &self.id.short_name.as_slice() })
160+
p.filestem().map_default(false, |p| { p == &self.id.short_name })
161161
}
162162

163163
fn push_crate(cs: &mut ~[Crate], prefix: uint, p: &Path) {
@@ -182,10 +182,10 @@ impl PkgSrc {
182182
do os::walk_dir(&dir) |pth| {
183183
let maybe_known_crate_set = match pth.filename() {
184184
Some(filename) => match filename {
185-
"lib.rs" => Some(&mut self.libs),
186-
"main.rs" => Some(&mut self.mains),
187-
"test.rs" => Some(&mut self.tests),
188-
"bench.rs" => Some(&mut self.benchs),
185+
~"lib.rs" => Some(&mut self.libs),
186+
~"main.rs" => Some(&mut self.mains),
187+
~"test.rs" => Some(&mut self.tests),
188+
~"bench.rs" => Some(&mut self.benchs),
189189
_ => None
190190
},
191191
_ => None

branches/try2/src/librustpkg/path_util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,14 @@ pub fn library_in_workspace(path: &Path, short_name: &str, where: Target,
234234
Some(j) => {
235235
debug!("Maybe %s equals %s", f_name.slice(0, j), lib_prefix);
236236
if f_name.slice(0, j) == lib_prefix {
237-
result_filename = Some(p_path.clone());
237+
result_filename = Some(p_path);
238238
}
239239
break;
240240
}
241241
None => break
242242
}
243243
}
244-
_ => { f_name = f_name.slice(0, i); }
244+
_ => { f_name = f_name.slice(0, i).to_owned(); }
245245
}
246246
}
247247
None => break

branches/try2/src/librustpkg/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ fn touch_source_file(workspace: &Path, pkgid: &PkgId) {
396396
let pkg_src_dir = workspace.push("src").push(pkgid.to_str());
397397
let contents = os::list_dir_path(&pkg_src_dir);
398398
for p in contents.iter() {
399-
if p.filetype() == Some(".rs") {
399+
if p.filetype() == Some(~".rs") {
400400
// should be able to do this w/o a process
401401
if run::process_output("touch", [p.to_str()]).status != 0 {
402402
let _ = cond.raise((pkg_src_dir.clone(), ~"Bad path"));
@@ -413,7 +413,7 @@ fn frob_source_file(workspace: &Path, pkgid: &PkgId) {
413413
let contents = os::list_dir_path(&pkg_src_dir);
414414
let mut maybe_p = None;
415415
for p in contents.iter() {
416-
if p.filetype() == Some(".rs") {
416+
if p.filetype() == Some(~".rs") {
417417
maybe_p = Some(p);
418418
break;
419419
}

branches/try2/src/libstd/path.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use option::{None, Option, Some};
2828
use str::{OwnedStr, Str, StrSlice, StrVector};
2929
use to_str::ToStr;
3030
use ascii::{AsciiCast, AsciiStr};
31-
use vec::{Vector, OwnedVector, ImmutableVector, OwnedCopyableVector};
31+
use vec::{OwnedVector, ImmutableVector, OwnedCopyableVector};
3232

3333
#[cfg(windows)]
3434
pub use Path = self::WindowsPath;
@@ -65,17 +65,17 @@ pub trait GenericPath {
6565
fn dirname(&self) -> ~str;
6666
/// Returns the file component of `self`, as a string option.
6767
/// Returns None if `self` names a directory.
68-
fn filename<'a>(&'a self) -> Option<&'a str>;
68+
fn filename(&self) -> Option<~str>;
6969
/// Returns the stem of the file component of `self`, as a string option.
7070
/// The stem is the slice of a filename starting at 0 and ending just before
7171
/// the last '.' in the name.
7272
/// Returns None if `self` names a directory.
73-
fn filestem<'a>(&'a self) -> Option<&'a str>;
73+
fn filestem(&self) -> Option<~str>;
7474
/// Returns the type of the file component of `self`, as a string option.
7575
/// The file type is the slice of a filename starting just after the last
7676
/// '.' in the name and ending at the last index in the filename.
7777
/// Returns None if `self` names a directory.
78-
fn filetype<'a>(&'a self) -> Option<&'a str>;
78+
fn filetype(&self) -> Option<~str>;
7979

8080
/// Returns a new path consisting of `self` with the parent directory component replaced
8181
/// with the given string.
@@ -163,7 +163,7 @@ pub trait GenericPath {
163163
result
164164
}
165165

166-
fn components<'a>(&'a self) -> &'a [~str];
166+
fn components(self) -> ~[~str];
167167
}
168168

169169
#[cfg(target_os = "linux")]
@@ -600,31 +600,31 @@ impl GenericPath for PosixPath {
600600
}
601601
}
602602

603-
fn filename<'a>(&'a self) -> Option<&'a str> {
603+
fn filename(&self) -> Option<~str> {
604604
match self.components.len() {
605605
0 => None,
606-
n => Some(self.components[n - 1].as_slice()),
606+
n => Some(self.components[n - 1].clone()),
607607
}
608608
}
609609

610-
fn filestem<'a>(&'a self) -> Option<&'a str> {
610+
fn filestem(&self) -> Option<~str> {
611611
match self.filename() {
612612
None => None,
613613
Some(ref f) => {
614614
match f.rfind('.') {
615-
Some(p) => Some(f.slice_to(p)),
616-
None => Some((*f)),
615+
Some(p) => Some(f.slice_to(p).to_owned()),
616+
None => Some((*f).clone()),
617617
}
618618
}
619619
}
620620
}
621621

622-
fn filetype<'a>(&'a self) -> Option<&'a str> {
622+
fn filetype(&self) -> Option<~str> {
623623
match self.filename() {
624624
None => None,
625625
Some(ref f) => {
626626
match f.rfind('.') {
627-
Some(p) if p < f.len() => Some(f.slice_from(p)),
627+
Some(p) if p < f.len() => Some(f.slice_from(p).to_owned()),
628628
_ => None,
629629
}
630630
}
@@ -670,7 +670,7 @@ impl GenericPath for PosixPath {
670670
fn file_path(&self) -> PosixPath {
671671
let cs = match self.filename() {
672672
None => ~[],
673-
Some(ref f) => ~[(*f).to_owned()]
673+
Some(ref f) => ~[(*f).clone()]
674674
};
675675
PosixPath {
676676
is_absolute: false,
@@ -756,7 +756,7 @@ impl GenericPath for PosixPath {
756756
self.is_ancestor_of(&other.pop()))
757757
}
758758

759-
fn components<'a>(&'a self) -> &'a [~str] { self.components.as_slice() }
759+
fn components(self) -> ~[~str] { self.components }
760760
}
761761

762762

@@ -842,31 +842,31 @@ impl GenericPath for WindowsPath {
842842
}
843843
}
844844

845-
fn filename<'a>(&'a self) -> Option<&'a str> {
845+
fn filename(&self) -> Option<~str> {
846846
match self.components.len() {
847847
0 => None,
848-
n => Some(self.components[n - 1].as_slice()),
848+
n => Some(self.components[n - 1].clone()),
849849
}
850850
}
851851

852-
fn filestem<'a>(&'a self) -> Option<&'a str> {
852+
fn filestem(&self) -> Option<~str> {
853853
match self.filename() {
854854
None => None,
855855
Some(ref f) => {
856856
match f.rfind('.') {
857-
Some(p) => Some(f.slice_to(p)),
858-
None => Some((*f)),
857+
Some(p) => Some(f.slice_to(p).to_owned()),
858+
None => Some((*f).clone()),
859859
}
860860
}
861861
}
862862
}
863863

864-
fn filetype<'a>(&'a self) -> Option<&'a str> {
864+
fn filetype(&self) -> Option<~str> {
865865
match self.filename() {
866866
None => None,
867867
Some(ref f) => {
868868
match f.rfind('.') {
869-
Some(p) if p < f.len() => Some(f.slice_from(p)),
869+
Some(p) if p < f.len() => Some(f.slice_from(p).to_owned()),
870870
_ => None,
871871
}
872872
}
@@ -916,7 +916,7 @@ impl GenericPath for WindowsPath {
916916
is_absolute: false,
917917
components: match self.filename() {
918918
None => ~[],
919-
Some(ref f) => ~[(*f).to_owned()],
919+
Some(ref f) => ~[(*f).clone()],
920920
}
921921
}
922922
}
@@ -1049,7 +1049,7 @@ impl GenericPath for WindowsPath {
10491049
self.is_ancestor_of(&other.pop()))
10501050
}
10511051

1052-
fn components<'a>(&'a self) -> &'a [~str] { self.components.as_slice() }
1052+
fn components(self) -> ~[~str] { self.components }
10531053
}
10541054

10551055
pub fn normalize(components: &[~str]) -> ~[~str] {
@@ -1143,10 +1143,10 @@ mod tests {
11431143
#[test]
11441144
fn test_filetype_foo_bar() {
11451145
let wp = PosixPath("foo.bar");
1146-
assert_eq!(wp.filetype(), Some(".bar"));
1146+
assert_eq!(wp.filetype(), Some(~".bar"));
11471147
11481148
let wp = WindowsPath("foo.bar");
1149-
assert_eq!(wp.filetype(), Some(".bar"));
1149+
assert_eq!(wp.filetype(), Some(~".bar"));
11501150
}
11511151
11521152
#[test]

branches/try2/src/test/run-pass/issue-1866.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// xfail-test FIXME #1866
1211
mod a {
1312
pub type rust_task = uint;
1413
pub mod rustrt {

0 commit comments

Comments
 (0)