about summary refs log tree commit diff
path: root/src/libstd/std.rs
AgeCommit message (Collapse)AuthorLines
2013-11-03Rename files to match current recommendations.Chris Morgan-232/+0
New standards have arisen in recent months, mostly for the use of rustpkg, but the main Rust codebase has not been altered to match these new specifications. This changeset rectifies most of these issues. - Renamed the crate source files `src/libX/X.rs` to `lib.rs`, for consistency with current styles; this affects extra, rustc, rustdoc, rustpkg, rustuv, std, syntax. - Renamed `X/X.rs` to `X/mod.rs,` as is now recommended style, for `std::num` and `std::terminfo`. - Shifted `src/libstd/str/ascii.rs` out of the otherwise unused `str` directory, to be consistent with its import path of `std::ascii`; libstd is flat at present so it's more appropriate thus. While this removes some `#[path = "..."]` directives, it does not remove all of them, and leaves certain other inconsistencies, such as `std::u8` et al. which are actually stored in `src/libstd/num/` (one subdirectory down). No quorum has been reached on this issue, so I felt it best to leave them all alone at present. #9208 deals with the possibility of making libstd more hierarchical (such as changing the crate to match the current filesystem structure, which would make the module path `std::num::u8`). There is one thing remaining in which this repository is not rustpkg-compliant: rustpkg would have `src/std/` et al. rather than `src/libstd/` et al. I have not endeavoured to change that at this point as it would guarantee prompt bitrot and confusion. A change of that magnitude needs to be discussed first.
2013-11-01Register new snapshotsAlex Crichton-6/+0
Closes #2240
2013-11-01Reordered the methods in std::Option and std::ResultMarvin Löbel-39/+38
Cleaned up the source in a few places Renamed `map_move` to `map`, removed other `map` methods Added `as_ref` and `as_mut` adapters to `Result` Added `fmt::Default` impl
2013-10-30Prepared `std::sys` for removal, and made `begin_unwind` simplerMarvin Löbel-0/+5
- `begin_unwind` is now generic over any `T: Any + Send`. - Every value you fail with gets boxed as an `~Any`. - Because of implementation details, `&'static str` and `~str` are still handled specially behind the scenes. - Changed the big macro source string in libsyntax to a raw string literal, and enabled doc comments there.
2013-10-29Move rust's uv implementation to its own crateAlex Crichton-1/+6
There are a few reasons that this is a desirable move to take: 1. Proof of concept that a third party event loop is possible 2. Clear separation of responsibility between rt::io and the uv-backend 3. Enforce in the future that the event loop is "pluggable" and replacable Here's a quick summary of the points of this pull request which make this possible: * Two new lang items were introduced: event_loop, and event_loop_factory. The idea of a "factory" is to define a function which can be called with no arguments and will return the new event loop as a trait object. This factory is emitted to the crate map when building an executable. The factory doesn't have to exist, and when it doesn't then an empty slot is in the crate map and a basic event loop with no I/O support is provided to the runtime. * When building an executable, then the rustuv crate will be linked by default (providing a default implementation of the event loop) via a similar method to injecting a dependency on libstd. This is currently the only location where the rustuv crate is ever linked. * There is a new #[no_uv] attribute (implied by #[no_std]) which denies implicitly linking to rustuv by default Closes #5019
2013-10-28Allow fail messages to be caught, and introduce the Any traitMarvin Löbel-6/+8
Some code cleanup, sorting of import blocks Removed std::unstable::UnsafeArc's use of Either Added run-fail tests for the new FailWithCause impls Changed future_result and try to return Result<(), ~Any>. - Internally, there is an enum of possible fail messages passend around. - In case of linked failure or a string message, the ~Any gets lazyly allocated in future_results recv method. - For that, future result now returns a wrapper around a Port. - Moved and renamed task::TaskResult into rt::task::UnwindResult and made it an internal enum. - Introduced a replacement typedef `type TaskResult = Result<(), ~Any>`.
2013-10-24Remove std::io once and for all!Alex Crichton-1/+0
2013-10-23register snapshotsDaniel Micay-1/+1
2013-10-22Activate checking code for ASM feature gate. Fix testsLéo Testard-1/+1
2013-10-17std: Move size/align functions to std::mem. #2240Brian Anderson-0/+1
2013-10-11auto merge of #9794 : thestinger/rust/rc, r=alexcrichtonbors-0/+1
I've left out a way to construct from a `Send` type until #9509 is resolved. I am confident that this interface can remain backwards compatible though, assuming we name the `Pointer` trait method `borrow`. When there is a way to convert from `Send` (`from_send`), a future RAII-based `Mut` type can be used with this to implemented a mutable reference-counted pointer. For now, I've left around the `RcMut` type but it may drastically change or be removed.
2013-10-11clean up the `Rc`/`RcMut` types and move to libstdDaniel Micay-0/+1
2013-10-11De-pub some private runtime componentsAlex Crichton-3/+0
This change was waiting for privacy to get sorted out, which should be true now that #8215 has landed. Closes #4427
2013-10-05Implement feature-gating for the compilerAlex Crichton-0/+2
A few features are now hidden behind various #[feature(...)] directives. These include struct-like enum variants, glob imports, and macro_rules! invocations. Closes #9304 Closes #9305 Closes #9306 Closes #9331
2013-10-02rustdoc: Generate hyperlinks between cratesAlex Crichton-1/+2
The general idea of hyperlinking between crates is that it should require as little configuration as possible, if any at all. In this vein, there are two separate ways to generate hyperlinks between crates: 1. When you're generating documentation for a crate 'foo' into folder 'doc', then if foo's external crate dependencies already have documented in the folder 'doc', then hyperlinks will be generated. This will work because all documentation is in the same folder, allowing links to work seamlessly both on the web and on the local filesystem browser. The rationale for this use case is a package with multiple libraries/crates that all want to link to one another, and you don't want to have to deal with going to the web. In theory this could be extended to have a RUST_PATH-style searching situtation, but I'm not sure that it would work seamlessly on the web as it does on the local filesystem, so I'm not attempting to explore this case in this pull request. I believe to fully realize this potential rustdoc would have to be acting as a server instead of a static site generator. 2. One of foo's external dependencies has a #[doc(html_root_url = "...")] attribute. This means that all hyperlinks to the dependency will be rooted at this url. This use case encompasses all packages using libstd/libextra. These two crates now have this attribute encoded (currently at the /doc/master url) and will be read by anything which has a dependency on libstd/libextra. This should also work for arbitrary crates in the wild that have online documentation. I don't like how the version is hard-wired into the url, but I think that this may be a case-by-case thing which doesn't end up being too bad in the long run. Closes #9539
2013-10-01remove the `float` typeDaniel Micay-1/+0
It is simply defined as `f64` across every platform right now. A use case hasn't been presented for a `float` type defined as the highest precision floating point type implemented in hardware on the platform. Performance-wise, using the smallest precision correct for the use case greatly saves on cache space and allows for fitting more numbers into SSE/AVX registers. If there was a use case, this could be implemented as simply a type alias or a struct thanks to `#[cfg(...)]`. Closes #6592 The mailing list thread, for reference: https://mail.mozilla.org/pipermail/rust-dev/2013-July/004632.html
2013-09-27auto merge of #9552 : brson/rust/0.9-pre, r=alexcrichtonbors-2/+2
2013-09-26Update version numbers to 0.9-preBrian Anderson-2/+2
2013-09-26auto merge of #9261 : alexcrichton/rust/logging, r=huonwbors-0/+1
This lifts various restrictions on the runtime, for example the character limit when logging a message. Right now the old debug!-style macros still involve allocating (because they use fmt! syntax), but the new debug2! macros don't involve allocating at all (unless the formatter for a type requires allocation.
2013-09-25Refactor the logging system for fewer allocationsAlex Crichton-0/+1
This lifts various restrictions on the runtime, for example the character limit when logging a message. Right now the old debug!-style macros still involve allocating (because they use fmt! syntax), but the new debug2! macros don't involve allocating at all (unless the formatter for a type requires allocation.
2013-09-25rustdoc: Strip hidden docs by default.Alex Crichton-2/+1
2013-09-23libsyntax: Introduce routines and remove all `@fn`s from libsyntax save the ↵Patrick Walton-1/+1
old visitor
2013-09-21Update version numbers to 0.8Brian Anderson-2/+2
2013-09-20Implement a web backend for rustdoc_ngAlex Crichton-0/+4
This large commit implements and `html` output option for rustdoc_ng. The executable has been altered to be invoked as "rustdoc_ng html <crate>" and it will dump everything into the local "doc" directory. JSON can still be generated by changing 'html' to 'json'. This also fixes a number of bugs in rustdoc_ng relating to comment stripping, along with some other various issues that I found along the way. The `make doc` command has been altered to generate the new documentation into the `doc/ng/$(CRATE)` directories.
2013-09-18Register new snapshotsAlex Crichton-6/+0
2013-09-16Add an SendStr typeMarvin Löbel-0/+1
A SendStr is a string that can hold either a ~str or a &'static str. This can be useful as an optimization when an allocation is sometimes needed but the common case is statically known. Possible use cases include Maps with both static and owned keys, or propagating error messages across task boundaries. SendStr implements most basic traits in a way that hides the fact that it is an enum; in particular things like order and equality are only determined by the content of the wrapped strings. Replaced std::rt:logging::SendableString with SendStr Added tests for using an SendStr as key in Hash- and Treemaps
2013-09-09auto merge of #9005 : alexcrichton/rust/rusty-log, r=brsonbors-0/+1
Also redefine all of the standard logging macros to use more rust code instead of custom LLVM translation code. This makes them a bit easier to understand, but also more flexibile for future types of logging. Additionally, this commit removes the LogType language item in preparation for changing how logging is performed.
2013-09-09rename `std::iterator` to `std::iter`Daniel Micay-1/+1
The trait will keep the `Iterator` naming, but a more concise module name makes using the free functions less verbose. The module will define iterables in addition to iterators, as it deals with iteration in general.
2013-09-05Remove the __log function for __log_levelAlex Crichton-0/+1
Also redefine all of the standard logging macros to use more rust code instead of custom LLVM translation code. This makes them a bit easier to understand, but also more flexibile for future types of logging. Additionally, this commit removes the LogType language item in preparation for changing how logging is performed.
2013-08-30auto merge of #8820 : alexcrichton/rust/no-io-writer, r=brsonbors-0/+6
At the same time, this updates the TyVisitor to use a mutable self because it's probably going to be mutating state as it goes along anyway.
2013-08-28Remove @io::Writer from sys/repr/reflectAlex Crichton-0/+6
At the same time, this updates the TyVisitor to use a mutable self because it's probably going to be mutating state as it goes along anyway.
2013-08-29Remove the iter module.Jason Fager-2/+0
Moves the Times trait to num while the question of whether it should exist at all gets hashed out as a completely separate question.
2013-08-26Add a Default trait.Corey Richardson-1/+1
2013-08-21std/extra: changing XXX to FIXME; cleanupTim Chevalier-1/+1
* Get rid of by-value-self workarounds; it works now * Remove type annotations, they're not needed anymore
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-0/+1
2013-08-14Methodyfied the string ascii extionsion functionsMarvin Löbel-1/+1
Added into_owned() method for vectors Added DoubleEnded Iterator impl to Option Renamed nil.rs to unit.rs
2013-08-12Reorganise Select traits to not expose internal runtime types. Close #5160. ↵Ben Blum-0/+1
Pending #8215.
2013-08-09auto merge of #8296 : erickt/rust/remove-str-trailing-nulls, r=ericktbors-0/+1
This PR fixes #7235 and #3371, which removes trailing nulls from `str` types. Instead, it replaces the creation of c strings with a new type, `std::c_str::CString`, which wraps a malloced byte array, and respects: * No interior nulls * Ends with a trailing null
2013-08-09Remove the C++ runtime. SayonaraBrian Anderson-2/+0
2013-08-08Merge remote-tracking branch 'remotes/origin/master' into ↵Erick Tryzelaar-0/+3
remove-str-trailing-nulls
2013-08-07Add initial support for a new formatting syntaxAlex Crichton-0/+3
The new macro is available under the name ifmt! (only an intermediate name)
2013-08-06Merge commit 'd89ff7eef969aee6b493bc846b64d68358fafbcd' into ↵Erick Tryzelaar-2/+0
remove-str-trailing-nulls
2013-08-04std: replace str::as_c_str with std::c_strErick Tryzelaar-0/+1
2013-08-03std: Remove gc and stackwalkBrian Anderson-2/+0
These are both obsoleted by the forthcoming new GC.
2013-07-27Remove unnecessary #[path = "***/mod.rs"] lines.OGINO Masanori-3/+0
Fixes #7922. Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-07-22std: add #[cfg(test)] reference to extra so we can benchmark libstd.Graydon Hoare-0/+3
2013-07-19std: Remove old magic core modBrian Anderson-10/+0
2013-07-14Make TLS keys actually take up spaceAlex Crichton-0/+1
If the TLS key is 0-sized, then the linux linker is apparently smart enough to put everything at the same pointer. OSX on the other hand, will reserve some space for all of them. To get around this, the TLS key now actuall consumes space to ensure that it gets a unique pointer
2013-07-08Bump version numbers to 0.8-preBrian Anderson-1/+1
2013-06-30Bump version from 0.7-pre to 0.7Brian Anderson-1/+1