about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2015-03-26Update docs to fix various 404sGary M. Josack-1/+1
Found a few 404s that seemed like simple fixes: The Result docs use old_io Writer as an example. Fix the link to old_io Writer. There's probably an effort to update the example away from a deprecated api but this was a simple fix. rustc/plugin was pointing at the old guide and it was a broken link anyways (plugin vs plugins). Point at the book instead. The main page of the API docs referenced c_{str,vec}. Looks like these were deleted in 25d5a3a19423fee01787de87a56d185dd4e0a4e7. Point at ffi docs instead.
2015-03-26Revise use of conversion traitsAaron Turon-0/+16
This commit revises `path` and `os_str` to use blanket impls for `From` on reference types. This both cuts down on the number of required impls, and means that you can pass through e.g. `T: AsRef<OsStr>` to `PathBuf::from` without an intermediate call to `as_ref`. It also makes a FIXME note for later generalizing the blanket impls for `AsRef` and `AsMut` to use `Deref`/`DerefMut`, once it is possible to do so.
2015-03-26syntax: Remove support for #[should_fail]Alex Crichton-4/+4
This attribute has been deprecated in favor of #[should_panic]. This also updates rustdoc to no longer accept the `should_fail` directive and instead renames it to `should_panic`.
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-116/+117
Now that support has been removed, all lingering use cases are renamed.
2015-03-26Register new snapshotsAlex Crichton-358/+0
2015-03-26Deprecate as_mut_slice methodsErick Tryzelaar-0/+6
This is technically a breaking change as it deprecates and unstables some previously stable apis that were missed in the last round of deprecations. [breaking change]
2015-03-26Added instability markers to `POST_DROP_*` consts, and related opt-in's.Felix S. Klock II-10/+19
(Reviewed rest of code; did not see other `pub` items that needed such treatment.) Driveby: fix typo in comment in ptr.rs.
2015-03-26A better `core::mem::dropped` implementation suggested by huonw on the PR.Felix S. Klock II-6/+9
2015-03-26filling-drop: switch `DTOR_NEEDED` and `DTOR_DONE` to non-trivial values.Felix S. Klock II-1/+1
2015-03-26Switch drop-flag to `u8` to allow special tags to instrument state.Felix S. Klock II-1/+95
Refactored code so that the drop-flag values for initialized (`DTOR_NEEDED`) versus dropped (`DTOR_DONE`) are given explicit names. Add `mem::dropped()` (which with `DTOR_DONE == 0` is semantically the same as `mem::zeroed`, but the point is that it abstracts away from the particular choice of value for `DTOR_DONE`). Filling-drop needs to use something other than `ptr::read_and_zero`, so I added such a function: `ptr::read_and_drop`. But, libraries should not use it if they can otherwise avoid it. Fixes to tests to accommodate filling-drop.
2015-03-25Auto merge of #23434 - alexcrichton:misc-stab, r=aturonbors-3/+4
Now that we check the stability of fields, the fields of this struct should also be stable.
2015-03-25Rollup merge of #23664 - bluss:std-docs, r=steveklabnikManish Goregaokar-8/+7
Main motivation was to update docs for the removal or "demotion" of certain extension traits. The update to the slice docs was larger, since the text was largely outdated.
2015-03-24Test fixes and rebase conflicts, round 2Alex Crichton-0/+1
2015-03-25Implement AsRef and AsMut for fixed-sized arraysGleb Kozyrev-0/+19
2015-03-24rollup merge of #23671: steveklabnik/doc_std_cloneAlex Crichton-0/+8
2015-03-24rollup merge of #23661: steveklabnik/any_docsAlex Crichton-4/+4
http://www.reddit.com/r/rust/comments/304q00/type_information_in_rust/cpp43lu
2015-03-24rollup merge of #23630: nrc/coerce-tidyAlex Crichton-3/+31
See notes on the first commit Closes #18601 r? @nikomatsakis cc @eddyb
2015-03-24rollup merge of #23282: nikomatsakis/fn-trait-inheritanceAlex Crichton-1/+52
The primary motivation here is to sidestep #19032 -- for a time, I thought that we should improve coherence or otherwise extend the language, but I now think that any such changes will require more time to bake. In the meantime, inheritance amongst the fn traits is both logically correct *and* a simple solution to that obstacle. This change introduces inheritance and modifies the compiler so that it can properly generate impls for closures and fns. Things enabled by this PR (but not included in this PR): 1. An impl of `FnMut` for `&mut F` where `F : FnMut` (https://github.com/rust-lang/rust/issues/23015). 2. A better version of `Thunk` I've been calling `FnBox`. I did not include either of these in the PR because: 1. Adding the impls in 1 currently induces a coherence conflict with the pattern trait. This is interesting and merits some discussion. 2. `FnBox` deserves to be a PR of its own. The main downside to this design is (a) the need to write impls by hand; (b) the possibility of implementing `FnMut` with different semantics from `Fn`, etc. Point (a) is minor -- in particular, it does not affect normal closure usage -- and could be addressed in the future in many ways (better defaults; convenient macros; specialization; etc). Point (b) is unfortunate but "just a bug" from my POV, and certainly not unique to these traits (c.f. Copy/Clone, PartialEq/Eq, etc). (Until we lift the feature-gate on implementing the Fn traits, in any case, there is room to correct both of these if we find a nice way.) Note that I believe this change is reversible in the future if we decide on another course of action, due to the feature gate on implementing the `Fn` traits, though I do not (currently) think we should reverse it. Fixes #18835. r? @nrc
2015-03-24core: Update docs for StrExt demotion in libstdUlrik Sverdrup-8/+7
Main access point of .split() and other similar methods are not using the StrExt trait anymore, so update the libcore docs to reflect this (because these docs are visible in libstd API documentation).
2015-03-25Change lint names to pluralsNick Cameron-20/+20
2015-03-25Add trivial cast lints.Nick Cameron-3/+31
This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ```
2015-03-24An example for cloneSteve Klabnik-0/+8
2015-03-24Clean up Any's title lineSteve Klabnik-4/+4
http://www.reddit.com/r/rust/comments/304q00/type_information_in_rust/cpp43lu
2015-03-23rollup merge of #23652: alexcrichton/stabilize-hasher-finishAlex Crichton-1/+1
This commit enables writing a stable implementation of the `Hasher` trait as well as actually calculating the hash of a vlaue in a stable fashion. The signature is stabilized as-is.
2015-03-23rollup merge of #23644: mbrubeck/doc-editAlex Crichton-6/+3
PR #23104 moved `is_null` and `offset` to an inherent impl on the raw pointer type. I'm not sure whether or how it's possible to link to docs for that impl. r? @steveklabnik
2015-03-23Update docs for ptr module.Matt Brubeck-6/+3
PR #23104 moved `is_null` and `offset` to an inherent impl on the raw pointer type.
2015-03-23rollup merge of #23503: alexcrichton/fix-ptr-docsAlex Crichton-23/+31
The method with which backwards compatibility was retained ended up leading to documentation that rustdoc didn't handle well and largely ended up confusing.
2015-03-23rollup merge of #23484: alexcrichton/marker-trait-stableAlex Crichton-0/+1
This trait has proven quite useful when defining marker traits to avoid the semi-confusing `PhantomFn` trait and it looks like it will continue to be a useful tool for defining these traits.
2015-03-23rollup merge of #23598: brson/gateAlex Crichton-6/+87
Conflicts: src/compiletest/compiletest.rs src/libcollections/lib.rs src/librustc_back/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/libtest/lib.rs src/test/run-make/rustdoc-default-impl/foo.rs src/test/run-pass/env-home-dir.rs
2015-03-23rollup merge of #23633: tomjakubowski/rustdoc-array-primAlex Crichton-0/+2
Previously, impls for `[T; n]` were collected in the same place as impls for `[T]` and `&[T]`. This splits them out into their own primitive page in both core and std.
2015-03-23rollup merge of #23601: nikomatsakis/by-value-indexAlex Crichton-3/+294
This is a [breaking-change]. When indexing a generic map (hashmap, etc) using the `[]` operator, it is now necessary to borrow explicitly, so change `map[key]` to `map[&key]` (consistent with the `get` routine). However, indexing of string-valued maps with constant strings can now be written `map["abc"]`. r? @japaric cc @aturon @Gankro
2015-03-23rollup merge of #23580: nikomatsakis/pattern-and-overflowAlex Crichton-13/+7
2015-03-23rollup merge of #23541: aturon/stab-errorAlex Crichton-5/+10
This small commit stabilizes the `Error` trait as-is, except that `Send` and `Debug` are added as constraints. The `Send` constraint is because most uses of `Error` will be for trait objects, and by default we would like these objects to be transferrable between threads. The `Debug` constraint is to ensure that e.g. `Box<Error>` is `Debug`, and because types that implement `Display` should certainly implement `Debug` in any case. In the near future we expect to add `Any`-like downcasting features to `Error`, but this is waiting on some additional mechanisms (`Reflect`). It will be added before 1.0 via default methods. [breaking-change] r? @alexcrichton Closes #21790
2015-03-23rollup merge of #23538: aturon/conversionAlex Crichton-1/+161
Conflicts: src/librustc_back/rpath.rs
2015-03-23rollup merge of #23269: shepmaster/split-not-double-endedAlex Crichton-30/+124
Closes #23262
2015-03-23rollup merge of #23211: FlaPer87/oibit-send-and-friendsAlex Crichton-0/+4
Fixes #23225 r? @nikomatsakis
2015-03-23Remove auto-deref'ing Pattern impl because it conflicts with otherNiko Matsakis-13/+7
possible blanket impls and also triggers internal overflow. Add some special cases for common uses (&&str, &String) for now; bounds-targeting deref coercions are probably the right longer term answer.
2015-03-23std: Stabilize the `Hasher::finish` methodAlex Crichton-1/+1
This commit enables writing a stable implementation of the `Hasher` trait as well as actually calculating the hash of a vlaue in a stable fashion. The signature is stabilized as-is.
2015-03-23Add generic conversion traitsAaron Turon-1/+161
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-6/+87
2015-03-23rustdoc: Support for "array" primitiveTom Jakubowski-0/+2
Impls on `clean::Type::FixedVector` are now collected in the array primitive page instead of the slice primitive page. Also add a primitive docs for arrays to `std`.
2015-03-23Adjust Index/IndexMut impls. For generic collections, we takeNiko Matsakis-3/+282
references. For collections whose keys are integers, we take both references and by-value.
2015-03-23Compiler and trait changes to make indexing by value.Niko Matsakis-0/+12
2015-03-23Make the `Fn` traits inherit from one another and remove the bridgingNiko Matsakis-1/+52
impls. This requires: 1. modifying trait selection a bit so that when we synthesize impls for fn pointers and closures; 2. adding code to trans so that we can synthesize a `FnMut`/`FnOnce` impl for a `Fn` closure and so forth.
2015-03-23Stabilize the Error traitAaron Turon-5/+10
This small commit stabilizes the `Error` trait as-is, except that `Send` and `Debug` are added as constraints. The `Send` constraint is because most uses of `Error` will be for trait objects, and by default we would like these objects to be transferrable between threads. The `Debug` constraint is to ensure that e.g. `Box<Error>` is `Debug`, and because types that implement `Display` should certainly implement `Debug` in any case. In the near future we expect to add `Any`-like downcasting features to `Error`, but this is waiting on some additional mechanisms (`Reflect`). It will be added before 1.0 via default methods. [breaking-change]
2015-03-21std: Remove deprecated ptr functionsAlex Crichton-23/+31
The method with which backwards compatibility was retained ended up leading to documentation that rustdoc didn't handle well and largely ended up confusing.
2015-03-21Auto merge of #23470 - alexcrichton:less-prelude, r=aturonbors-9/+14
This commit removes the reexports of `old_io` traits as well as `old_path` types and traits from the prelude. This functionality is now all deprecated and needs to be removed to make way for other functionality like `Seek` in the `std::io` module (currently reexported as `NewSeek` in the io prelude). Closes #23377 Closes #23378
2015-03-20std: Remove old_io/old_path from the preludeAlex Crichton-9/+14
This commit removes the reexports of `old_io` traits as well as `old_path` types and traits from the prelude. This functionality is now all deprecated and needs to be removed to make way for other functionality like `Seek` in the `std::io` module (currently reexported as `NewSeek` in the io prelude). Closes #23377 Closes #23378
2015-03-20Auto merge of #23512 - oli-obk:result_ok_unwrap, r=alexcrichtonbors-2/+2
because then the call to `unwrap()` will not print the error object.
2015-03-20Check trait unsafety for defaulted traitsFlavio Percoco-2/+2