Commit Graph

83 Commits

Author SHA1 Message Date
Waffle Lapkin
23b67de151 Document never type fallback in !'s docs 2024-04-26 20:49:34 +02:00
Chris Denton
89117f85e3
Use fake libc in core test 2024-04-15 17:50:49 +00:00
Trevor Gross
311ad55c32 Add primitive documentation for f16 and f128 2024-04-10 13:50:27 -04:00
Markus Reiter
14ed426eec
Use generic NonZero everywhere in core. 2024-02-22 15:17:33 +01:00
Matthias Krüger
3d7d709925
Rollup merge of #120880 - RalfJung:vtable-fnptr-partialeq, r=cuviper
add note on comparing vtables / function pointers

Fixes https://github.com/rust-lang/rust/issues/99388
Fixes https://github.com/rust-lang/rust/issues/117047
2024-02-11 23:19:09 +01:00
Ralf Jung
1383657a46 add note on comparing vtables / function pointers 2024-02-10 14:58:37 +01:00
Oli Scherer
a59a1e7c2c Remove some invalid cfg(doc) code 2024-02-05 10:17:35 +00:00
Dylan DPC
8017ea4016
Rollup merge of #116677 - joshlf:patch-11, r=RalfJung
References refer to allocated objects

Partially addresses https://github.com/rust-lang/unsafe-code-guidelines/issues/465
2024-01-29 12:56:51 +00:00
Joshua Liebow-Feeser
b867c7c707
Update primitive_docs.rs 2024-01-27 08:47:14 -08:00
Joshua Liebow-Feeser
c2c6e33335
Update primitive_docs.rs 2024-01-25 06:59:51 -08:00
Matthias Krüger
48ba7217c6
Rollup merge of #119907 - asquared31415:fn_trait_docs, r=Nilstrieb
Update `fn()` trait implementation docs

Fixes #119903

This was FCP'd and approved for the 1.70.0 release, this is just a docs update to match that change.
2024-01-19 08:15:04 +01:00
asquared31415
46ad13136c update fn pointer trait impl docs 2024-01-12 22:09:38 +00:00
asquared31415
51afc0922c
fix typo in fn() docs 2024-01-12 15:51:18 -05:00
Miguel Ojeda
dd928c8f75 Primitive docs: fix confusing Send in &T's list
The two lists in this document describe what traits are implemented on
references when their underlying `T` also implements them. However,
while it is true that `T: Send + Sync` implies `&T: Send` (which is
what the sentence is trying to explain), it is confusing to have `Send`
in the list because `T: Send` is not needed for that. In particular,
the "also require" part may be interpreted as "both `T: Send` and
`T: Sync` are required".

Instead, move `Send` back to where it was before commit 7a477869b7
("Makes docs for references a little less confusing"), i.e. to the `&mut`
list (where no extra nota is needed, i.e. it fits naturally) and move the
`Sync` definition/note to the bottom as something independent.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-12-29 22:26:23 +01:00
Ralf Jung
c7e3b3f84c do not allow ABI mismatches inside repr(C) types 2023-12-17 09:34:25 +01:00
bors
e299752868 Auto merge of #118032 - RalfJung:char-u32, r=Mark-Simulacrum
guarantee that char and u32 are ABI-compatible

In https://github.com/rust-lang/rust/pull/116894 we added a guarantee that `char` has the same alignment as `u32`, but there is still one axis where these types could differ: function call ABI. So let's nail that down as well: in a function signature, `char` and `u32` are completely equivalent.

This is a new stable guarantee, so it will need t-lang approval.
2023-12-11 04:13:19 +00:00
Maybe Waffle
1a3c5c40ca rustdoc: Remove space from fake-variadic fn ptr impls
before: `for fn (T₁, T₂, …, Tₙ) -> Ret`
after: `for fn(T₁, T₂, …, Tₙ) -> Ret`
2023-11-26 15:01:42 +00:00
Ralf Jung
b4f3f2aeac guarantee that char and u32 are ABI-compatible 2023-11-18 08:24:02 +01:00
Matthias Krüger
1cabedc256
Rollup merge of #115476 - RalfJung:abi-compat-docs, r=Mark-Simulacrum
document ABI compatibility

I don't think we have any central place where we document our ABI compatibility rules, so let's create one. The `fn()` pointer type seems like a good place since ABI questions can only become relevant when invoking a function through a function pointer.

