Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: pin-init: re-enable doctests

The pin-init crate is now compiled in a standalone fashion, so revert
the earlier commit that disabled the doctests in pin-init in order to
avoid build errors while transitioning the crate into a standalone
version.

Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Fiona Behrens <me@kloenk.dev>
Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Tested-by: Andreas Hindborg <a.hindborg@kernel.org>
Link: https://lore.kernel.org/r/20250308110339.2997091-22-benno.lossin@proton.me
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Benno Lossin and committed by
Miguel Ojeda
1ab10101 2e5f4f3c

+27 -27
+27 -27
rust/pin-init/src/lib.rs
··· 63 63 //! [`pin_init!`]. The syntax is almost the same as normal `struct` initializers. The difference is 64 64 //! that you need to write `<-` instead of `:` for fields that you want to initialize in-place. 65 65 //! 66 - //! ```rust,ignore 66 + //! ```rust 67 67 //! # #![expect(clippy::disallowed_names)] 68 68 //! # #![feature(allocator_api)] 69 69 //! # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*; ··· 87 87 //! `foo` now is of the type [`impl PinInit<Foo>`]. We can now use any smart pointer that we like 88 88 //! (or just the stack) to actually initialize a `Foo`: 89 89 //! 90 - //! ```rust,ignore 90 + //! ```rust 91 91 //! # #![expect(clippy::disallowed_names)] 92 92 //! # #![feature(allocator_api)] 93 93 //! # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*; ··· 115 115 //! Many types that use this library supply a function/macro that returns an initializer, because 116 116 //! the above method only works for types where you can access the fields. 117 117 //! 118 - //! ```rust,ignore 118 + //! ```rust 119 119 //! # #![feature(allocator_api)] 120 120 //! # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*; 121 121 //! # use pin_init::*; ··· 126 126 //! 127 127 //! To declare an init macro/function you just return an [`impl PinInit<T, E>`]: 128 128 //! 129 - //! ```rust,ignore 129 + //! ```rust 130 130 //! # #![feature(allocator_api)] 131 131 //! # use pin_init::*; 132 132 //! # #[path = "../examples/error.rs"] mod error; use error::Error; ··· 162 162 //! - you may assume that `slot` will stay pinned even after the closure returns until `drop` of 163 163 //! `slot` gets called. 164 164 //! 165 - //! ```rust,ignore 165 + //! ```rust 166 166 //! # #![feature(extern_types)] 167 167 //! use pin_init::{pin_data, pinned_drop, PinInit, PinnedDrop, pin_init_from_closure}; 168 168 //! use core::{ ··· 306 306 /// 307 307 /// # Examples 308 308 /// 309 - /// ```ignore 309 + /// ``` 310 310 /// # #![feature(allocator_api)] 311 311 /// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*; 312 312 /// use pin_init::pin_data; ··· 323 323 /// } 324 324 /// ``` 325 325 /// 326 - /// ```ignore 326 + /// ``` 327 327 /// # #![feature(allocator_api)] 328 328 /// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*; 329 329 /// # mod bindings { pub struct info; pub unsafe fn destroy_info(_: *mut info) {} } ··· 357 357 /// 358 358 /// # Examples 359 359 /// 360 - /// ```ignore 360 + /// ``` 361 361 /// # #![feature(allocator_api)] 362 362 /// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*; 363 363 /// # mod bindings { pub struct info; pub unsafe fn destroy_info(_: *mut info) {} } ··· 391 391 /// 392 392 /// # Examples 393 393 /// 394 - /// ```ignore 394 + /// ``` 395 395 /// use pin_init::Zeroable; 396 396 /// 397 397 /// #[derive(Zeroable)] ··· 407 407 /// 408 408 /// # Examples 409 409 /// 410 - /// ```rust,ignore 410 + /// ```rust 411 411 /// # #![expect(clippy::disallowed_names)] 412 412 /// # #![feature(allocator_api)] 413 413 /// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*; ··· 459 459 /// 460 460 /// # Examples 461 461 /// 462 - /// ```rust,ignore 462 + /// ```rust 463 463 /// # #![expect(clippy::disallowed_names)] 464 464 /// # #![feature(allocator_api)] 465 465 /// # #[path = "../examples/error.rs"] mod error; use error::Error; ··· 486 486 /// println!("a: {}", &*foo.a.lock()); 487 487 /// ``` 488 488 /// 489 - /// ```rust,ignore 489 + /// ```rust 490 490 /// # #![expect(clippy::disallowed_names)] 491 491 /// # #![feature(allocator_api)] 492 492 /// # #[path = "../examples/error.rs"] mod error; use error::Error; ··· 539 539 /// 540 540 /// The syntax is almost identical to that of a normal `struct` initializer: 541 541 /// 542 - /// ```rust,ignore 542 + /// ```rust 543 543 /// # use pin_init::*; 544 544 /// # use core::pin::Pin; 545 545 /// #[pin_data] ··· 583 583 /// 584 584 /// To create an initializer function, simply declare it like this: 585 585 /// 586 - /// ```rust,ignore 586 + /// ```rust 587 587 /// # use pin_init::*; 588 588 /// # use core::pin::Pin; 589 589 /// # #[pin_data] ··· 609 609 /// 610 610 /// Users of `Foo` can now create it like this: 611 611 /// 612 - /// ```rust,ignore 612 + /// ```rust 613 613 /// # #![expect(clippy::disallowed_names)] 614 614 /// # use pin_init::*; 615 615 /// # use core::pin::Pin; ··· 637 637 /// 638 638 /// They can also easily embed it into their own `struct`s: 639 639 /// 640 - /// ```rust,ignore 640 + /// ```rust 641 641 /// # use pin_init::*; 642 642 /// # use core::pin::Pin; 643 643 /// # #[pin_data] ··· 696 696 /// 697 697 /// For instance: 698 698 /// 699 - /// ```rust,ignore 699 + /// ```rust 700 700 /// # use pin_init::*; 701 701 /// # use core::{ptr::addr_of_mut, marker::PhantomPinned}; 702 702 /// #[pin_data] ··· 750 750 /// 751 751 /// # Examples 752 752 /// 753 - /// ```rust,ignore 753 + /// ```rust 754 754 /// # #![feature(allocator_api)] 755 755 /// # #[path = "../examples/error.rs"] mod error; use error::Error; 756 756 /// use pin_init::{pin_data, try_pin_init, PinInit, InPlaceInit, zeroed}; ··· 857 857 /// 858 858 /// # Examples 859 859 /// 860 - /// ```rust,ignore 860 + /// ```rust 861 861 /// # #![feature(allocator_api)] 862 862 /// # use core::alloc::AllocError; 863 863 /// # use pin_init::InPlaceInit; ··· 904 904 /// # Example 905 905 /// 906 906 /// This will succeed: 907 - /// ```ignore 907 + /// ``` 908 908 /// use pin_init::{pin_data, assert_pinned}; 909 909 /// 910 910 /// #[pin_data] ··· 917 917 /// ``` 918 918 /// 919 919 /// This will fail: 920 - /// ```compile_fail,ignore 920 + /// ```compile_fail 921 921 /// use pin_init::{pin_data, assert_pinned}; 922 922 /// 923 923 /// #[pin_data] ··· 931 931 /// Some uses of the macro may trigger the `can't use generic parameters from outer item` error. To 932 932 /// work around this, you may pass the `inline` parameter to the macro. The `inline` parameter can 933 933 /// only be used when the macro is invoked from a function body. 934 - /// ```ignore 934 + /// ``` 935 935 /// # use core::pin::Pin; 936 936 /// use pin_init::{pin_data, assert_pinned}; 937 937 /// ··· 1018 1018 /// 1019 1019 /// # Examples 1020 1020 /// 1021 - /// ```rust,ignore 1021 + /// ```rust 1022 1022 /// # #![feature(allocator_api)] 1023 1023 /// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*; 1024 1024 /// # use pin_init::*; ··· 1116 1116 /// 1117 1117 /// # Examples 1118 1118 /// 1119 - /// ```rust,ignore 1119 + /// ```rust 1120 1120 /// # #![expect(clippy::disallowed_names)] 1121 1121 /// use pin_init::{init, zeroed, Init}; 1122 1122 /// ··· 1229 1229 /// 1230 1230 /// # Examples 1231 1231 /// 1232 - /// ```rust,ignore 1232 + /// ```rust 1233 1233 /// # use pin_init::*; 1234 1234 /// use pin_init::init_array_from_fn; 1235 1235 /// let array: Box<[usize; 1_000]> = Box::init(init_array_from_fn(|i| i)).unwrap(); ··· 1267 1267 /// 1268 1268 /// # Examples 1269 1269 /// 1270 - /// ```rust,ignore 1270 + /// ```rust 1271 1271 /// # #![feature(allocator_api)] 1272 1272 /// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*; 1273 1273 /// # use pin_init::*; ··· 1343 1343 /// 1344 1344 /// Use [`pinned_drop`] to implement this trait safely: 1345 1345 /// 1346 - /// ```rust,ignore 1346 + /// ```rust 1347 1347 /// # #![feature(allocator_api)] 1348 1348 /// # #[path = "../examples/mutex.rs"] mod mutex; use mutex::*; 1349 1349 /// # use pin_init::*;