0
0
mirror of https://github.com/rust-lang/rust.git synced 2024-11-22 10:25:09 +01:00
Commit Graph

23146 Commits

Author SHA1 Message Date
Daniel Micay
f766acad62 drop the linenoise library
Closes #5038
2013-10-16 22:57:51 -04:00
Daniel Micay
7c92435f8f remove the rusti command
Closes #9818
Closes #9567
Closes #8924
Closes #8910
Closes #8392
Closes #7692
Closes #7499
Closes #7220
2013-10-16 22:54:38 -04:00
bors
c92f2168d4 auto merge of #9833 : alexcrichton/rust/fixes, r=brson
Commits have all the fun details
2013-10-16 18:11:22 -07:00
bors
63e097d8c3 auto merge of #9634 : blake2-ppc/rust/by-ref-iter, r=thestinger
std::iter: Introduce .by_ref() adaptor

Creates a wrapper around a mutable reference to the iterator.

This is useful to allow applying iterator adaptors while still
retaining ownership of the original iterator value.

Example::

    let mut xs = range(0, 10);
    // sum the first five values
    let partial_sum = xs.by_ref().take(5).fold(0, |a, b| a + b);
    assert!(partial_sum == 10);
    // xs.next() is now `5`
    assert!(xs.next() == Some(5));

---

This adaptor requires the user to have good understanding of
iterators or what a particular adaptor does. There could be some
pitfalls here with the iterator protocol, it's mostly the same issues
as other places regarding what happens after the iterator
returns None for the first time.

There could also be other ways to achieve the same thing, for
example Implementing iterator on `&mut T` itself:
`impl <T: Iterator<..>> Iterator for &mut T`  but that would only
lead to confusion I think.
2013-10-16 17:01:30 -07:00
bors
9d6c251881 auto merge of #9885 : thestinger/rust/vector, r=brson
The goal here is to avoid requiring a division or multiplication to compare against the length. The bounds check previously used an incorrect micro-optimization to replace the division by a multiplication, but now neither is necessary *for slices*. Unique/managed vectors will have to do a division to get the length until they are reworked/replaced.
2013-10-16 15:21:35 -07:00
bors
fa03c94546 auto merge of #9892 : Kimundi/rust/ResultToStr, r=alexcrichton 2013-10-16 14:11:58 -07:00
Marvin Löbel
abecd61a23 Added Result implementations for ToStr and fmt::Default 2013-10-16 20:36:38 +02:00
bors
40180cdbea auto merge of #9655 : kballard/rust/path-rewrite, r=alexcrichton
Rewrite the entire `std::path` module from scratch.

`PosixPath` is now based on `~[u8]`, which fixes #7225.
Unnecessary allocation has been eliminated.

There are a lot of clients of `Path` that still assume utf-8 paths.
This is covered in #9639.
2013-10-16 11:26:35 -07:00
Kevin Ballard
d108a22fd1 path2: Update for privacy changes
Remove redundant `contains_nul` definition.

Make `parse_prefix` private.
2013-10-16 11:18:06 -07:00
Kevin Ballard
6eade9e914 path2: Update for latest master
Also fix some issues that crept into earlier commits during the conflict
resoution for the rebase.
2013-10-16 11:18:06 -07:00
Kevin Ballard
40b324f0de path2: Remove Path.into_str() 2013-10-16 10:26:48 -07:00
Kevin Ballard
0c7e8f7a92 path2: Remove some API functions
Delete the following API functions:
- set_dirname()
- with_dirname()
- set_filestem()
- with_filestem()
- add_extension()
- file_path()

Also change pop() to return a boolean instead of an owned copy of the
old filename.
2013-10-16 10:26:48 -07:00
Kevin Ballard
bab7eb20df path2: Update based on more review feedback
Standardize the is_sep() functions to be the same in both posix and
windows, and re-export from path. Update extra::glob to use this.

Remove the usage of either, as it's going away.

Move the WindowsPath-specific methods out of WindowsPath and make them
top-level functions of path::windows instead. This way you cannot
accidentally write code that will fail to compile on non-windows
architectures without typing ::windows anywhere.

Remove GenericPath::from_c_str() and just impl BytesContainer for
CString instead.

Remove .join_path() and .push_path() and just implement BytesContainer
for Path instead.

Remove FilenameDisplay and add a boolean flag to Display instead.

Remove .each_parent(). It only had one caller, so just inline its
definition there.
2013-10-16 10:26:48 -07:00
Daniel Micay
bd7610f3e3 introduce base_and_len fns for element length 2013-10-16 12:28:25 -04:00
Daniel Micay
ef3ec1fe97 rename base_and_len -> base_and_byte_len 2013-10-16 12:00:31 -04:00
bors
fabec998e5 auto merge of #9857 : brson/rust/mainsched, r=alexcrichton
...al work

This is causing really awful scheduler behavior where the main thread scheduler is
continually waking up, stealing work, discovering it can't actually run the work,
and sending it off to another scheduler.

No test cases because we don't have suitable instrumentation for it.
2013-10-15 22:56:36 -07:00
Alex Crichton
fc06f7922d Build a few extra features into format! parsing
* Allow named parameters to specify width/precision
* Intepret the format string '0$' as "width is the 0th argument" instead of
  thinking the lone '0' was the sign-aware-zero-padding flag. To get both you'd
  need to put '00$' which makes more sense if you want both to happen.

Closes #9669
2013-10-15 22:27:10 -07:00
Alex Crichton
a84c2999c9 Require module documentation with missing_doc
Closes #9824
2013-10-15 22:27:10 -07:00
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
bors
3d75ec5693 auto merge of #9886 : sfackler/rust/flatpipe, r=cmr
Closes #9884
2013-10-15 21:46:35 -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
Steven Fackler
194302493c Remove extra::flatpipes
Closes #9884
2013-10-15 18:54:35 -07:00
Daniel Micay
1e128d7931 remove executable flag from source file 2013-10-15 19:34:45 -04:00
Daniel Micay
e1a26ad271 use element count in slices, not size in bytes
This allows the indexing bounds check or other comparisons against an
element length to avoid a multiplication by the size.
2013-10-15 16:23:28 -04:00
Daniel Micay
aa93381e14 fix overflow on bounds checks
Closes #9020
2013-10-15 16:23:28 -04:00
Daniel Micay
420b4260b4 fix bounds checking failure message
casting the `uint` to an `int` can result in printing high values as
negative intege
2013-10-15 16:23:26 -04: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