about summary refs log tree commit diff
path: root/src/libstd
AgeCommit message (Collapse)AuthorLines
2014-03-16`strdup_uniq` doesn't have to be `pub`.Lindsey Kuper-2/+1
2014-03-16auto merge of #12931 : aochagavia/rust/option-take_unwrap, r=cmrbors-3/+3
Using pattern matching instead of is_some + unwrap
2014-03-16Refactored take_unwrap (libstd/option.rs)aochagavia-3/+3
Using pattern matching instead of is_some + unwrap
2014-03-16auto merge of #12929 : sfackler/rust/automatically-derived, r=cmrbors-20/+0
This will enable rustdoc to treat them specially. I also got rid of `std::cmp::cmp2`, which is isomorphic to the `TotalOrd` impl for 2-tuples and never used.
2014-03-15Test fixes and rebase conflictsAlex Crichton-10/+25
This commit switches over the backtrace infrastructure from piggy-backing off the RUST_LOG environment variable to using the RUST_BACKTRACE environment variable (logging is now disabled in libstd).
2014-03-15rustc: Remove compiler support for __log_level()Alex Crichton-84/+15
This commit removes all internal support for the previously used __log_level() expression. The logging subsystem was previously modified to not rely on this magical expression. This also removes the only other function to use the module_data map in trans, decl_gc_metadata. It appears that this is an ancient function from a GC only used long ago. This does not remove the crate map entirely, as libgreen still uses it to hook in to the event loop provided by libgreen.
2014-03-15log: Introduce liblog, the old std::loggingAlex Crichton-638/+23
This commit moves all logging out of the standard library into an external crate. This crate is the new crate which is responsible for all logging macros and logging implementation. A few reasons for this change are: * The crate map has always been a bit of a code smell among rust programs. It has difficulty being loaded on almost all platforms, and it's used almost exclusively for logging and only logging. Removing the crate map is one of the end goals of this movement. * The compiler has a fair bit of special support for logging. It has the __log_level() expression as well as generating a global word per module specifying the log level. This is unfairly favoring the built-in logging system, and is much better done purely in libraries instead of the compiler itself. * Initialization of logging is much easier to do if there is no reliance on a magical crate map being available to set module log levels. * If the logging library can be written outside of the standard library, there's no reason that it shouldn't be. It's likely that we're not going to build the highest quality logging library of all time, so third-party libraries should be able to provide just as high-quality logging systems as the default one provided in the rust distribution. With a migration such as this, the change does not come for free. There are some subtle changes in the behavior of liblog vs the previous logging macros: * The core change of this migration is that there is no longer a physical log-level per module. This concept is still emulated (it is quite useful), but there is now only a global log level, not a local one. This global log level is a reflection of the maximum of all log levels specified. The previously generated logging code looked like: if specified_level <= __module_log_level() { println!(...) } The newly generated code looks like: if specified_level <= ::log::LOG_LEVEL { if ::log::module_enabled(module_path!()) { println!(...) } } Notably, the first layer of checking is still intended to be "super fast" in that it's just a load of a global word and a compare. The second layer of checking is executed to determine if the current module does indeed have logging turned on. This means that if any module has a debug log level turned on, all modules with debug log levels get a little bit slower (they all do more expensive dynamic checks to determine if they're turned on or not). Semantically, this migration brings no change in this respect, but runtime-wise, this will have a perf impact on some code. * A `RUST_LOG=::help` directive will no longer print out a list of all modules that can be logged. This is because the crate map will no longer specify the log levels of all modules, so the list of modules is not known. Additionally, warnings can no longer be provided if a malformed logging directive was supplied. The new "hello world" for logging looks like: #[phase(syntax, link)] extern crate log; fn main() { debug!("Hello, world!"); }
2014-03-15Remove std::cmp::cmp2.Steven Fackler-20/+0
It isn't used anywhere and `cmp2(a, b, c, d)` is identical to `(a, b).cmp(&(c, d))`.
2014-03-15libstd: Fix a typo. s/target_os/target_arch/Luqman Aden-4/+4
2014-03-14auto merge of #12896 : alexcrichton/rust/goodbye-extra, r=brsonbors-22/+321
This commit shreds all remnants of libextra from the compiler and standard distribution. Two modules, c_vec/tempfile, were moved into libstd after some cleanup, and the other modules were moved to separate crates as seen fit. Closes #8784 Closes #12413 Closes #12576
2014-03-14auto merge of #12893 : alexcrichton/rust/cfg-not, r=luqmanabors-2/+13
The two commits have the details of the two fixes
2014-03-14auto merge of #12888 : aochagavia/rust/Fix-comment, r=alexcrichtonbors-9/+3
The old comment of as_mut_slice() did not describe the function correctly. The new one does. Also refactored option::iter() and option::mut_iter() to use as_ref() and as_mut() instead of match.
2014-03-14auto merge of #12878 : crabtw/rust/mips, r=alexcrichtonbors-13/+23
I ignored AtomicU64 methods on MIPS target because libgcc doesn't implement MIPS32 64-bit atomic operations. Otherwise it would cause link failure. By the way, the patched LLVM doesn't have MIPS split stack anymore. Should I file an issue about that?
2014-03-14extra: Put the nail in the coffin, delete libextraAlex Crichton-22/+321
This commit shreds all remnants of libextra from the compiler and standard distribution. Two modules, c_vec/tempfile, were moved into libstd after some cleanup, and the other modules were moved to separate crates as seen fit. Closes #8784 Closes #12413 Closes #12576
2014-03-14auto merge of #12869 : thestinger/rust/cmp, r=brsonbors-6/+6
The `Float` trait provides correct `min` and `max` methods on floating point types, providing a consistent result regardless of the order the parameters are passed. These generic functions do not take the necessary performance hit to correctly support a partial order, so the true requirement should be given as a type bound. Closes #12712
2014-03-14cmp: switch `min` and `max` to `TotalOrd`Daniel Micay-6/+6
The `Float` trait provides correct `min` and `max` methods on floating point types, providing a consistent result regardless of the order the parameters are passed. These generic functions do not take the necessary performance hit to correctly support a partial order, so the true requirement should be given as a type bound. Closes #12712
2014-03-14std: Fix backtraces on arm linuxAlex Crichton-2/+13
On android, libgcc is missing the _Unwind_GetIP symbol because it's defined as a macro. This is the same case for arm linux, so this commit adds the necessary cfgs in place to use the "expanded macro" in rust for arm linux.
2014-03-14Refactored iter and mut_iteraochagavia-8/+2
Replaced match by self.as_ref() and self.as_mut()
2014-03-14Fixed comment of as_mut_slice (libstd/option.rs)aochagavia-1/+1
The old comment did not describe the function correctly
2014-03-14auto merge of #12875 : alexcrichton/rust/demangle-more-things, r=brsonbors-7/+54
Add some more infrastructure support for demangling `$`-sequences, as well as fixing demangling of closure symbol names if there's more than one closure in a function.
2014-03-14auto merge of #12871 : aochagavia/rust/Optimize-while_some, r=alexcrichtonbors-3/+6
The old 'while' needed to match 2 times for each iteration. With the new 'loop' there is just one match needed. I have also replaced 'blk' by 'f' to be more consistent with parameter names in other functions that are implemented for Option<T>
2014-03-13auto merge of #12861 : huonw/rust/lint-owned-vecs, r=thestingerbors-2/+5
lint: add lint for use of a `~[T]`. This is useless at the moment (since pretty much every crate uses `~[]`), but should help avoid regressions once completely removed from a crate.
2014-03-13auto merge of #12855 : alexcrichton/rust/shutdown, r=brsonbors-0/+37
This is something that is plausibly useful, and is provided by libuv. This is not currently surfaced as part of the `TcpStream` type, but it may possibly appear in the future. For now only the raw functionality is provided through the Rtio objects.
2014-03-14fix MIPS targetJyun-Yan You-13/+23
I ignored AtomicU64 methods on MIPS target because libgcc doesn't implement MIPS32 64-bit atomic operations. Otherwise it would cause link failure.
2014-03-14std: render the vec_ng docs.Huon Wilson-2/+4
These are wildly incomplete, but having something there is better than nothing, e.g. so that people know it exists, and many of the functions behaviour can be guessed from the name or by checking the source: it's knowing they exist at all that's the hard part.
2014-03-14lint: add lint for use of a `~[T]`.Huon Wilson-0/+1
This is useless at the moment (since pretty much every crate uses `~[]`), but should help avoid regressions once completely removed from a crate.
2014-03-13std: Demangle more escapes in backtracesAlex Crichton-7/+54
The rust compiler not only outputs symbols in the form that C++ does, but it also mangle symbols like '&' and '~' to special compiler-defined escape sequences. For convenience, these symbols are demangled when printing backtraces.
2014-03-13io: Bind to shutdown() for TCP streamsAlex Crichton-0/+37
This is something that is plausibly useful, and is provided by libuv. This is not currently surfaced as part of the `TcpStream` type, but it may possibly appear in the future. For now only the raw functionality is provided through the Rtio objects.
2014-03-13auto merge of #12815 : alexcrichton/rust/chan-rename, r=brsonbors-909/+865
* Chan<T> => Sender<T> * Port<T> => Receiver<T> * Chan::new() => channel() * constructor returns (Sender, Receiver) instead of (Receiver, Sender) * local variables named `port` renamed to `rx` * local variables named `chan` renamed to `tx` Closes #11765
2014-03-13Refactored while_some (libstd/option.rs)aochagavia-3/+6
The old 'while' needed to match 2 times for each iteration. With the new 'loop' there is just one match needed. I have also replaced 'blk' by 'f' to be more consistent with parameter names in other functions that are implemented for Option
2014-03-13std: Rename Chan/Port types and constructorAlex Crichton-909/+865
* Chan<T> => Sender<T> * Port<T> => Receiver<T> * Chan::new() => channel() * constructor returns (Sender, Receiver) instead of (Receiver, Sender) * local variables named `port` renamed to `rx` * local variables named `chan` renamed to `tx` Closes #11765
2014-03-13auto merge of #12573 : lbonn/rust/unrecurs, r=alexcrichtonbors-11/+85
As mentioned in #6109, ```mkdir_recursive``` doesn't really need to use recursive calls, so here is an iterative version. The other points of the proposed overhaul (renaming and existing permissions) still need to be resolved. I also bundled an iterative ```rmdir_recursive```, for the same reason. Please do not hesitate to provide feedback on style as this is my first code change in rust.
2014-03-13auto merge of #12561 : pzol/rust/char-case, r=alexcrichtonbors-1388/+1115
Added common and simple case folding, i.e. mapping one to one character mapping. For more information see http://www.unicode.org/faq/casemap_charprop.html Removed auto-generated dead code which wasn't used.
2014-03-13auto merge of #12238 : ktt3ja/rust/lifetime-error-msg, r=nikomatsakisbors-0/+29
For the following code snippet: ```rust struct Foo { bar: int } fn foo1(x: &Foo) -> &int { &x.bar } ``` This PR generates the following error message: ```rust test.rs:2:1: 4:2 note: consider using an explicit lifetime parameter as shown: fn foo1<'a>(x: &'a Foo) -> &'a int test.rs:2 fn foo1(x: &Foo) -> &int { test.rs:3 &x.bar test.rs:4 } test.rs:3:5: 3:11 error: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements test.rs:3 &x.bar ^~~~~~ ``` Currently it does not support methods.
2014-03-13auto merge of #12610 : eddyb/rust/deref-now-auto, r=nikomatsakisbors-24/+19
Enables the dereference overloads introduced by #12491 to be applied wherever automatic dereferences would be used (field accesses, method calls and indexing).
2014-03-13Remove Rc's borrow method to avoid conflicts with RefCell's borrow in ↵Eduard Burtescu-24/+19
Rc<RefCell<T>>.
2014-03-13auto merge of #12845 : eddyb/rust/vec-no-drop-flag, r=thestingerbors-0/+50
2014-03-13Remove code duplicationPiotr Zolnierek-52/+32
Remove whitespace Update documentation for to_uppercase, to_lowercase
2014-03-13Implement lower, upper case conversion for charPiotr Zolnierek-1/+1088
2014-03-13std::unicode: remove unused category tablesPiotr Zolnierek-1340/+0
2014-03-13auto merge of #12602 : alexcrichton/rust/backtrace, r=brsonbors-100/+914
Whenever a failure happens, if a program is run with `RUST_LOG=std::rt::backtrace` a backtrace will be printed to the task's stderr handle. Stack traces are uncondtionally printed on double-failure and rtabort!(). This ended up having a nontrivial implementation, and here's some highlights of it: * We're bundling libbacktrace for everything but OSX and Windows * We use libgcc_s and its libunwind apis to get a backtrace of instruction pointers * On OSX we use dladdr() to go from an instruction pointer to a symbol * On unix that isn't OSX, we use libbacktrace to get symbols * Windows, as usual, has an entirely separate implementation Lots more fun details and comments can be found in the source itself. Closes #10128
2014-03-13Add basic backtrace functionalityAlex Crichton-100/+914
Whenever a failure happens, if a program is run with `RUST_LOG=std::rt::backtrace` a backtrace will be printed to the task's stderr handle. Stack traces are uncondtionally printed on double-failure and rtabort!(). This ended up having a nontrivial implementation, and here's some highlights of it: * We're bundling libbacktrace for everything but OSX and Windows * We use libgcc_s and its libunwind apis to get a backtrace of instruction pointers * On OSX we use dladdr() to go from an instruction pointer to a symbol * On unix that isn't OSX, we use libbacktrace to get symbols * Windows, as usual, has an entirely separate implementation Lots more fun details and comments can be found in the source itself. Closes #10128
2014-03-12auto merge of #12414 : DaGenix/rust/failing-iterator-wrappers, r=alexcrichtonbors-46/+53
Most IO related functions return an IoResult so that the caller can handle failure in whatever way is appropriate. However, the `lines`, `bytes`, and `chars` iterators all supress errors. This means that code that needs to handle errors can't use any of these iterators. All three of these iterators were updated to produce IoResults. Fixes #12368
2014-03-12auto merge of #12822 : erickt/rust/cleanup, r=acrichtobors-7/+9
This PR makes `std::io::FileStat` hashable, and `Path` serializable as a byte array.
2014-03-12Update io iterators to produce IoResultsPalmer Cox-46/+53
Most IO related functions return an IoResult so that the caller can handle failure in whatever way is appropriate. However, the `lines`, `bytes`, and `chars` iterators all supress errors. This means that code that needs to handle errors can't use any of these iterators. All three of these iterators were updated to produce IoResults. Fixes #12368
2014-03-12auto merge of #12756 : pongad/rust/remove_owned_str_pat, r=alexcrichtonbors-4/+4
match-drop-strs-issue-4541.rs deleted as it's the same with issue-4541.rs
2014-03-12std: allow io::File* structs to be hashableErick Tryzelaar-7/+9
2014-03-12rustc: Remove matching on ~str from the languageMichael Darakananda-4/+4
The `~str` type is not long for this world as it will be superseded by the soon-to-come DST changes for the language. The new type will be `~Str`, and matching over the allocation will no longer be supported. Matching on `&str` will continue to work, in both a pre and post DST world.
2014-03-12Remove remaining nolink usages.(fixes #12810)lpy-28/+0
2014-03-12Use generic impls for `Hash`Erick Tryzelaar-12/+15