This will likely need T-lang FCP.
2023-11-17 08:10:26 +01:00
Ralf Jung
8f03a55566 linking in general has more pitfalls than just call ABI 2023-11-17 08:02:28 +01:00
Ralf Jung
52d22eaa23 clarify ABI compatibility of fn ptr types and ptr types
and add an and
2023-11-11 13:36:02 +01:00
Ralf Jung
044d05769b add 'import functions' to the list of situations where ABI compatibility comes up 2023-11-10 20:33:19 +01:00
Matthias Krüger
1ee5e12710
Rollup merge of #117534 - RalfJung:str, r=Mark-Simulacrum
clarify that the str invariant is a safety, not validity, invariant

Updates these docs to match https://github.com/rust-lang/reference/pull/792
2023-11-04 21:38:29 +01:00
Matthias Krüger
805a56fc28
Rollup merge of #116894 - joshlf:patch-12, r=RalfJung
Guarantee that `char` has the same size and alignment as `u32`
2023-11-04 21:38:28 +01:00
Ralf Jung
0550ba5f77 avoid acronyms when we don't really need them 2023-11-04 12:24:09 +01:00
Ralf Jung
281d8cc4ae document ABI compatibility 2023-11-04 11:22:17 +01:00
Joshua Liebow-Feeser
1a0309afb6
Update primitive_docs.rs 2023-11-03 06:41:23 -07:00
Ralf Jung
57f570bb33 clarify that the str invariant is a safety, not validity, invariant 2023-11-03 07:23:24 +01:00
Oli Scherer
4512f211ae Accept less invalid Rust in rustdoc 2023-10-31 13:58:03 +00:00
Joshua Liebow-Feeser
c278bc1f81
Update library/core/src/primitive_docs.rs
Co-authored-by: scottmcm <scottmcm@users.noreply.github.com>
2023-10-25 08:26:07 -07:00
Joshua Liebow-Feeser
3fea7cc7da
Guarantee that char has the same size and alignment as u32 2023-10-18 09:14:31 -07:00
Joshua Liebow-Feeser
55487e235b
Update primitive_docs.rs 2023-10-13 09:49:23 -07:00
Joshua Liebow-Feeser
39660c4a77
Update library/core/src/primitive_docs.rs
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-10-13 09:47:39 -07:00
Joshua Liebow-Feeser
4f0192a756
Update primitive_docs.rs 2023-10-12 18:55:45 -07:00
Joshua Liebow-Feeser
a20866254c
References refer to allocated objects 2023-10-12 15:35:03 -07:00
Orson Peters
07e96314ec Clarify float rounding direction for signed zero 2023-10-02 22:05:17 +02:00
Ralf Jung
7b7caae30e get rid of duplicate primitive_docs 2023-09-18 08:17:36 +02:00
Meng Xiangzhuo
57fccf9e5b fix std::primitive doc: homogenous -> homogeneous 2023-08-29 06:23:34 +08:00
许杰友 Jieyou Xu (Joe)
72b3b58efc
Extend unused_must_use to cover block exprs 2023-06-15 17:59:13 +08:00
bors
ea0c22ea4f Auto merge of #106621 - ozkanonur:enable-elided-lifetimes-for-doctests, 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-08 04:50:28 +00:00
ozkanonur
4e7c14fe9f enable rust_2018_idioms for doctests
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-05-07 00:12:29 +03:00
Maybe Waffle
de105164ea Mention array<->tuple convs in docs 2023-05-03 20:34:47 +00:00
Pietro Albini
a7bb8c7851 handle cfg(bootstrap) 2023-04-28 08:47:55 -07:00
KaDiWa
ad2b34d0e3
remove some unneeded imports 2023-04-12 19:27:18 +02:00
Maybe Waffle
5f50c0f7ac Document that &T and &mut T are Sync if T is 2023-04-07 18:36:48 +00:00
Guillaume Gomez
364e961417 Replace doc(primitive) with rustc_doc_primitive 2023-03-30 22:56:52 +02:00
gimbles
e5a5b90afc unequal → not equal 2023-03-15 23:55:48 +05:30
Coca162
22b65fc275
Clarify that Copy is a trait in array docs 2023-02-27 15:16:39 +00:00
Coca162
dc9732620d
Update docs to show [expr; N] can repeat const expr 2023-02-27 13:51:10 +00:00
Ralf Jung
3a95e12c9b disable strict-provenance-violating doctests in Miri 2022-11-22 11:49:02 +01:00