Skip to content

Commit 74b45d5

Browse files
committed
Adding marker trait definition to the glossary
1 parent a19bc1e commit 74b45d5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/concurrency.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ r[concurrency.send-and-sync]
1212
r[concurrency.send-and-sync.intro]
1313
The [`Send`] and [`Sync`] traits are [unsafe traits] used by the Rust type system to track which types can be safely used across thread boundaries.
1414

15-
These traits are marker traits with no methods. Implementing them asserts that a type has the intrinsic properties required for safe concurrent use. The compiler automatically implements these traits for most types when possible, but they can also be implemented manually. Providing an incorrect manual implementation can cause [undefined behavior].
15+
These traits are [marker traits] with no methods. Implementing them asserts that a type has the intrinsic properties required for safe concurrent use. The compiler automatically implements these traits for most types when possible, but they can also be implemented manually. Providing an incorrect manual implementation can cause [undefined behavior].
1616

1717
[concurrent programs]: glossary.md#concurrent-program
1818
[data races]: glossary.md#data-race
1919
[`Send`]: special-types-and-traits.md#Send
2020
[`Sync`]: special-types-and-traits.md#Sync
2121
[unsafe traits]: items/traits.md#unsafe-traits
22-
[undefined behavior]: glossary.md#undefined_behavior
22+
[marker traits]: glossary.md#marker-trait
23+
[undefined behavior]: glossary.md#undefined-behavior

src/glossary.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ This is not affected by applied type arguments. `struct Foo` is considered local
145145
`Vec<Foo>` is not. `LocalType<ForeignType>` is local. Type aliases do not
146146
affect locality.
147147

148+
### Marker trait
149+
A trait that has no associated items (no methods, no associated types, and no constants)
150+
and is used only to mark that a type has a particular property.
151+
Implementing a marker trait does not change a type’s behavior at runtime;
152+
it simply communicates to the compiler and to other code that the type satisfies some condition.
153+
148154
### Module
149155

150156
A module is a container for zero or more [items]. Modules are organized in a

0 commit comments

Comments
 (0)