about summary refs log tree commit diff
path: root/src/libgetopts
AgeCommit message (Collapse)AuthorLines
2014-11-21unicode: Add stability attributes to u_charBrian Anderson-1/+1
Free functions deprecated. UnicodeChar experimental pending final decisions about prelude.
2014-11-20Rename remaining Failures to PanicSubhash Bhushan-3/+3
2014-11-17Switch to purely namespaced enumsSteven Fackler-14/+24
This breaks code that referred to variant names in the same namespace as their enum. Reexport the variants in the old location or alter code to refer to the new locations: ``` pub enum Foo { A, B } fn main() { let a = A; } ``` => ``` pub use self::Foo::{A, B}; pub enum Foo { A, B } fn main() { let a = A; } ``` or ``` pub enum Foo { A, B } fn main() { let a = Foo::A; } ``` [breaking-change]
2014-11-17Fix fallout from coercion removalNick Cameron-35/+35
2014-11-12Fix remaining documentation to reflect fail!() -> panic!()Barosl Lee-1/+1
Throughout the docs, "failure" was replaced with "panics" if it means a task panic. Otherwise, it remained as is, or changed to "errors" to clearly differentiate it from a task panic.
2014-11-05Fix fallout of changing the expansion of `#[deriving(PartialEq)]`Jorge Aparicio-1/+0
2014-11-02Extend documentation of getopts for argumentsRobin Stocker-6/+38
2014-10-30rollup merge of #18445 : alexcrichton/index-mutAlex Crichton-6/+6
Conflicts: src/libcollections/vec.rs
2014-10-30rollup merge of #18398 : aturon/lint-conventions-2Alex Crichton-2/+2
Conflicts: src/libcollections/slice.rs src/libcore/failure.rs src/libsyntax/parse/token.rs src/test/debuginfo/basic-types-mut-globals.rs src/test/debuginfo/simple-struct.rs src/test/debuginfo/trait-pointers.rs
2014-10-30collections: Enable IndexMut for some collectionsAlex Crichton-6/+6
This commit enables implementations of IndexMut for a number of collections, including Vec, RingBuf, SmallIntMap, TrieMap, TreeMap, and HashMap. At the same time this deprecates the `get_mut` methods on vectors in favor of using the indexing notation. cc #18424
2014-10-29Rename fail! to panic!Steve Klabnik-45/+47
https://github.com/rust-lang/rfcs/pull/221 The current terminology of "task failure" often causes problems when writing or speaking about code. You often want to talk about the possibility of an operation that returns a Result "failing", but cannot because of the ambiguity with task failure. Instead, you have to speak of "the failing case" or "when the operation does not succeed" or other circumlocutions. Likewise, we use a "Failure" header in rustdoc to describe when operations may fail the task, but it would often be helpful to separate out a section describing the "Err-producing" case. We have been steadily moving away from task failure and toward Result as an error-handling mechanism, so we should optimize our terminology accordingly: Result-producing functions should be easy to describe. To update your code, rename any call to `fail!` to `panic!` instead. Assuming you have not created your own macro named `panic!`, this will work on UNIX based systems: grep -lZR 'fail!' . | xargs -0 -l sed -i -e 's/fail!/panic!/g' You can of course also do this by hand. [breaking-change]
2014-10-28Update code with new lint namesAaron Turon-2/+2
2014-10-24Add a lint for not using field pattern shorthandsP1start-9/+9
Closes #17792.
2014-10-23Add run-pass-valgrind testsNick Cameron-1/+1
Closes #16914
2014-10-16Remove libdebug and update tests.Luqman Aden-1/+0
2014-10-09Use the same html_root_url for all docsBrian Anderson-1/+1
2014-10-09Revert "Update html_root_url for 0.12.0 release"Brian Anderson-1/+1
This reverts commit 2288f332301b9e22db2890df256322650a7f3445.
2014-10-07Update html_root_url for 0.12.0 releaseBrian Anderson-1/+1
2014-09-24auto merge of #17438 : alexcrichton/rust/string-stable, r=aturonbors-13/+13
# Rationale When dealing with strings, many functions deal with either a `char` (unicode codepoint) or a byte (utf-8 encoding related). There is often an inconsistent way in which methods are referred to as to whether they contain "byte", "char", or nothing in their name. There are also issues open to rename *all* methods to reflect that they operate on utf8 encodings or bytes (e.g. utf8_len() or byte_len()). The current state of String seems to largely be what is desired, so this PR proposes the following rationale for methods dealing with bytes or characters: > When constructing a string, the input encoding *must* be mentioned (e.g. > from_utf8). This makes it clear what exactly the input type is expected to be > in terms of encoding. > > When a method operates on anything related to an *index* within the string > such as length, capacity, position, etc, the method *implicitly* operates on > bytes. It is an understood fact that String is a utf-8 encoded string, and > burdening all methods with "bytes" would be redundant. > > When a method operates on the *contents* of a string, such as push() or pop(), > then "char" is the default type. A String can loosely be thought of as being a > collection of unicode codepoints, but not all collection-related operations > make sense because some can be woefully inefficient. # Method stabilization The following methods have been marked #[stable] * The String type itself * String::new * String::with_capacity * String::from_utf16_lossy * String::into_bytes * String::as_bytes * String::len * String::clear * String::as_slice The following methods have been marked #[unstable] * String::from_utf8 - The error type in the returned `Result` may change to provide a nicer message when it's `unwrap()`'d * String::from_utf8_lossy - The returned `MaybeOwned` type still needs stabilization * String::from_utf16 - The return type may change to become a `Result` which includes more contextual information like where the error occurred. * String::from_chars - This is equivalent to iter().collect(), but currently not as ergonomic. * String::from_char - This method is the equivalent of Vec::from_elem, and has been marked #[unstable] becuase it can be seen as a duplicate of iterator-based functionality as well as possibly being renamed. * String::push_str - This *can* be emulated with .extend(foo.chars()), but is less efficient because of decoding/encoding. Due to the desire to minimize API surface this may be able to be removed in the future for something possibly generic with no loss in performance. * String::grow - This is a duplicate of iterator-based functionality, which may become more ergonomic in the future. * String::capacity - This function was just added. * String::push - This function was just added. * String::pop - This function was just added. * String::truncate - The failure conventions around String methods and byte indices isn't totally clear at this time, so the failure semantics and return value of this method are subject to change. * String::as_mut_vec - the naming of this method may change. * string::raw::* - these functions are all waiting on [an RFC][2] [2]: rust-lang/rfcs#240 The following method have been marked #[experimental] * String::from_str - This function only exists as it's more efficient than to_string(), but having a less ergonomic function for performance reasons isn't the greatest reason to keep it around. Like Vec::push_all, this has been marked experimental for now. The following methods have been #[deprecated] * String::append - This method has been deprecated to remain consistent with the deprecation of Vec::append. While convenient, it is one of the only functional-style apis on String, and requires more though as to whether it belongs as a first-class method or now (and how it relates to other collections). * String::from_byte - This is fairly rare functionality and can be emulated with str::from_utf8 plus an assert plus a call to to_string(). Additionally, String::from_char could possibly be used. * String::byte_capacity - Renamed to String::capacity due to the rationale above. * String::push_char - Renamed to String::push due to the rationale above. * String::pop_char - Renamed to String::pop due to the rationale above. * String::push_bytes - There are a number of `unsafe` functions on the `String` type which allow bypassing utf-8 checks. These have all been deprecated in favor of calling `.as_mut_vec()` and then operating directly on the vector returned. These methods were deprecated because naming them with relation to other methods was difficult to rationalize and it's arguably more composable to call .as_mut_vec(). * String::as_mut_bytes - See push_bytes * String::push_byte - See push_bytes * String::pop_byte - See push_bytes * String::shift_byte - See push_bytes # Reservation methods This commit does not yet touch the methods for reserving bytes. The methods on Vec have also not yet been modified. These methods are discussed in the upcoming [Collections reform RFC][1] [1]: https://github.com/aturon/rfcs/blob/collections-conventions/active/0000-collections-conventions.md#implicit-growth
2014-09-23Deal with the fallout of string stabilizationAlex Crichton-13/+13
2014-09-22Update calls of deprecated functions in macros.Victor Berger-10/+10
Fallout of #17185.
2014-09-17doc: Cleanup.Jonas Hietala-2/+2
Remove ~~~ for code block specification. Use /// Over /** */ for doc blocks.
2014-08-29Register new snapshotsAlex Crichton-3/+0
2014-08-22auto merge of #16512 : wickerwaka/rust/getopt-16348, r=brsonbors-22/+33
I don't know if anything else was relying on the old behavior, this seems more correct. Fixes #16348 If '-F' is allowed to have an optional argument, with the previous version '-FF' would be translated to '-F -F'. In this new version '-FF' translates to '-F' with argument 'F'
2014-08-16librustc: Forbid external crates, imports, and/or items from beingPatrick Walton-0/+4
declared with the same name in the same scope. This breaks several common patterns. First are unused imports: use foo::bar; use baz::bar; Change this code to the following: use baz::bar; Second, this patch breaks globs that import names that are shadowed by subsequent imports. For example: use foo::*; // including `bar` use baz::bar; Change this code to remove the glob: use foo::{boo, quux}; use baz::bar; Or qualify all uses of `bar`: use foo::{boo, quux}; use baz; ... baz::bar ... Finally, this patch breaks code that, at top level, explicitly imports `std` and doesn't disable the prelude. extern crate std; Because the prelude imports `std` implicitly, there is no need to explicitly import it; just remove such directives. The old behavior can be opted into via the `import_shadowing` feature gate. Use of this feature gate is discouraged. This implements RFC #116. Closes #16464. [breaking-change]
2014-08-15Change how libgetopts handles options grouped togetherwickerwaka-22/+33
As soon as an option is found that takes an argument, consume the rest of the string and store it into i_arg. Previously this would only happen if the character after the option was not a recognized option. Addresses issue #16348
2014-08-06auto merge of #16291 : nham/rust/byte_literals, r=alexcrichtonbors-2/+2
This replaces many instances chars being casted to u8 with byte literals.
2014-08-06Use byte literals in libgetoptsnham-2/+2
2014-08-04libgetopts: tweak HasHarg/Occur docs.Conrad Kleinespel-4/+4
2014-07-28Fix typo in getopts::getopts documentation, return Matches instead of Optjoaoxsouls-1/+1
2014-07-22auto merge of #15867 : cmr/rust/rewrite-lexer4, r=alexcrichtonbors-0/+2
2014-07-21ignore-lexer-test to broken files and remove some tray hyphensCorey Richardson-0/+2
I blame @ChrisMorgan for the hyphens.
2014-07-17deprecate Vec::getNick Cameron-17/+17
2014-07-11Update doc URLs for version bumpBrian Anderson-1/+1
2014-07-10auto merge of #15556 : alexcrichton/rust/snapshots, r=brsonbors-2/+0
Closes #15544
2014-07-09libgetopts: Use iterators instead of old-style loops.Luqman Aden-1/+1
2014-07-09Register new snapshotsAlex Crichton-2/+0
Closes #15544
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-9/+9
[breaking-change]
2014-07-05Add #[crate_name] attributes as necessaryAlex Crichton-1/+3
2014-07-02Merge remote-tracking branch 'origin/master' into 0.11.0-releaseAlex Crichton-2/+2
Conflicts: src/libstd/lib.rs
2014-07-01rustc: Remove `&str` indexing from the language.Brian Anderson-2/+2
Being able to index into the bytes of a string encourages poor UTF-8 hygiene. To get a view of `&[u8]` from either a `String` or `&str` slice, use the `as_bytes()` method. Closes #12710. [breaking-change]
2014-06-27Update to 0.11.0 0.11.0Alex Crichton-2/+2
2014-06-26Remove unnecessary to_string callsPiotr Jawniak-3/+1
This commit removes superfluous to_string calls from various places
2014-06-17Mark all crates except std as experimentalBrian Anderson-0/+1
2014-06-14Register new snapshotsAlex Crichton-2/+1
2014-06-14getopts: derive Eq for types.Huon Wilson-12/+12
2014-06-14getopts: format failure messages with `Show`.Huon Wilson-13/+21
This obsoletes the old `to_err_msg` method. Replace println!("Error: {}", failure.to_err_msg()) let string = failure.to_err_msg(); with println!("Error: {}", failure) let string = failure.to_str(); [breaking-change]
2014-06-11rustc: Remove ~[T] from the languageAlex Crichton-1/+0
The following features have been removed * box [a, b, c] * ~[a, b, c] * box [a, ..N] * ~[a, ..N] * ~[T] (as a type) * deprecated_owned_vector lint All users of ~[T] should move to using Vec<T> instead.
2014-06-10Fix more misspelled comments and strings.Joseph Crail-1/+1
2014-06-09Use phase(plugin) in bootstrap cratesKeegan McAllister-1/+2
Do this to avoid warnings on post-stage0 builds.