Skip to content

Commit dc7de37

Browse files
committed
Explain the _oibit_remover field
1 parent 787f9f4 commit dc7de37

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: src/libcore/fmt/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,13 @@ pub struct Formatter<'a> {
261261

262262
struct Void {
263263
_priv: (),
264+
/// Erases all oibits, because `Void` erases the type of the object that
265+
/// will be used to produce formatted output. Since we do not know what
266+
/// oibits the real types have (and they can have any or none), we need to
267+
/// take the most conservative approach and forbid all oibits.
268+
///
269+
/// It was added after #45197 showed that one could share a `!Sync`
270+
/// object across threads by passing it into `format_args!`.
264271
_oibit_remover: PhantomData<*mut Fn()>,
265272
}
266273

0 commit comments

Comments
 (0)