about summary refs log tree commit diff
path: root/src/libtime
AgeCommit message (Collapse)AuthorLines
2015-01-03Remove deprecated functionalityAlex Crichton-1773/+0
This removes a large array of deprecated functionality, regardless of how recently it was deprecated. The purpose of this commit is to clean out the standard libraries and compiler for the upcoming alpha release. Some notable compiler changes were to enable warnings for all now-deprecated command line arguments (previously the deprecated versions were silently accepted) as well as removing deriving(Zero) entirely (the trait was removed). The distribution no longer contains the libtime or libregex_macros crates. Both of these have been deprecated for some time and are available externally.
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-3/+3
2015-01-03sed -i -s 's/\bmod,/self,/g' **/*.rsJorge Aparicio-1/+1
2015-01-03use assoc types in binop traitsJorge Aparicio-2/+8
2015-01-03auto merge of #20154 : P1start/rust/qualified-assoc-type-generics, ↵bors-2/+2
r=nikomatsakis This modifies `Parser::eat_lt` to always split up `<<`s, instead of doing so only when a lifetime name followed or the `force` parameter (now removed) was `true`. This is because `Foo<<TYPE` is now a valid start to a type, whereas previously only `Foo<<LIFETIME` was valid. This is a [breaking-change]. Change code that looks like this: ```rust let x = foo as bar << 13; ``` to use parentheses, like this: ```rust let x = (foo as bar) << 13; ``` Closes #17362.
2015-01-02rollup merge of #20416: nikomatsakis/coherenceAlex Crichton-0/+3
Conflicts: src/test/run-pass/issue-15734.rs src/test/run-pass/issue-3743.rs
2015-01-02rollup merge of #20315: alexcrichton/std-syncAlex Crichton-1/+1
Conflicts: src/libstd/rt/exclusive.rs src/libstd/sync/barrier.rs src/libstd/sys/unix/pipe.rs src/test/bench/shootout-binarytrees.rs src/test/bench/shootout-fannkuch-redux.rs
2015-01-02std: Stabilize the prelude moduleAlex Crichton-3/+3
This commit is an implementation of [RFC 503][rfc] which is a stabilization story for the prelude. Most of the RFC was directly applied, removing reexports. Some reexports are kept around, however: * `range` remains until range syntax has landed to reduce churn. * `Path` and `GenericPath` remain until path reform lands. This is done to prevent many imports of `GenericPath` which will soon be removed. * All `io` traits remain until I/O reform lands so imports can be rewritten all at once to `std::io::prelude::*`. This is a breaking change because many prelude reexports have been removed, and the RFC can be consulted for the exact list of removed reexports, as well as to find the locations of where to import them. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0503-prelude-stabilization.md [breaking-change] Closes #20068
2015-01-02Fix orphan checking (cc #19470). (This is not a complete fix of #19470 ↵Niko Matsakis-0/+3
because of the backwards compatibility feature gate.) This is a [breaking-change]. The new rules require that, for an impl of a trait defined in some other crate, two conditions must hold: 1. Some type must be local. 2. Every type parameter must appear "under" some local type. Here are some examples that are legal: ```rust struct MyStruct<T> { ... } // Here `T` appears "under' `MyStruct`. impl<T> Clone for MyStruct<T> { } // Here `T` appears "under' `MyStruct` as well. Note that it also appears // elsewhere. impl<T> Iterator<T> for MyStruct<T> { } ``` Here is an illegal example: ```rust // Here `U` does not appear "under" `MyStruct` or any other local type. // We call `U` "uncovered". impl<T,U> Iterator<U> for MyStruct<T> { } ``` There are a couple of ways to rewrite this last example so that it is legal: 1. In some cases, the uncovered type parameter (here, `U`) should be converted into an associated type. This is however a non-local change that requires access to the original trait. Also, associated types are not fully baked. 2. Add `U` as a type parameter of `MyStruct`: ```rust struct MyStruct<T,U> { ... } impl<T,U> Iterator<U> for MyStruct<T,U> { } ``` 3. Create a newtype wrapper for `U` ```rust impl<T,U> Iterator<Wrapper<U>> for MyStruct<T,U> { } ``` Because associated types are not fully baked, which in the case of the `Hash` trait makes adhering to this rule impossible, you can temporarily disable this rule in your crate by using `#![feature(old_orphan_check)]`. Note that the `old_orphan_check` feature will be removed before 1.0 is released.
2015-01-01std: Second pass stabilization of syncAlex Crichton-1/+1
This pass performs a second pass of stabilization through the `std::sync` module, avoiding modules/types that are being handled in other PRs (e.g. mutexes, rwlocks, condvars, and channels). The following items are now stable * `sync::atomic` * `sync::atomic::ATOMIC_BOOL_INIT` (was `INIT_ATOMIC_BOOL`) * `sync::atomic::ATOMIC_INT_INIT` (was `INIT_ATOMIC_INT`) * `sync::atomic::ATOMIC_UINT_INIT` (was `INIT_ATOMIC_UINT`) * `sync::Once` * `sync::ONCE_INIT` * `sync::Once::call_once` (was `doit`) * C == `pthread_once(..)` * Boost == `call_once(..)` * Windows == `InitOnceExecuteOnce` * `sync::Barrier` * `sync::Barrier::new` * `sync::Barrier::wait` (now returns a `bool`) * `sync::Semaphore::new` * `sync::Semaphore::acquire` * `sync::Semaphore::release` The following items remain unstable * `sync::SemaphoreGuard` * `sync::Semaphore::access` - it's unclear how this relates to the poisoning story of mutexes. * `sync::TaskPool` - the semantics of a failing task and whether a thread is re-attached to a thread pool are somewhat unclear, and the utility of this type in `sync` is question with respect to the jobs of other primitives. This type will likely become stable or move out of the standard library over time. * `sync::Future` - futures as-is have yet to be deeply re-evaluated with the recent core changes to Rust's synchronization story, and will likely become stable in the future but are unstable until that time comes. [breaking-change]
2014-12-31time: unbox closures used in let bindingsJorge Aparicio-1/+1
2014-12-30Register new snapshotsAlex Crichton-2/+0
2014-12-25Parse fully-qualified associated types in generics without whitespaceP1start-2/+2
This breaks code that looks like this: let x = foo as bar << 13; Change such code to look like this: let x = (foo as bar) << 13; Closes #17362. [breaking-change]
2014-12-22serialize: Fully deprecate the libraryAlex Crichton-1/+4
This commit completes the deprecation story for the in-tree serialization library. The compiler will now emit a warning whenever it encounters `deriving(Encodable)` or `deriving(Decodable)`, and the library itself is now marked `#[unstable]` for when feature staging is enabled. All users of serialization can migrate to the `rustc-serialize` crate on crates.io which provides the exact same interface as the libserialize library in-tree. The new deriving modes are named `RustcEncodable` and `RustcDecodable` and require `extern crate "rustc-serialize" as rustc_serialize` at the crate root in order to expand correctly. To migrate all crates, add the following to your `Cargo.toml`: [dependencies] rustc-serialize = "0.1.1" And then add the following to your crate root: extern crate "rustc-serialize" as rustc_serialize; Finally, rename `Encodable` and `Decodable` deriving modes to `RustcEncodable` and `RustcDecodable`. [breaking-change]
2014-12-21rollup merge of #19972: alexcrichton/snapshotsAlex Crichton-34/+0
Conflicts: src/libcollections/string.rs src/libcollections/vec.rs src/snapshots.txt
2014-12-19Register new snapshotsAlex Crichton-34/+0
This does not yet start the movement to rustc-serialize. That detail is left to a future PR.
2014-12-19libtime: use `#[deriving(Copy)]`Jorge Aparicio-9/+3
2014-12-13libtime: convert `Timespec` binops to by valueJorge Aparicio-0/+34
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-1/+11
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-08auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichtonbors-58/+58
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns: - `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")` - `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")` - `vec.as_mut_slice().sort()` -> `vec.sort()` - `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)` --- Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation. This is rebased on top of #19167 cc @alexcrichton @aturon
2014-12-06libtime: remove unnecessary `to_string()` callsJorge Aparicio-58/+58
2014-12-05Utilize fewer reexportsCorey Farwell-1/+1
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-11-30std: add Reader impl for &[u8]Erick Tryzelaar-5/+4
2014-11-27auto merge of #19343 : sfackler/rust/less-special-attrs, r=alexcrichtonbors-1/+0
Descriptions and licenses are handled by Cargo now, so there's no reason to keep these attributes around.
2014-11-26Remove special casing for some meta attributesSteven Fackler-1/+0
Descriptions and licenses are handled by Cargo now, so there's no reason to keep these attributes around.
2014-11-25/** -> ///Steve Klabnik-43/+27
This is considered good convention.
2014-11-18std: Stabilize std::fmtAlex Crichton-19/+19
This commit applies the stabilization of std::fmt as outlined in [RFC 380][rfc]. There are a number of breaking changes as a part of this commit which will need to be handled to migrated old code: * A number of formatting traits have been removed: String, Bool, Char, Unsigned, Signed, and Float. It is recommended to instead use Show wherever possible or to use adaptor structs to implement other methods of formatting. * The format specifier for Boolean has changed from `t` to `b`. * The enum `FormatError` has been renamed to `Error` as well as becoming a unit struct instead of an enum. The `WriteError` variant no longer exists. * The `format_args_method!` macro has been removed with no replacement. Alter code to use the `format_args!` macro instead. * The public fields of a `Formatter` have become read-only with no replacement. Use a new formatting string to alter the formatting flags in combination with the `write!` macro. The fields can be accessed through accessor methods on the `Formatter` structure. Other than these breaking changes, the contents of std::fmt should now also all contain stability markers. Most of them are still #[unstable] or #[experimental] [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0380-stabilize-std-fmt.md [breaking-change] Closes #18904
2014-11-17Switch to purely namespaced enumsSteven Fackler-1/+4
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-8/+8
2014-11-14auto merge of #18827 : bjz/rust/rfc369-numerics, r=alexcrichtonbors-3/+3
This implements a considerable portion of rust-lang/rfcs#369 (tracked in #18640). Some interpretations had to be made in order to get this to work. The breaking changes are listed below: [breaking-change] - `core::num::{Num, Unsigned, Primitive}` have been deprecated and their re-exports removed from the `{std, core}::prelude`. - `core::num::{Zero, One, Bounded}` have been deprecated. Use the static methods on `core::num::{Float, Int}` instead. There is no equivalent to `Zero::is_zero`. Use `(==)` with `{Float, Int}::zero` instead. - `Signed::abs_sub` has been moved to `std::num::FloatMath`, and is no longer implemented for signed integers. - `core::num::Signed` has been removed, and its methods have been moved to `core::num::Float` and a new trait, `core::num::SignedInt`. The methods now take the `self` parameter by value. - `core::num::{Saturating, CheckedAdd, CheckedSub, CheckedMul, CheckedDiv}` have been removed, and their methods moved to `core::num::Int`. Their parameters are now taken by value. This means that - `std::time::Duration` no longer implements `core::num::{Zero, CheckedAdd, CheckedSub}` instead defining the required methods non-polymorphically. - `core::num::{zero, one, abs, signum}` have been deprecated. Use their respective methods instead. - The `core::num::{next_power_of_two, is_power_of_two, checked_next_power_of_two}` functions have been deprecated in favor of methods defined a new trait, `core::num::UnsignedInt` - `core::iter::{AdditiveIterator, MultiplicativeIterator}` are now only implemented for the built-in numeric types. - `core::iter::{range, range_inclusive, range_step, range_step_inclusive}` now require `core::num::Int` to be implemented for the type they a re parametrized over.
2014-11-12time: Deprecate the library in the distributionAlex Crichton-1/+2
This commit deprecates the entire libtime library in favor of the externally-provided libtime in the rust-lang organization. Users of the `libtime` crate as-is today should add this to their Cargo manifests: [dependencies.time] git = "https://github.com/rust-lang/time" To implement this transition, a new function `Duration::span` was added to the `std::time::Duration` time. This function takes a closure and then returns the duration of time it took that closure to execute. This interface will likely improve with `FnOnce` unboxed closures as moving in and out will be a little easier. Due to the deprecation of the in-tree crate, this is a: [breaking-change] cc #18855, some of the conversions in the `src/test/bench` area may have been a little nicer with that implemented
2014-11-13Remove Signed trait and add SignedInt traitBrendan Zabarauskas-0/+1
The methods have been moved into Float and SignedInt
2014-11-13Deprecate Signed method wrappersBrendan Zabarauskas-3/+2
2014-11-07libtime: alter strftime to use a TmFmtSean McArthur-320/+454
The internals of strftime were converted to use a single formatter, instead of creating and concatenating a bunch of small strings. This showed ~3x improvement in the benches. Also, since the formatted time may be going straight to a Writer, TmFmt was introduced, and is returned from all formatting methods on Tm. This allows the saving of another string allocation. Anyone wanting a String can just call .to_string() on the returned value. [breaking-change]
2014-11-05Repair various cases where values of distinct types were being operatedNiko Matsakis-1/+1
upon (e.g., `&int` added to `int`).
2014-10-29Rename fail! to panic!Steve Klabnik-2/+2
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-16Remove libdebug and update tests.Luqman Aden-9/+8
2014-10-13auto merge of #17467 : hatahet/rust/mybranch, r=alexcrichtonbors-203/+256
[breaking-change]
2014-10-12libtime: `strftime` and `strptime` return type changed to `Result<String, ↵Ziad Hatahet-203/+256
ParseError>`. `strftime` currently returns a `String`. This does not indicate that this function may return an error due to to a malformed format string. This change introduces a `ParseError` enum which indicates the type of error that occurred. The return type of `strptime` was also changed to use this new enum instead of returning `Result<String, String>`. Now, all instances where `strftime` was used need to have their return value checked to see if it were valid or not. [breaking-change]
2014-10-10Register new snapshotsAlex Crichton-1/+1
Also convert a number of `static mut` to just a plain old `static` and remove some unsafe blocks.
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-10-01auto merge of #17630 : sfackler/rust/cfg-warnings, r=brsonbors-9/+6
Closes #17490
2014-09-30Fix libtimeSteven Fackler-9/+6
2014-09-30librustc: Forbid `..` in range patterns.Patrick Walton-2/+2
This breaks code that looks like: match foo { 1..3 => { ... } } Instead, write: match foo { 1...3 => { ... } } Closes #17295. [breaking-change]
2014-09-23Deprecate `#[ignore(cfg(...))]`Steven Fackler-1/+1
Replace `#[ignore(cfg(a, b))]` with `#[cfg_attr(all(a, b), ignore)]`
2014-09-16Fallout from renamingAaron Turon-1/+1
2014-09-04auto merge of #16981 : kmcallister/rust/ctypes-warning, r=alexcrichtonbors-0/+2
2014-09-03Fix some non-FFI-safe types in externsKeegan McAllister-0/+2