-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve doc for 'as _' #78086
Improve doc for 'as _' #78086
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I am not sure that this is a good thing to document. I think it can be confusing to see Perhaps we could add a note that "usually, such code should be written with an explicit type"? |
I added a note about clarity and stability, is it better ? |
I would also request for some clarification of similarities and differences between |
fn main() {
let a = 1_u8;
let b = a.into(); // The only in the snippet error occurs here.
let c = From::from(a);
take(c);
}
fn take(_: u16) {} |
Well, what I actually meant is to clarify a bit why do we need |
Oh sorry, I didn't understand what you wanted. I'm not sure how to explain it though. Quick draft below, is it enough ?
I'm not sure if the part about |
Oh, nevermind. I'm not a native English speaker, so it's pretty possible that I just can't describe what I want properly.
LGTM ;) |
I removed the example and added a point about |
8fc887b
to
d0fd75d
Compare
It looks like there's a merge conflict; but the current text looks okay to me. I am still not 100% on this being a good thing to add, but it does seem like some folks at least are in favor so I'm not going to block it, and I could see it being useful. r=me with conflicts fixed |
@poliorcetics if you can resolve the conflicts, we can merge this |
d0fd75d
to
09c032d
Compare
Sorry I completely forgot about this ! Edit: I had to merge my changes to the docs with some other so the text changed a little and probably deserves another read-over |
@rustbot modify labels: -S-waiting-on-author +S-waiting-on-review |
Please squash commits; we should not have a "Fix rebase" commit in history if it can be avoided. |
09c032d
to
e31e627
Compare
@rustbot modify labels: -S-waiting-on-author +S-waiting-on-review |
@bors r+ rollup |
📌 Commit e31e627 has been approved by |
…as-schievink Rollup of 10 pull requests Successful merges: - rust-lang#78086 (Improve doc for 'as _') - rust-lang#78853 (rustc_parse: fix ConstBlock expr span) - rust-lang#79234 (Resolve typedefs in HashMap gdb/lldb pretty-printers) - rust-lang#79344 (Convert UNC path to local path to satisfy install script on Windows) - rust-lang#79383 (Fix bold code formatting in keyword docs) - rust-lang#79460 (Remove intermediate vectors from `add_bounds`) - rust-lang#79474 (Change comments on types to doc-comments) - rust-lang#79476 (Sync rustc_codegen_cranelift) - rust-lang#79478 (Expand docs on Peekable::peek_mut) - rust-lang#79486 (Slightly improve code samples in E0591) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fix #78042.
@rustbot modify labels: A-coercions T-doc