about summary refs log tree commit diff
path: root/src/libcore/default.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-200/+0
2020-06-07Free `default()` forwarding to `Default::default()`Ilya Bobyr-0/+44
When creating default values a trait method needs to be called with an explicit trait name. `Default::default()` seems redundant. A free function on the other hand, when imported directly, seems to be a better API, as it is just `default()`. When implementing the trait, a method is still required.
2020-04-16Fix typo in Default trait docs: Provides -> ProvideLeo Cassarani-1/+1
An earlier commit (99ed06e) accidentally changed this paragraph from the original, imperative "Provide" to the present tense "Provides". The latter is indeed the standard for Rustdoc comments relating to a function or method, but this snippet is introducing the Default trait in general terms and not talking about any particular function. I believe this change was likely made in error and should be reverted.
2019-11-26Format libcore with rustfmtDavid Tolnay-1/+3
This commit applies rustfmt with default settings to files in src/libcore *that are not involved in any currently open PR* to minimize merge conflicts. The list of files involved in open PRs was determined by querying GitHub's GraphQL API with this script: https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8 With the list of files from the script in `outstanding_files`, the relevant commands were: $ find src/libcore -name '*.rs' | xargs rustfmt --edition=2018 $ rg libcore outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libcore.
2019-09-25Snap cfgs to new betaMark Rousskov-1/+0
2019-09-23Move `--cfg bootstrap` out of `rustc.rs`Alex Crichton-1/+1
Instead let's do this via `RUSTFLAGS` in `builder.rs`. Currently requires a submodule update of `stdarch` to fix a problem with previous compilers.
2019-08-17Make built-in derives opaque macrosMatthew Jasper-1/+1
2019-08-14Handle cfg(bootstrap) throughoutMark Rousskov-1/+0
2019-08-10Give built-in macros stable addresses in the standard libraryVadim Petrochenkov-0/+8
2019-02-10libs: doc commentsAlexander Regueiro-1/+1
2018-12-25Remove licensesMark Rousskov-10/+0
2018-11-01Made doc example of `impl Default for …` use `-> Self` instead of explicit ↵Vincent Esche-2/+2
self type
2017-07-18Fix "Quasi-quoting is inefficient" warning in incremental rustbuild.kennytm-1/+1
After #43252 is merged, building stage0 libcore with -i (--incremental) flag will cause 17 "Quasi-quoting might make incremental compilation very inefficient: NtExpr(..)" warnings, as in #40946. Fixing the warning in #40946 will take 12 weeks from now to make into the next stage0, so it is quicker to workaround it in libcore instead.
2017-07-15Rephrase the doc stringValentin Brandl-17/+17
2017-07-15Document default values for primitive typesValentin Brandl-18/+19
2017-02-03Bump version, upgrade bootstrapAlex Crichton-2/+0
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2016-12-30Such large. Very 128. Much bits.Simonas Kazlauskas-0/+4
This commit introduces 128-bit integers. Stage 2 builds and produces a working compiler which understands and supports 128-bit integers throughout. The general strategy used is to have rustc_i128 module which provides aliases for iu128, equal to iu64 in stage9 and iu128 later. Since nowhere in rustc we rely on large numbers being supported, this strategy is good enough to get past the first bootstrap stages to end up with a fully working 128-bit capable compiler. In order for this strategy to work, number of locations had to be changed to use associated max_value/min_value instead of MAX/MIN constants as well as the min_value (or was it max_value?) had to be changed to use xor instead of shift so both 64-bit and 128-bit based consteval works (former not necessarily producing the right results in stage1). This commit includes manual merge conflict resolution changes from a rebase by @est31.
2016-08-24Use `#[prelude_import]` in `libcore`.Jeffrey Seyfried-2/+0
2016-08-23doc: one line too manyTshepang Lekhonkhobe-1/+0
2016-05-23Move all `Default` docs from module to traitCarol (Nichols || Goulding)-73/+42
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-23Shorten, yet clarify, initial summary sentencesCarol (Nichols || Goulding)-1/+3
2016-05-23Make the Default docs more like the other traitsCarol (Nichols || Goulding)-3/+26
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.
2015-11-12libcore: deny warnings in doctestsKevin Butler-0/+6
2015-11-06Remove stability annotations from trait impl itemsVadim Petrochenkov-1/+0
Remove `stable` stability annotations from inherent impls
2015-10-23Make `{Default, From, FromIterator, One, Zero}` well-formedAndrew Paseltiner-1/+3
Using these traits in an object context previously resulted in an RFC 1214 warning.
2015-08-26doc: I had to read this twice before understanding itTshepang Lekhonkhobe-1/+1
2015-04-22Remove doc-comment default::Default importsCorey Farwell-9/+0
In 8f5b5f94dcdb9884737dfbc8efd893d1d70f0b14, `default::Default` was added to the prelude, so these imports are no longer necessary.
2015-03-15Strip all leading/trailing newlinesTamir Duberstein-1/+0
2015-02-18Audit `core::default` for `int`/`uint` usage.Felix S. Klock II-8/+8
* Use `i32` (`u32`) in doc examples, not `int` (`u32`). * Switch impl macros to use `isize`/`usize` rather than `int`/`uint`.
2015-01-25Merge remote-tracking branch 'rust-lang/master'Brian Anderson-10/+10
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-25Moving away from deprecated i/u suffixes in libcoreAlfie John-10/+10
2015-01-23grandfathered -> rust1Brian Anderson-5/+5
2015-01-21Add 'feature' and 'since' to stability attributesBrian Anderson-5/+5
2015-01-03sed -i -s 's/#\[deriving(/#\[derive(/g' **/*.rsJorge Aparicio-5/+5
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-17/+18
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-15std: Second pass stabilization of `default`Alex Crichton-0/+4
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-11-17Switch to purely namespaced enumsSteven Fackler-2/+2
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-09-24Beef up Default documentationSteve Klabnik-3/+108
2014-07-20auto merge of #15806 : treeman/rust/std-doc, r=alexcrichtonbors-0/+10
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-19Document some trait methods.Jonas Hietala-0/+10
2014-07-18std: Stabilize defaultBrian Anderson-0/+2
All stable.
2014-06-11rustc: Update how Gc<T> is recognizedAlex Crichton-4/+0
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-05-28Move trait impls for primitives near trait definitionPiotr Jawniak-4/+27
Closes #12925
2014-05-15core: Remove the unit moduleBrian Anderson-0/+5
2014-05-13std: Move the owned module from core to stdAlex Crichton-6/+0
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-07core: Inherit the default moduleAlex Crichton-0/+27