Commit Graph

2943 Commits

Author SHA1 Message Date
David Rheinsberg fdee1043ca type-layout: be more specific about 32-bit alignments
The rust-reference implies that 64-bit types are aligned to 32-bit for
platforms with 32-bit addresses. This is not necessarily correct. Fix
the wording.

Note that there is no general rule how data-types greater than the
native address size are aligned. On most Unix'y systems, they use the
native alignment of the platform. However, the Windows ABI aligns them
to their size (up to at least 64-bit).

There are advantages for either of those decisions. But we should at
least make clear that there is no fixed rule for 32-bit platforms.

Signed-off-by: David Rheinsberg <david@readahead.eu>
2023-08-11 10:11:43 +02:00
Joshua Liebow-Feeser e2385f92ec
Update type-layout.md 2023-08-10 21:57:09 -07:00
Joshua Liebow-Feeser 510e75c2a1
Specify bit validity and padding of some types
Specify the bit validity and padding of the primitive numeric 
types, bool, char, and pointer and reference types.

Closes #1291
2023-08-10 21:54:35 -07:00
Eric Huss f7e6f0445b
Merge pull request #1261 from lcnr/implied-bounds
add section about implied bounds
2023-08-10 20:48:56 +00:00
Eric Huss f24f128949 Small editorial nits.
compile_fail is a dangerous thing to use since it doesn't validate which
error is generated (it could be something like a typo).
2023-08-10 13:46:27 -07:00
lcnr 24d44b5d35 w 2023-08-10 13:45:47 -07:00
lcnr 6164b63b4a w 2023-08-10 13:45:47 -07:00
lcnr 62fb4e0bcf parameters 2023-08-10 13:45:47 -07:00
lcnr a707381666 Update src/trait-bounds.md
Co-authored-by: Ryan Scheel <Ryan.havvy@gmail.com>
2023-08-10 13:45:47 -07:00
lcnr c0c23b844e SPAAAAAAAAAAACE 2023-08-10 13:45:47 -07:00
lcnr 903009a82c review 2023-08-10 13:45:47 -07:00
lcnr f01e75f5f3 review 2023-08-10 13:45:47 -07:00
lcnr f193405edd add section about implied bounds 2023-08-10 13:45:47 -07:00
Eric Huss 2a8068eaca
Merge pull request #1307 from Lokathor/patch-1
Clearly specify the `instruction_set` effects
2023-08-01 16:07:09 +00:00
Eric Huss 9cd5c5a6cc
Merge pull request #1383 from ehuss/fix-queue
Fix merge queue building twice.
2023-07-29 22:29:51 +00:00
Eric Huss a64394d315
Merge pull request #1385 from ivanbakel/immutable-data-UB-clarification
Clarify UB around immutability & mutation
2023-07-27 20:57:06 +00:00
Isaac van Bakel f12eaec522
Style fixups in immutability UB
These changes should preserve the meaning of the contents.

Co-authored-by: Ralf Jung <post@ralfj.de>
2023-07-25 17:26:46 +02:00
Isaac van Bakel 70886e3c49
Define immutability UB in terms of bytes
This is part of the feedback on rust-lang/reference#1385.

Ralf made the point that the immutability definition could be restated
solely in terms of bytes, which has the added benefit of no longer
requiring the note on padding (since it's a natural consequence of the
byte version.)

The new wording for shared references also clarifies the case of mutable
references behind shared ones, and reintroduces some of the transitivity
property that I removed in my previous commit. The wording is separate
from that for immutable bindings, since those don't have transitive
immutability.

This also bumps the definition of bytes pointed to by references and
pointers into its own subsection, so that it can be linked to by the UB
definition, to avoid duplication.

Co-authored-by: Ralf Jung <post@ralfj.de>
2023-07-24 14:57:17 +02:00
Isaac van Bakel 69a6f705a2
Clarify UB around immutability & mutation
I personally found this description of UB confusing, since the use of
"reached" suggests that UB only happens for read bytes, and the
definition of immutability is not given, allowing for multiple
interpretations: does the "data" have to be immutable from the first
read? From the creation of the reference? Between reads from the
immutable accessor, but not otherwise? etc.

This clarifies the actual UB conditions, based on this Zulip
interaction:
https://rust-lang.zulipchat.com/#narrow/stream/136281-t-opsem/topic/What.20exactly.20are.20.22immutable.22.20and.20.22reached.22.20in.20shared.20ref.20UB.3F
and this reference discussion:
https://github.com/rust-lang/reference/issues/1227
in two ways:
  * The definition of "data" is clarified to be stated in terms of
    bytes, in a way that should avoid ambiguity about which bytes are
    considered. Based on the GH issue, this clarification should also
    allow for use of a `*mut` pointer through a shared reference, which
    is not in itself UB. Based on the Zulip issue, the definition
    includes padding bytes, which may be surprising.
  * The definition of immutability & mutation for a set of bytes is
    clarified to mean forbidding *all* non-0-byte writes.
