Skip to content

Commit

Permalink
Fix doctests
Browse files Browse the repository at this point in the history
Doctests have always been disabled in this repo. Add sufficient
annotations so that they pass and re-enable them.

As far as I can tell, the first `cell_extras` example is not
supposed to compile, demonstrating the soundness of the
extension trait. Perhaps this is why the tests were disabled.
It looks like the `compile_fail` annotation was stablized
in 2017 with rust 1.22.0.
  • Loading branch information
rillian committed May 15, 2024
1 parent 3de4cbe commit 1a6ea69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ edition = "2018"

[lib]
name = "kuchikiki"
doctest = false

[dependencies]
cssparser = "0.27"
Expand Down
6 changes: 5 additions & 1 deletion src/cell_extras.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
//! because it would involve running arbitrary code through `T::clone`
//! and provide that code with a reference to the inside of the cell.
//!
//! ```rust
//! ```rust,compile_fail
//! # use std::cell::Cell;
//! # use std::mem;
//! # use std::rc::Rc;
//! struct Evil(Box<u32>, Rc<Cell<Option<Evil>>>);
//! impl Clone for Evil {
//! fn clone(&self) -> Self {
Expand All @@ -41,6 +44,7 @@
//! would require temporarily replacing it with a default value:
//!
//! ```rust
//! # use std::cell::Cell;
//! fn option_dance<T, F, R>(cell: &Cell<T>, f: F) -> R
//! where T: Default, F: FnOnce(&mut T) -> R
//! {
Expand Down

0 comments on commit 1a6ea69

Please sign in to comment.