Commit graph

93 commits

Author SHA1 Message Date
Mazdak Farrokhzad
c065367ca0
Rollup merge of #59707 - GuillaumeGomez:GuillaumeGomez-patch-1, r=Centril
Add missing tryfrom example

r? @rust-lang/docs
2019-04-06 00:14:46 +02:00
Guillaume Gomez
c386210714 Add missing tryfrom example 2019-04-05 17:38:25 +02:00
Aleksey Kladov
1cfed0d452 be more direct about borrow requirenments 2019-04-03 11:41:24 +03:00
Josh Stone
e5fa59735b
Rollup merge of #59268 - estebank:from-string, r=QuietMisdreavus
Add suggestion to use `&*var` when `&str: From<String>` is expected

Fix #53879.
2019-03-27 18:15:24 -07:00
Christian
6c479c3d02 Formatting changes, including better wrapping and creating short summary lines. 2019-03-25 22:21:05 +01:00
Esteban Küber
e929d19edc review comments 2019-03-22 21:54:19 -07:00
Esteban Küber
ac3290e8d9 Add suggestion to use &*var when &str: From<String> is expected 2019-03-22 20:38:14 -07:00
Christian
70ce4b168d Wrapped a line such that it does not exceed 100 characters. 2019-03-21 19:36:51 +01:00
Christian
d7fcd219c5 Changed inline code by using a single quote. 2019-03-21 18:49:12 +01:00
Christian
a66fca459a Added back a reference to "the book" 2019-03-21 18:42:15 +01:00
Christian
d657d18083 Fixed indentation of list items. 2019-03-21 15:26:07 +01:00
Christian
49a9b349ac Reformatted the text such that the line length does not exceed 100. 2019-03-21 15:06:16 +01:00
Christian
71bdeb022a Initial version of the documentation change of std::convert. 2019-03-20 23:15:41 +01:00
Simon Sapin
db99a3bccd Remove stabilized feature gate in doctest 2019-03-12 17:42:42 +01:00
Simon Heath
60cf413a20 Incorporated review changes. 2019-02-27 16:03:11 +01:00
Simon Heath
72afe51d81 Slowly figuring out how rustdoc actually works.
Unfortunately trying to run doctests on my local machine is
not really faster than letting Travis do it...
2019-02-27 16:03:11 +01:00
Simon Heath
cc6f394d6f Fix some links in TryFrom docs. 2019-02-27 16:03:11 +01:00
Simon Heath
c1d1c6731c Fix a bunch of heckin' trailing whitespace 2019-02-27 16:02:25 +01:00
Simon Heath
d2b1212558 Started expanding docs for TryFrom and TryInto.
The examples are still lacking for now, both for module docs
and for methods/impl's.
2019-02-27 16:02:25 +01:00
bors
00aae71f50 Auto merge of #58302 - SimonSapin:tryfrom, r=alexcrichton
Stabilize TryFrom and TryInto with a convert::Infallible empty enum

This is the plan proposed in https://github.com/rust-lang/rust/issues/33417#issuecomment-423073898
2019-02-25 20:24:10 +00:00
Simon Sapin
cf267540eb Review comments 2019-02-17 21:30:38 +01:00
Mazdak Farrokhzad
aa896f30bb
Rollup merge of #57856 - lzutao:fix-old-first-edition, r=steveklabnik
Convert old first edition links to current edition one

r? @steveklabnik
2019-02-14 02:41:16 +01:00
Simon Sapin
b2cf9a02b2 Add impl From<!> for Infallible
The reverse conversion unfortunately causes unexpected errors like:

```
error[E0277]: the trait bound `!: std::convert::From<()>` is not satisfied
   --> src/librustc_metadata/encoder.rs:105:9
    |
105 |         self.emit_usize(seq.len)?;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<()>` is not implemented for `!`
    |
    = help: the following implementations were found:
              <! as std::convert::From<std::convert::Infallible>>
    = note: the trait is implemented for `()`. Possibly this error has been caused by changes to Rust's type-inference algorithm (see: https://github.com/rust-lang/rust/issues/48950 for more info). Consider whether you meant to use the type `()` here instead.
    = note: required by `std::convert::From::from`
```

I don’t understand why this error happens.
If I’m reading the code correctly the return types of `emit_usize`
and of the method that contains line 105 are both `Result<(), !>`,
so the expansion of the `?` operator should involve `!: From<!>`,
not `From<()>`.

Is this a type inference bug?
2019-02-13 19:29:07 +01:00
Simon Sapin
c80a8f51dc Stabilize TryFrom and TryInto 2019-02-13 18:00:18 +01:00
Simon Sapin
2f7120397f Use convert::Infallible instead of never in the blanket TryFrom impl 2019-02-13 18:00:18 +01:00
Simon Sapin
85f13f0d42 Add a convert::Infallible empty enum, make string::ParseError an alias 2019-02-13 18:00:18 +01:00
Lzu Tao
e7f8e63ed4 Convert old doc links to current edition
Use footnote style to bypass the tidy check
2019-02-13 14:39:25 +00:00
bors
b244f61b77 Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnik
Cosmetic improvements to doc comments

This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase).

r? @steveklabnik

Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-12 19:09:24 +00:00
Alexander Regueiro
b87363e763 tests: doc comments 2019-02-10 23:42:32 +00:00
Simon Heath
b4d3c87ebc Tiny improvement to docs for core::convert.
This is not really significant, accept or reject as you wish.  I
just want to make sure I understand how the PR process works and
I'm doing it right before doing a bigger one for #33417.
2019-01-26 16:46:15 -05:00
Mazdak Farrokhzad
ebc70e2e9e
Rollup merge of #56796 - KrishnaSannasi:try_from_impl_change, r=shepmaster
Change bounds on `TryFrom` blanket impl to use `Into` instead of `From`

This is from this [comment](https://github.com/rust-lang/rust/issues/33417#issuecomment-447111156) I made.

This will expand the impls available for `TryFrom` and `TryInto`, without losing anything in the process.
2019-01-21 02:21:53 +01:00
Mazdak Farrokhzad
e75dab7f67 stabilize convert::identity 2019-01-04 01:42:31 +01:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Ozaren
f8bd80a830 Change bounds on TryFrom blanket impl to use Into instead of From 2018-12-13 16:53:50 -05:00
Andy Russell
2f6226518b
use top level fs functions where appropriate
This commit replaces many usages of `File::open` and reading or writing
with `fs::read_to_string`, `fs::read` and `fs::write`. This reduces code
complexity, and will improve performance for most reads, since the
functions allocate the buffer to be the size of the file.

I believe that this commit will not impact behavior in any way, so some
matches will check the error kind in case the file was not valid UTF-8.
Some of these cases may not actually care about the error.
2018-12-07 12:54:11 -05:00
Mazdak Farrokhzad
5b89877dda constify parts of libcore. 2018-11-10 01:07:32 +01:00
Scott McMurray
0a3bd9b6ab Use impl_header_lifetime_elision in libcore 2018-09-29 21:33:35 -07:00
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 e53a2a7274.
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