2023-07-24 14:57:15 +02:00
Eric Huss e94fb3d5ba
Merge pull request #1273 from RalfJung/const-ub
mention the extra const UB
2023-07-20 16:26:35 +00:00
Eric Huss 5377523464
Merge pull request #1384 from mattheww/2023-07_divzero-b
Operator expressions: make the note about division by zero clearer.
2023-07-20 04:11:53 +00:00
Matthew Woodcraft 67f41530c5 Operator expressions: make the note about division by zero clearer. 2023-07-19 18:27:30 +01:00
Eric Huss fd8abed295
Merge pull request #1379 from gregschmit/gns/callee-to-caller-change
Make unsafe keyword docs less confusing
2023-07-19 14:46:03 +00:00
Greg Schmit 451a8e4542
Improve wording of unsafe proof obligations.
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-07-18 22:27:30 -05:00
Eric Huss a0ae62bf56 Fix merge queue building twice. 2023-07-18 14:12:20 -07:00
Eric Huss 6235897531
Merge pull request #1382 from mattheww/2023-07_divzero
Say that division by zero for primitive types panics
2023-07-18 21:11:11 +00:00
Matthew Woodcraft cf1cc8da68 Say that division by zero for primitive types panics 2023-07-17 21:20:03 +01:00
Eric Huss 5b7b38309c
Merge pull request #1381 from ehuss/merge_group
Add CI trigger for merge queues.
2023-07-16 20:12:46 +00:00
Eric Huss dad0240bc4 Add CI trigger for merge queues. 2023-07-16 11:43:38 -07:00
Gregory N. Schmit 3c3c084d03
Clarify which proof obligations are referenced.
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-07-11 09:56:10 -05:00
Eric Huss 1ea0178266
Merge pull request #1376 from hehaoqian/remove-unstable-of-never
Remove doc of unstable feature of never type
2023-07-08 15:11:07 -07:00
Eric Huss 1c231ad174
Merge pull request #1377 from macaujack/patch-2
Typo: 'assingee' to 'assignee' in expressions.md
2023-07-02 08:58:32 -07:00
macaujack 1da2af1481
Typo: 'assingee' to 'assignee' in expressions.md 2023-07-02 23:01:39 +08:00
hehaoqian 6eacdb0d85 Remove doc of unstable feature of never type 2023-07-01 22:58:29 +08:00
Eric Huss 15c26a1558
Merge pull request #1374 from tshepang/patch-2
str type: make sentence more readable
2023-06-29 12:18:49 -07:00
Tshepang Mbambo 0e2eee4d7e
str type: make sentence more readable 2023-06-28 13:20:10 +02:00
Lokathor 188499dd6d
Update codegen.md 2023-06-27 13:10:11 -06:00
Eric Huss 3b6313a214
Merge pull request #1367 from yjhn/patch-1
Remove obsolete note about soundness hole in type-layout.md
2023-06-26 20:09:50 -07:00
Eric Huss 353e03893c
Merge pull request #1371 from macaujack/patch-1
Typo: 'a' to 'an' in destructors.md
2023-06-26 09:51:55 -07:00
macaujack 193aa55275
Typo: 'a' to 'an' in destructors.md 2023-06-26 15:53:13 +08:00
Eric Huss 5ca365eac6
Merge pull request #1369 from riking/patch
Document the ordering behavior of crate cfgs
2023-06-22 10:13:08 -07:00
Eric Huss da57c4ac01
Merge pull request #1370 from Equilibris/fix-incorrect-type-path-syntax
fix incorrect syntax for type-paths
2023-06-22 10:10:20 -07:00
William Sørensen 2e85a35bec fix incorrect syntax for type-paths 2023-06-21 16:57:09 +02:00
Kane York 3319e0e1de Document the ordering behavior of crate cfgs
This was changed in rust-lang/rust#110141.
2023-06-20 14:29:11 -07:00
Andrius Pukšta 2dc423d693
remove space at the end of line 2023-06-15 16:24:19 +03:00
Andrius Pukšta cbbff21d04
Apply review suggestion 2023-06-15 16:21:08 +03:00
Andrius Pukšta 9eaa65a084
Remove note about soundness hole in type-layout.md
Issue https://github.com/rust-lang/rust/issues/27060 has been resolved, so it is no longer possible to safely create unaligned pointers to packed struct fields.
2023-06-14 08:49:57 +03:00
Eric Huss 862d6f4e71
Merge pull request #1366 from foresterre/fix
Fix inconsistent formatting of Disambiguating Function Calls example
2023-06-09 16:20:39 -07:00
Martijn Gribnau 9b4969786f Fix inconsistent formatting of Disambiguating Function Calls example 2023-06-09 00:34:06 +02:00
Eric Huss 5787c88504
Merge pull request #1357 from loongarch-rs/loongarch
Add LoongArch to inline-assembly documentation
2023-05-29 09:54:51 -07:00