@@ -321,11 +321,9 @@ coupled to the loop that invoked it.
321
321
@item Direct interface to C code
322
322
323
323
Rust can load and call many C library functions simply by declaring
324
- them. Calling a C function statically marks a function as ``unsafe'', unless
325
- the task calling the unsafe function is further isolated within an external
326
- ``heavyweight'' operating-system subprocess. Every ``unsafe'' function or
327
- module in a Rust compilation unit must be explicitly authorized in the crate
328
- file.
324
+ them. Calling a C function is an ``unsafe'' action, and can only be taken
325
+ within a block marked with the @code {unsafe } keyword. Every unsafe block
326
+ in a Rust compilation unit must be explicitly authorized in the crate file.
329
327
330
328
@sp 1
331
329
@item Structural algebraic data types
@@ -684,7 +682,6 @@ The keywords are:
684
682
@tab @code {const }
685
683
@tab @code {thread }
686
684
@item @code {auth }
687
- @tab @code {impure }
688
685
@tab @code {unsafe }
689
686
@tab @code {self }
690
687
@item @code {bind }
@@ -1490,7 +1487,7 @@ operating-system processes.
1490
1487
@cindex Send expression
1491
1488
@cindex Receive expression
1492
1489
1493
- With the exception of @emph {unsafe } constructs , Rust tasks are isolated from
1490
+ With the exception of @emph {unsafe } blocks , Rust tasks are isolated from
1494
1491
interfering with one another's memory directly. Instead of manipulating shared
1495
1492
storage, Rust tasks communicate with one another using a typed, asynchronous,
1496
1493
simplex message-passing system.
@@ -1788,7 +1785,6 @@ fn main() @{
1788
1785
@c * Ref.Item.Fn:: Items defining functions.
1789
1786
@cindex Functions
1790
1787
@cindex Slots , function input and output
1791
- @cindex Effect of a function
1792
1788
@cindex Predicate
1793
1789
1794
1790
@@ -1809,10 +1805,6 @@ expression. If a control path lacks a @code{ret} expression in source code, an
1809
1805
implicit @code {ret } expression is appended to the end of the control path
1810
1806
during compilation, returning the implicit @code {() } value.
1811
1807
1812
- A function may have an @emph {effect }, which may be either @code {impure } or
1813
- @code {unsafe }. If no effect is specified, the function is said to be
1814
- @dfn {pure }.
1815
-
1816
1808
Any pure boolean function is also called a @emph {predicate }, and may be used
1817
1809
as part of the static typestate system. @xref {Ref.Typestate.Constr }.
1818
1810
@@ -2307,8 +2299,8 @@ by named reference to a @emph{tag item} declaration. @xref{Ref.Item.Tag}.
2307
2299
2308
2300
The function type-constructor @code {fn } forms new function types. A function
2309
2301
type consists of a sequence of input slots, an optional set of input
2310
- constraints (@pxref {Ref.Typestate.Constr }), an output slot, and an
2311
- @emph { effect } . @xref {Ref.Item.Fn }.
2302
+ constraints (@pxref {Ref.Typestate.Constr }) and an output
2303
+ slot . @xref {Ref.Item.Fn }.
2312
2304
2313
2305
An example of a @code {fn } type:
2314
2306
@example
@@ -2329,7 +2321,7 @@ x = bo(5,7);
2329
2321
2330
2322
The iterator type-constructor @code {iter } forms new iterator types. An
2331
2323
iterator type consists a sequence of input slots, an optional set of input
2332
- constraints, an output slot, and an @emph { effect } . @xref {Ref.Item.Iter }.
2324
+ constraints and an output slot. @xref {Ref.Item.Iter }.
2333
2325
2334
2326
An example of an @code {iter } type:
2335
2327
@example
@@ -2449,9 +2441,7 @@ that a variety of particular objects may conform to, by supporting a superset
2449
2441
of the methods.
2450
2442
2451
2443
An object type that can contain fields of a given layer must be declared as
2452
- residing in that layer (or lower), like any other type. And similarly a method
2453
- with a given effect must be declared as having that effect (or lower) in the
2454
- object type, like any other function.
2444
+ residing in that layer (or lower), like any other type.
2455
2445
2456
2446
An example of an object type with two separate object items supporting it, and
2457
2447
a client function using both items via the object type:
@@ -2460,17 +2450,17 @@ a client function using both items via the object type:
2460
2450
2461
2451
state type taker =
2462
2452
state obj @{
2463
- impure fn take(int);
2453
+ fn take(int);
2464
2454
@} ;
2465
2455
2466
2456
state obj adder(mutable int x) @{
2467
- impure fn take(int y) @{
2457
+ fn take(int y) @{
2468
2458
x += y;
2469
2459
@}
2470
2460
@}
2471
2461
2472
2462
obj sender(chan[int] c) @{
2473
- impure fn take(int z) @{
2463
+ fn take(int z) @{
2474
2464
c <| z;
2475
2465
@}
2476
2466
@}
@@ -3191,10 +3181,6 @@ by the runtime or emitted to a system console. Log expressions are enabled or
3191
3181
disabled dynamically at run-time on a per-task and per-item
3192
3182
basis. @xref {Ref.Run.Log }.
3193
3183
3194
- Executing a @code {log } expression is not considered an impure effect in the
3195
- effect system. In other words, a pure function remains pure even if it
3196
- contains a log expression.
3197
-
3198
3184
@example
3199
3185
@end example
3200
3186
0 commit comments