about summary refs log tree commit diff
path: root/library/std/src/primitive_docs.rs
AgeCommit message (Collapse)AuthorLines
2023-09-18get rid of duplicate primitive_docsRalf Jung-1593/+0
2023-08-29fix std::primitive doc: homogenous -> homogeneousMeng Xiangzhuo-3/+3
2023-06-15Extend `unused_must_use` to cover block exprs许杰友 Jieyou Xu (Joe)-1/+1
2023-05-08Auto merge of #106621 - ozkanonur:enable-elided-lifetimes-for-doctests, ↵bors-0/+1
r=Mark-Simulacrum enable `rust_2018_idioms` lint group for doctests With this change, `rust_2018_idioms` lint group will be enabled for compiler/libstd doctests. Resolves #106086 Resolves #99144 Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-05-07enable `rust_2018_idioms` for doctestsozkanonur-0/+1
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-05-03Mention array<->tuple convs in docsMaybe Waffle-0/+20
2023-04-28handle cfg(bootstrap)Pietro Albini-50/+25
2023-04-12remove some unneeded importsKaDiWa-6/+0
2023-04-07Document that `&T` and `&mut T` are `Sync` if `T` isMaybe Waffle-0/+1
2023-03-30Replace doc(primitive) with rustc_doc_primitiveGuillaume Gomez-25/+50
2023-03-15unequal → not equalgimbles-1/+1
2023-02-27Clarify that Copy is a trait in array docsCoca162-1/+1
2023-02-27Update docs to show [expr; N] can repeat const exprCoca162-2/+4
2022-11-22disable strict-provenance-violating doctests in MiriRalf Jung-0/+2
2022-09-10array docs - advertise how to get array from sliceDoug Cook (WINDOWS)-1/+22
On my first Rust project, I spent more time than I care to admit figuring out how to efficiently get an array from a slice. Update the array documentation to explain this a bit more clearly. (As a side note, it's a bit unfortunate that get-array-from-slice is only available via trait since that means it can't be used from const functions yet.)
2022-08-26Add the syntax of references to their documentation summary.Kevin Reid-1/+1
Without this change, in <https://doc.rust-lang.org/1.63.0/std/#primitives>, `reference` is the only entry in that list which does not contain the syntax by which the type is named in source code. With this change, it contains them, in roughly the same way as the `pointer` entry does.
2022-08-20Improve primitive/std docs separation and headersCameron Steffen-8/+53
2022-08-12Adjust cfgsMark Rousskov-5/+4
2022-07-19Improve the function pointer docsMichael Howell-10/+50
* Reduce duplicate impls; show only the `fn (T)` and include a sentence saying that there exists up to twelve of them. * Show `Copy` and `Clone`. * Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.
2022-07-17rustdoc: extend `#[doc(tuple_variadic)]` to fn pointersMichael Howell-2/+2
The attribute is also renamed `fake_variadic`.
2022-07-01update cfg(bootstrap)sPietro Albini-2/+2
2022-06-14rustdoc: change "variadic tuple" notation to look less like real syntaxMichael Howell-4/+4
2022-06-11Update library/std/src/primitive_docs.rsMichael Howell-1/+1
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
2022-06-11Add test case for #trait-implementations-1 linkMichael Howell-0/+2
2022-06-11Re-add explicit list of traits to tuple docs, with limit notesMichael Howell-5/+34
2022-06-11Use relative path for addressing things in rust-lang/rustMichael Howell-2/+2
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
2022-06-11Fix incorrectly spelled "variadic"Michael Howell-2/+2
2022-06-08Fix bootstrap attrMichael Howell-2/+2
2022-06-08rustdoc: fixed messed-up rustdoc auto trait implsMichael Howell-1/+1
Before: impl<T, U> UnwindSafe for (T, ...) where T: UnwindSafe, U: UnwindSafe, After: impl<T> UnwindSafe for (T, ...) where T: UnwindSafe,
2022-06-08rustdoc: show tuple impls as `impl Trait for (T, ...)`Michael Howell-18/+7
This commit adds a new unstable attribute, `#[doc(tuple_varadic)]`, that shows a 1-tuple as `(T, ...)` instead of just `(T,)`, and links to a section in the tuple primitive docs that talks about these.
2022-06-07docs: show Clone and Copy on () doc pagesMichael Howell-0/+34
2022-06-07rustdoc: show auto/blanket docs for tuple and unitMichael Howell-0/+10
2022-05-24Rollup merge of #97321 - RalfJung:int-to-fnptr, r=Dylan-DPCDylan DPC-0/+26
explain how to turn integers into fn ptrs (with an intermediate raw ptr, not a direct transmute) Direct int2ptr transmute, under the semantics I am imagining, will produce a ptr with "invalid" provenance that is invalid to deref or call. We cannot give it the same semantics as int2ptr casts since those do [something complicated](https://www.ralfj.de/blog/2022/04/11/provenance-exposed.html). To my great surprise, that is already what the example in the `transmute` docs does. :) I still added a comment to say that that part is important, and I added a section explicitly talking about this to the `fn()` type docs. With https://github.com/rust-lang/miri/pull/2151, Miri will start complaining about direct int-to-fnptr transmutes (in the sense that it is UB to call the resulting pointer).
2022-05-23sync primitive_docsRalf Jung-0/+26
2022-05-23Rollup merge of #96129 - mattheww:2022-04_float_rounding, r=Dylan-DPCDylan DPC-0/+13
Document rounding for floating-point primitive operations and string parsing The docs for floating point don't have much to say at present about either the precision of their results or rounding behaviour. As I understand it[^1][^2], Rust doesn't support operating with non-default rounding directions, so we need only describe roundTiesToEven. [^1]: https://github.com/rust-lang/rust/issues/41753#issuecomment-299322887 [^2]: https://github.com/llvm/llvm-project/issues/8472#issuecomment-980888781 This PR makes a start by documenting that for primitive operations and `from_str()`.
2022-04-16Document rounding for floating-point primitive operationsMatthew Woodcraft-0/+13
State that the four primitive operations honour IEEE 754 roundTiesToEven. Documenting under "Primitive Type f32"; f64 refers to that.
2022-03-31match std f32 primitive docs to core f32 primitive docsPyry Kontio-2/+3
2022-03-31Improve wording of "NaN as a special value" top level explanationPyry Kontio-4/+5
2022-03-31Improve floating point documentation:Pyry Kontio-4/+14
- Refine the "NaN as a special value" top level explanation of f32 - Refine `const NAN` docstring. - Refine `fn is_sign_positive` and `fn is_sign_negative` docstrings. - Refine `fn min` and `fn max` docstrings. - Refine `fn trunc` docstrings. - Refine `fn powi` docstrings. - Refine `fn copysign` docstrings. - Reword `NaN` and `NAN` as plain "NaN", unless they refer to the specific `const NAN`. - Reword "a number" to `self` in function docstrings to clarify. - Remove "Returns NAN if the number is NAN" as this is told to be the default behavior in the top explanation. - Remove "propagating NaNs", as full propagation (preservation of payloads) is not guaranteed.
2022-03-10Use implicit capture syntax in format_argsT-O-R-U-S-10/+10
This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored).
2022-02-01Fix annotation of code blocksGeorge Bateman-2/+3
2022-01-31(#93493) Add items from code reviewGeorge Bateman-15/+35
2022-01-30Document char validityGeorge Bateman-5/+33
2021-12-04Update docs.Mara Bos-2/+1
2021-11-19Remove unnecessary doc linksMaybe Waffle-2/+0
2021-10-10Update library/std/src/primitive_docs.rsWaffle Lapkin-1/+1
Co-authored-by: fmease <liehr.exchange@gmx.net>
2021-10-10Makes docs for references a little less confusingWaffle Lapkin-5/+5
- Make clear that the `Pointer` trait is related to formatting - Make clear that `&T` (shared reference) implements `Send` (if `T: Send + Sync`)
2021-09-12Add primitive documentation to libcoreJoshua Nelson-21/+25
This works by doing two things: - Adding links that are specific to the crate. Since not all primitive items are defined in `core` (due to lang_items), these need to use relative links and not intra-doc links. - Duplicating `primitive_docs` in both core and std. This allows not needing CARGO_PKG_NAME to build the standard library. It also adds a tidy check to make sure they stay the same.
2021-09-08Bump stage0 compiler to 1.56Mark Rousskov-2/+1
2021-09-08Rollup merge of #88594 - steffahn:more_symbolic_doc_aliases, r=joshtriplettJack Huey-2/+5
More symbolic doc aliases A bunch of small changes, mostly adding `#[doc(alias = "…")]` entries for symbolic `"…"`. Also a small change in documentation of `const` keywords.