diff --git a/src/lib.rs b/src/lib.rs index ed14184..edfe343 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -86,6 +86,11 @@ impl Mutex { // execution contexts (e.g. interrupts) unsafe impl Sync for Mutex where T: Send {} +/// In this test, the compiler will implicitly assign the produced reference's lifetime to cs +/// (consequently, it is checked that the caller provides a sufficiently long-lived cs). However, +/// the mutex itself is short-lived, and this tests that the &self does actually live as long as +/// the critical section (which here it does not, causing compilation failure): +/// /// ``` compile_fail /// fn bad(cs: bare_metal::CriticalSection) -> &u32 { /// let x = bare_metal::Mutex::new(42u32); @@ -94,4 +99,4 @@ unsafe impl Sync for Mutex where T: Send {} /// ``` #[allow(dead_code)] #[doc(hidden)] -const GH_6: () = (); +const DOCTEST_ANCHOR: () = ();