Commit Graph

27 Commits

Author SHA1 Message Date
Carol (Nichols || Goulding)
1b32298396 Move all Default docs from module to trait
I had already copied the implementation example in a previous commit;
this copies the explanation and usage examples to the general trait
description.
2016-05-23 13:47:28 -04:00
Carol (Nichols || Goulding)
b4e123d3e0 Shorten, yet clarify, initial summary sentences 2016-05-23 12:53:42 -04:00
Carol (Nichols || Goulding)
bd50effe0f Make the Default docs more like the other traits
Add explicit "Derivable" and "How can I implement `Default`" sections.
Copied relevant sections from the module-level documentation, but also
linked to there-- it has a more comprehensive narrative with examples
that show implementation AND use. Decided to just put implementation
example in the trait documentation.
2016-05-23 10:03:44 -04:00
Kevin Butler
82784cb89d libcore: deny warnings in doctests 2015-11-12 05:16:08 +00:00
Vadim Petrochenkov
2ef07f0519 Remove stability annotations from trait impl items
Remove `stable` stability annotations from inherent impls
2015-11-06 00:13:46 +03:00
Andrew Paseltiner
863bb1f515 Make {Default, From, FromIterator, One, Zero} well-formed
Using these traits in an object context previously resulted in an RFC
1214 warning.
2015-10-23 21:56:23 -04:00
Tshepang Lekhonkhobe
469620fd8e doc: I had to read this twice before understanding it 2015-08-26 23:48:45 +02:00
Corey Farwell
68989918d2 Remove doc-comment default::Default imports
In 8f5b5f94dc, `default::Default` was
added to the prelude, so these imports are no longer necessary.
2015-04-22 09:42:36 -04:00
Tamir Duberstein
d51047ded0 Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
Felix S. Klock II
e240cb919b Audit core::default for int/uint usage.
* Use `i32` (`u32`) in doc examples, not `int` (`u32`).

* Switch impl macros to use `isize`/`usize` rather than `int`/`uint`.
2015-02-18 14:41:13 +01:00
Brian Anderson
d179ba3b8e Merge remote-tracking branch 'rust-lang/master'
Conflicts:
	src/libcore/cmp.rs
	src/libcore/fmt/mod.rs
	src/libcore/iter.rs
	src/libcore/marker.rs
	src/libcore/num/f32.rs
	src/libcore/num/f64.rs
	src/libcore/result.rs
	src/libcore/str/mod.rs
	src/librustc/lint/builtin.rs
	src/librustc/lint/context.rs
	src/libstd/sync/mpsc/mod.rs
	src/libstd/sync/poison.rs
2015-01-25 22:14:06 -08:00
Alfie John
f67e7470b3 Moving away from deprecated i/u suffixes in libcore 2015-01-25 00:17:41 +00:00
Brian Anderson
b44ee371b8 grandfathered -> rust1 2015-01-23 21:48:20 -08:00
Brian Anderson
94ca8a3610 Add 'feature' and 'since' to stability attributes 2015-01-21 16:16:18 -08:00
Jorge Aparicio
351409a622 sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rs 2015-01-03 22:54:18 -05:00
Patrick Walton
ddb2466f6a librustc: Always parse macro!()/macro![] as expressions if not
followed by a semicolon.

This allows code like `vec![1i, 2, 3].len();` to work.

This breaks code that uses macros as statements without putting
semicolons after them, such as:

    fn main() {
        ...
        assert!(a == b)
        assert!(c == d)
        println(...);
    }

It also breaks code that uses macros as items without semicolons:

    local_data_key!(foo)

    fn main() {
        println("hello world")
    }

Add semicolons to fix this code. Those two examples can be fixed as
follows:

    fn main() {
        ...
        assert!(a == b);
        assert!(c == d);
        println(...);
    }

    local_data_key!(foo);

    fn main() {
        println("hello world")
    }

RFC #378.

Closes #18635.

[breaking-change]
2014-12-18 12:09:07 -05:00
Alex Crichton
9021f61ef7 std: Second pass stabilization of default
This commit performs a second pass stabilization of the `std::default` module.
The module was already marked `#[stable]`, and the inheritance of `#[stable]`
was removed since this attribute was applied. This commit adds the `#[stable]`
attribute to the trait definition and one method name, along with all
implementations found in the standard distribution.
2014-12-15 20:04:52 -08:00
Steven Fackler
3dcd215740 Switch to purely namespaced enums
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-17 07:35:51 -08:00
Steve Klabnik
03b96d1ab6 Beef up Default documentation 2014-09-24 20:35:33 -04:00
bors
3a37ed4412 auto merge of #15806 : treeman/rust/std-doc, r=alexcrichton
Used `HashMap` and `HashSet` as the base of most examples. Could change it up with different containers, but I don't think it's a big deal.
2014-07-20 17:46:32 +00:00
Jonas Hietala
41729b83bc Document some trait methods. 2014-07-19 12:26:18 +02:00
Brian Anderson
71f3d8fc1f std: Stabilize default
All stable.
2014-07-18 18:34:35 -07:00
Alex Crichton
531ed3d599 rustc: Update how Gc<T> is recognized
This commit uses the same trick as ~/Box to map Gc<T> to @T internally inside
the compiler. This moves a number of implementations of traits to the `gc`
module in the standard library.

This removes functions such as `Gc::new`, `Gc::borrow`, and `Gc::ptr_eq` in
favor of the more modern equivalents, `box(GC)`, `Deref`, and pointer equality.

The Gc pointer itself should be much more useful now, and subsequent commits
will move the compiler away from @T towards Gc<T>

[breaking-change]
2014-06-11 09:11:40 -07:00
Piotr Jawniak
dd0d495f50 Move trait impls for primitives near trait definition
Closes #12925
2014-05-28 17:15:35 +02:00
Brian Anderson
a0594ebb8b core: Remove the unit module 2014-05-15 13:50:50 -07:00
Alex Crichton
cbc31df4fc std: Move the owned module from core to std
The compiler was updated to recognize that implementations for ty_uniq(..) are
allowed if the Box lang item is located in the current crate. This enforces the
idea that libcore cannot allocated, and moves all related trait implementations
from libcore to libstd.

This is a breaking change in that the AnyOwnExt trait has moved from the any
module to the owned module. Any previous users of std::any::AnyOwnExt should now
use std::owned::AnyOwnExt instead. This was done because the trait is intended
for Box traits and only Box traits.

[breaking-change]
2014-05-13 17:24:07 -07:00
Alex Crichton
dfd967f239 core: Inherit the default module 2014-05-07 08:13:56 -07:00