Commit Graph

23118 Commits

Author SHA1 Message Date
Kevin Ballard
c01a97b7a9 path2: Remove .with_display_str and friends
Rewrite these methods as methods on Display and FilenameDisplay. This
turns

  do path.with_display_str |s| { ... }

into

  do path.display().with_str |s| { ... }
2013-10-15 22:19:53 -07:00
Kevin Ballard
d6d9b92683 path2: Adjust the API to remove all the _str mutation methods
Add a new trait BytesContainer that is implemented for both byte vectors
and strings.

Convert Path::from_vec and ::from_str to one function, Path::new().

Remove all the _str-suffixed mutation methods (push, join, with_*,
set_*) and modify the non-suffixed versions to use BytesContainer.
2013-10-15 22:18:30 -07:00
Kevin Ballard
ed539e1471 path2: Remove Path::normalize()
There are no clients of this API, so just remove it.

Update the module docstring to mention normalization.
2013-10-15 21:56:54 -07:00
Kevin Ballard
eaec8a7132 path2: Write a few paragraphs of module documentation 2013-10-15 21:56:54 -07:00
Kevin Ballard
e65d33e9ed path2: Update for loop -> continue 2013-10-15 21:56:54 -07:00
Kevin Ballard
b8af653984 path2: Update asserts for new format!() style 2013-10-15 21:56:54 -07:00
Kevin Ballard
73d3d00ec4 path2: Replace the path module outright
Remove the old path.
Rename path2 to path.
Update all clients for the new path.

Also make some miscellaneous changes to the Path APIs to help the
adoption process.
2013-10-15 21:56:54 -07:00
Kevin Ballard
6741241f40 path2: Add format helpers .display() and .filename_display()
These methods return an object that can be formatted using {} to print
display strings.

Path itself does not implement fmt::Default to avoid accidental usage of
display strings in incorrect places (e.g. process arguments).
2013-10-15 20:10:11 -07:00
Kevin Ballard
3a2735cb11 path2: Convert typedefs to pub uses
Turns out you can't call static methods on typedefs. Use `pub use`
instead to work around this issue.
2013-10-15 20:10:11 -07:00
Kevin Ballard
179f50f7c8 path2: Rename pop_opt() to pop() and add each_parent() 2013-10-15 20:10:11 -07:00
Kevin Ballard
56b96a3bfc path2: Implement stat support 2013-10-15 20:10:11 -07:00
Kevin Ballard
7fcdcaeda7 path2: Implement IterBytes for Path 2013-10-15 20:10:11 -07:00
Kevin Ballard
33adf6dd6e path2: Implement .as_display_str() and .to_display_str()
These functions are for working with a string representation of the path
even if it's not UTF-8 encoded. They replace invalid UTF-8 sequences
with the replacement char.
2013-10-15 20:10:11 -07:00
Kevin Ballard
1dfe5088d8 path2: Add opt variants for from_vec/from_str 2013-10-15 20:10:11 -07:00
Kevin Ballard
c16d7a4394 path2: Rename Path::new() to Path::from_vec() 2013-10-15 20:10:11 -07:00
Kevin Ballard
f25835c221 path2: Implement WindowsPath 2013-10-15 20:10:11 -07:00
Kevin Ballard
3d80a2f1f1 path2: Update for changes from master 2013-10-15 20:10:11 -07:00
Kevin Ballard
6f5b809775 path2: Add more tests to posix impl 2013-10-15 20:10:11 -07:00
Kevin Ballard
6d29142219 path2: Extract posix/windows into their own files
Move PosixPath into posix::Path.
2013-10-15 20:10:11 -07:00
Kevin Ballard
17ca6f0dfa path2: Add tests for the [u8]-based methods 2013-10-15 20:10:10 -07:00
Kevin Ballard
f0fc0650c5 path2: Update all the tests for the new [u8]-based approach 2013-10-15 20:10:10 -07:00
Kevin Ballard
550bc9bd1c path2: Reimplement PosixPath in terms of ~[u8] 2013-10-15 20:10:10 -07:00
Kevin Ballard
b413913066 path2: Start reimplementing in terms of ~[u8] instead of ~str
As documented in #7225, we cannot rely on paths being representable in
utf-8. Specifically, Linux allows anything (besides NUL) in a path.
Redesign GenericPath in light of this.

PosixPath hasn't been reimplemented yet for ~[u8].
2013-10-15 20:10:10 -07:00
Kevin Ballard
e97d61672b path2: Implement PosixPath
Fixes #5389 (new conventions for Path constructor)
2013-10-15 20:10:10 -07:00
Kevin Ballard
d202834092 Initial sketching out of the new path module
Define the basic types, and the GenericPath trait.

This module is currently called path2. It will be renamed later.
2013-10-15 20:10:10 -07:00
bors
1252ad4092 auto merge of #9860 : thestinger/rust/abort, r=Aatch
This should be preferred to calling the libc `abort` function.
2013-10-14 19:51:34 -07:00
Daniel Micay
45e2cf39a2 add an abort intrinsic
This should be preferred to the libc `abort` function.
2013-10-14 22:45:43 -04:00
bors
a7e8957c59 auto merge of #9823 : pnkfelix/rust/issue7655-bench-papercuts, r=alexcrichton
r? anyone.

You can see a bit more discussion on #7655.

