Skip to content

Commit 0210bd8

Browse files
committed
remove talk of safety invariant
1 parent 700a362 commit 0210bd8

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

active_discussion/representation.md

+3-15
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ This discussion is meant to focus on two things:
77
- What guarantees does Rust make regarding the layout of data structures?
88
- What invariants does the compiler require from the various Rust types?
99
- the "validity invariant", as defined in [Ralf's blog post][bp]
10-
- What invariants can safe code expect to hold for the various Rust types?
11-
- the "safety invariant", as defined in [Ralf's blog post][bp]
10+
11+
NB. The discussion is **not** meant to discuss the "safety invariant"
12+
from [Ralf's blog post][bp], as that can be handled later.
1213

1314
[bp]: https://www.ralfj.de/blog/2018/08/22/two-kinds-of-invariants.html
1415

@@ -43,23 +44,10 @@ invariant, however, so as to leave room for future optimization.
4344
As an example, a value of `&T` type can never be null -- therefore,
4445
`Option<&T>` can use null to represent `None`.
4546

46-
### Safety invariant
47-
48-
The "safety invariant" for each type defines what must hold whenever
49-
safe code has access to a type.
50-
51-
This invariant must **at minimum** justify all the things that our
52-
type system allows without an `unsafe` keyword being required.
53-
54-
For example, a value of `&T` must be dereferencable, since safe code
55-
could always choose to dereference it.
56-
5747
## Goals
5848

5949
- Define what we guarantee about the layout of various types
6050
and the effect of `#[repr]` annotations.
61-
- Define the **safety requirements** of various types that safe
62-
code requires (and which unsafe code must uphold at the safe/unsafe boundary).
6351
- Define the **validity requirements** of various types that unsafe
6452
programmers must uphold at all times.
6553
- Also examine when/how we could dynamically check these requirements.

0 commit comments

Comments
 (0)