56 Commits

Author SHA1 Message Date
Mazdak Farrokhzad
86641d97b2
core::convert::identity: fix issue number to #53500 2018-08-20 09:16:56 +02:00
Mazdak Farrokhzad
71187b7e18
Make core::convert::identity a const fn. 2018-08-19 18:49:31 +02:00
Mazdak Farrokhzad
08b1d83a46
Merge branch 'master' into feature/core_convert_id 2018-08-19 18:34:46 +02:00
Cameron McCormack
02edc7e4ff
AsRef doc wording tweaks 2018-07-15 10:16:36 +10:00
Felix S. Klock II
d141fdc3bf Revert "Stabilize the TryFrom and TryInto traits"
This reverts commit e53a2a72743810e05f58c61c9d8a4c89b712ad2e.
2018-04-20 18:10:00 +02:00
Simon Sapin
e53a2a7274 Stabilize the TryFrom and TryInto traits
Tracking issue: https://github.com/rust-lang/rust/issues/33417
2018-03-26 23:36:02 +02:00
kennytm
2c6f911463
Rollup merge of #49038 - canndrew:replace-infallible-with-never, r=SimonSapin
replace `convert::Infallible` with `!`
2018-03-22 23:22:38 +08:00
Niv Kaminer
e1b9bf0702 update FIXME(#23442) to point to issue 45742 (Blanket impl of AsRef for Deref) 2018-03-17 20:24:49 +02:00
Andrew Cann
4647156985 replace convert::Infallible with ! 2018-03-15 12:35:56 +08:00
Matt Brubeck
f243f9239d Fix info about generic impls in AsMut docs
This text was copy-pasted from the `AsRef` docs to `AsMut`, but needed
some additional adjustments for correctness.
2018-02-04 11:57:36 -08:00
Mazdak
ac64ef3375 fix doctests for convert::id 2018-01-19 03:11:57 +01:00
Mazdak
351fefbb59 add fn core::convert::id<T>(x: T) -> T { x } 2018-01-19 01:27:59 +01:00
Jimmy Cuadra
4d2a8c5278 Simplify implementation of Display and Error for convert::Infallible. 2017-09-23 17:27:02 -07:00
Jimmy Cuadra
79f2439aa6 Impl fmt::Display for convert::Infallible. 2017-09-21 21:09:03 -07:00
Jimmy Cuadra
5f6de3d402 Derive additional traits for Infallible. 2017-09-18 22:19:00 -07:00
Jimmy Cuadra
36c0ff8690 Reword docs for Infallible to make them easier to understand. 2017-09-01 00:26:37 -07:00
Jimmy Cuadra
80e3f8941d Add blanket TryFrom impl when From is implemented.
Adds `impl<T, U> TryFrom<T> for U where U: From<T>`.

Removes `impl<'a, T> TryFrom<&'a str> for T where T: FromStr` due to
overlapping impls caused by the new blanket impl. This removal is to
be discussed further on the tracking issue for TryFrom.

Refs #33417.
2017-08-29 22:13:21 -07:00
Wonwoo Choi
3cb7825986 Update older URLs pointing to the first edition of the Book
`compiler-plugins.html` is moved into the Unstable Book.
Explanation is slightly modified to match the change.
2017-06-15 00:04:00 +09:00
Clar Charr
54bbe23b2e Clarify docs on implementing Into. 2017-05-28 16:13:56 -04:00
est31
14bbd0a5a3 Address review 2017-05-02 06:35:36 +02:00
est31
d290849a23 Removal pass for anonymous parameters
Removes occurences of anonymous parameters from the
rustc codebase, as they are to be deprecated.

See issue #41686 and RFC 1685.
2017-05-02 05:55:20 +02:00
Dylan Maccora
2877a01feb Address review comments 2017-04-18 08:29:05 +10:00
Dylan Maccora
d35fa1e98b Removing broken examples 2017-04-08 08:12:50 +10:00
Dylan Maccora
bb84746823 AsMut example 2017-04-04 08:27:20 +10:00
Dylan Maccora
79efca1093 Wrapped to 80 characters. Fix links. 2017-04-03 18:58:06 +10:00
Dylan Maccora
7897e168bd Convert docs clean up. 2017-04-01 16:56:16 +11:00
bors
6738cd4d47 Auto merge of #40281 - jimmycuadra:try-from-from-str, r=aturon
Rename TryFrom's associated type and implement str::parse using TryFrom.

Per discussion on the tracking issue, naming `TryFrom`'s associated type `Error` is generally more consistent with similar traits in the Rust ecosystem, and what people seem to assume it should be called. It also helps disambiguate from `Result::Err`, the most common "Err".

See https://github.com/rust-lang/rust/issues/33417#issuecomment-269108968.

`TryFrom<&str>` and `FromStr` are equivalent, so have the latter provide the former to ensure that. Using `TryFrom` in the implementation of `str::parse` means types that implement either trait can use it. When we're ready to stabilize `TryFrom`, we should update `FromStr` to
suggest implementing `TryFrom<&str>` instead for new code.

See https://github.com/rust-lang/rust/issues/33417#issuecomment-277175994
and https://github.com/rust-lang/rust/issues/33417#issuecomment-277253827.

Refs #33417.
2017-03-20 05:36:36 +00:00
Jimmy Cuadra
2561dcddf9 Rename TryFrom's associated type and implement str::parse using TryFrom.
Per discussion on the tracking issue, naming `TryFrom`'s associated type
`Error` is generally more consistent with similar traits in the Rust
ecosystem, and what people seem to assume it should be called. It
also helps disambiguate from `Result::Err`, the most common "Err".

See
https://github.com/rust-lang/rust/issues/33417#issuecomment-269108968.

TryFrom<&str> and FromStr are equivalent, so have the latter provide the
former to ensure that. Using TryFrom in the implementation of
`str::parse` means types that implement either trait can use it.
When we're ready to stabilize `TryFrom`, we should update `FromStr` to
suggest implementing `TryFrom<&str>` instead for new code.

See
https://github.com/rust-lang/rust/issues/33417#issuecomment-277175994
and
https://github.com/rust-lang/rust/issues/33417#issuecomment-277253827.

Refs #33417.
2017-03-15 07:51:54 -07:00
Corey Farwell
e7b0f2badf Remove function invokation parens from documentation links.
This was never established as a convention we should follow in the 'More
API Documentation Conventions' RFC:

https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-13 21:43:18 -04:00
Jimmy Cuadra
2add6ac14a Add a name for the parameter to TryFrom::try_from.
Although signatures with anonymous parameters may not be deprecated or
removed at this point, the team seems to agree that the ability to have
an anonymous parameter is unfortunate historical baggage, and that we
shouldn't create new code that uses it.

Context: https://github.com/rust-lang/rust/issues/33417#issuecomment-276933861
2017-02-02 17:40:44 -08:00
Guillaume Gomez
19c9f18b2c Add missing url in convert module 2017-01-29 23:33:12 +01:00
Oliver Middleton
8faa503a6b Fix a few links in the docs 2016-10-21 00:49:47 +01:00
Mark-Simulacrum
102ee5e70a Add example in AsMut trait documentation 2016-09-15 19:47:04 -06:00
Guillaume Gomez
b712f74508 Add missing urls into convert module 2016-08-31 16:15:19 +02:00
Jeffrey Seyfried
e2ad3be178 Use #[prelude_import] in libcore. 2016-08-24 22:12:23 +00:00
Matthew Piziak
bfca761c8c fix small typos in std::convert documentation
Fix subject-verb agreement in copypasta: "`AsRef` dereference" to
"`AsRef` dereferences".

Formalize "eg" to "e.g." Italicization of common Latin abbreviations
seems to be going out of style in written English, so I left it plain.
2016-08-12 12:20:56 -04:00
Steven Fackler
a9779df188 Implement RFC 1542
cc #33417
2016-05-07 08:52:41 -07:00
Alex Burka
0af3e70842 verb agreement in core::convert docs 2016-03-29 12:23:09 -04:00
Carlos E. Garcia
02aa0aff2f Minor spelling fixes 2016-02-09 11:52:39 -05:00
Thomas Wickham
a0cd46554d Doc:std::convert: disambiguate traits and keywords 2016-01-31 12:26:15 +01:00
Thomas Wickham
6cda8e4eaa Doc:std::convert: be more specific + typo 2016-01-15 01:24:33 +01:00
Thomas Wickham
58d2c7909f Doc:std::convert explicitely list generic impls
Also add a note about the necessary simplicity of the conversion.
Related issue: #29349
2016-01-14 16:06:53 +01: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
Alex Crichton
c14d86fd3f core: Split apart the global core feature
This commit shards the broad `core` feature of the libcore library into finer
grained features. This split groups together similar APIs and enables tracking
each API separately, giving a better sense of where each feature is within the
stabilization process.

A few minor APIs were deprecated along the way:

* Iterator::reverse_in_place
* marker::NoCopy
2015-06-17 09:06:59 -07:00
Steve Klabnik
e780fb270c TRPL: Borrow and AsRef
These two traits are commonly confused. As such, explain the difference.

Fixes #24163
2015-05-12 10:53:50 -04:00
Jan Bujak
a168dbad15 Add #[inline] to AsRef<str>::as_ref for String and str. 2015-05-10 14:06:41 +02:00
Corey Farwell
57284e6880 Make From::from example more idiomatic / simpler 2015-04-26 23:18:19 -04:00
Steve Klabnik
15c3435b87 Remove reference to 'to'
FIxes #24712
2015-04-24 11:02:07 -04:00
Steve Klabnik
288b1c9aba Add examples for Convert 2015-04-10 12:44:20 -04:00
Andrew Paseltiner
2d198955d3 s/Perform/Performs/
Per [RFC #0505](https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#formatting).
2015-04-04 10:26:14 -04:00