This does not close any ticket; I am just scratching an itch.  Note in particular that I picked the value `{:>9} ns/iter` pretty much out of a hat.  :)
2013-10-14 15:06:36 -07:00
Felix S. Klock II
602b3cd56c Only use padded test names to calculate the target padding size. 2013-10-14 17:19:15 -04:00
Felix S. Klock II
c56bf67150 Issue 7655: align the bench printouts so that the numbers tend to be aligned.
(scratching an itch.)

Rebased and updated.
Fixed bug: omitted field init from embedded struct literal in a test.
Fixed bug: int underflow during padding length calculation.
2013-10-14 17:18:34 -04:00
bors
c8e77d5586 auto merge of #9606 : steveklabnik/rust/abi_removal, r=alexcrichton
They've been replaced by putting the name on the extern block.

  #[abi = "foo"]

goes to

  extern "foo" { }

Closes #9483.
2013-10-14 07:26:47 -07:00
bors
b571039021 auto merge of #9848 : huonw/rust/move-trait-doc, r=alexcrichton
This means the text is visible in rustdoc.
2013-10-14 06:16:32 -07:00
Steve Klabnik
309ab958e6 Removing ccdecl
as per https://github.com/mozilla/rust/pull/9606#discussion_r6930872
2013-10-14 14:33:05 +02:00
Huon Wilson
a6d7fe6209 std::vec: move documentation from impls to traits.
This means the text is visible in rustdoc.
2013-10-14 22:21:47 +11:00
Steve Klabnik
16fc6a694c Remove unused abi attributes.
They've been replaced by putting the name on the extern block.

  #[abi = "foo"]

goes to

  extern "foo" { }

Closes #9483.
2013-10-14 13:10:36 +02:00
bors
5b10781c7b auto merge of #9844 : bytbox/rust/master, r=alexcrichton 2013-10-13 23:41:30 -07:00
bors
6aa556db3b auto merge of #9843 : sfackler/rust/rustdoc-strip-private, r=alexcrichton
In addition, the renderer will add comments to structs and enums saying
that fields or variants have been stripped.

The comments are currently
```rust
// some fields stripped
// some variants stripped
```

I was thinking of changing that to "some private..." but passes other than
strip-private may strip fields or variants as well.

cc @alexcrichton
2013-10-13 22:31:29 -07:00
Steven Fackler
d6d31d788d Make Rustdoc strip private fields
In addition, the renderer will add comments to structs and enums saying
that fields or variants have been stripped.
2013-10-13 22:28:45 -07:00
Scott Lawrence
85f19a845d std::libc: rustdoc indicates reexports now 2013-10-14 00:48:34 -04:00
bors
009c3d8bae auto merge of #9836 : eriklyon/rust/doc-typos, r=alexcrichton 2013-10-13 11:31:26 -07:00
Erik Lyon
8b65a45879 fix typos in doc/tutorial.md 2013-10-13 10:49:44 -07:00
bors
91abfd425d auto merge of #9832 : luqmana/rust/sps, r=alexcrichton
Fixes #9830.
2013-10-12 21:26:20 -07:00
Luqman Aden
e88064d18f librustc: Combine C_struct and C_packed_struct. 2013-10-12 23:19:22 -04:00
bors
0bad7e1a37 auto merge of #9608 : hmarr/rust/vec-get-opt, r=huonw
This adds `get_opt` to `std::vec`, which looks up an item by index and returns an `Option`. If the given index is out of range, `None` will be returned, otherwise a `Some`-wrapped item will be returned.

Example use case:

```rust
use std::os;

fn say_hello(name: &str) {
  println(fmt!("Hello, %s", name));
}

fn main(){
  // Try to get the first cmd line arg, but default to "World"
  let args = os::args();
  let default = ~"World";
  say_hello(*args.get_opt(1).unwrap_or(&default));
}
```

If there's an existing way of implementing this pattern that's cleaner, I'll happily close this. I'm also open to naming suggestions (`index_opt`?)
2013-10-12 20:16:19 -07:00
Luqman Aden
95609699e3 Update test for packed structs to also test being placed in statics. 2013-10-12 21:52:14 -04:00
Luqman Aden
4b4b2136e0 librustc: Don't ICE on packed structs in statics. 2013-10-12 21:42:24 -04:00
bors
c6e3501da1 auto merge of #9825 : thestinger/rust/rc, r=thestinger 2013-10-12 07:26:20 -07:00
Daniel Micay
ea0fc0e32b rc: fix docstring 2013-10-12 10:19:56 -04:00
bors
35a944a488 auto merge of #9815 : thestinger/rust/type, r=huonw
Example:

    void ({ i64, %tydesc*, i8*, i8*, i8 }*, i64*, %"struct.std::fmt::Formatter[#1]"*)*

Before, we would print 20 levels deep due to recursion in the type
definition.
2013-10-11 19:21:16 -07:00
bors
399a42575a auto merge of #9799 : catamorphism/rust/rustpkg-exitcodes, r=catamorphism,metajack
r? @metajack When I started writing the rustpkg tests, task failure didn't set the
exit code properly. But bblum's work from July fixed that. Hooray! I
just didn't know about it till now.

So, now rustpkg uses exit codes in a more conventional way, and some of
the tests are simpler.

The bigger issue will be to make task failure propagate the error message.
Right now, rustpkg does most of the work in separate tasks, which means if
a task fails, rustpkg can't distinguish between different types of failure
(see #3408)
2013-10-11 18:11:17 -07:00