#GhostCell
phrases you can say in a rustlang paper or as part of a necromantic ritual
August 25, 2026 at 12:46 AM
July 3, 2026 at 5:45 AM
the crate that implements the paper actually uses this cursed thing to constrain the lifetime of GhostCell without holding a direct reference
May 11, 2025 at 7:31 AM
📣 [ARTISTES] 🌸✏️
Il est l'heure pour nous de vous annoncer les noms des premiers stands Artistes sélectionnés pour notre Matsuri 2026 !
Nous faisons, cette année encore, le plein d'artistes talentueux : KYUMELLY, GHOSTCELL, AKAYASU, BERKTAHO

🎟️ Billetterie ouverte : www.helloasso.com/associations...
May 8, 2026 at 9:23 AM
Hell in Rust you can do Ghost of Departed Proofs via Higher Rank Lifetimes this is what GhostCell does...
so you could probably combine this with const generics for a similar structure
February 23, 2024 at 7:53 AM
My 4th attack for this year!
Absolutely gorgeous character!
Could not hold back drawing this lovely chaster!

Character belongs to:
artfight.net/~GHOSTCELL
July 2, 2026 at 11:22 PM
You can actually do better using a branded type as per GhostCell but imo it’s not usually worth it
May 8, 2025 at 4:17 PM
Here are three new science fiction novels to add to your TBR, from the Locus Magazine mailbox.

#AGuardianandaThief #GhostCell #VolatileMemory

@MeghaMaj
@scribnerbooks
@torbooks
#ZacTopping
@torbooks
@sethhaddon

linktr.ee/locusmagazine
September 28, 2025 at 4:39 PM
FnOnce lifetime error in my attempt to make an unborrowable RefCell
Below is the same solution as @kpreid, just different words. So I'll put the unique part here at the top, even though it may not matter to you. One can borrow as many `Stuff`s as they want with a single piece of `Gold`, so long as it's one at a time. One can reborrow the same `Stuff` in the closure. There's also no way in the OP to pair a particular `Stuff` with a particular `Gold`. How much any of this matters, I can't tell from the OP. You may be interested in `GhostCell` and the branded types discussion in the paper. * * * Here starts the "same solution" portion of my reply. First, you have an unnecessary `&mut _` here for some reason: *self = cell.borrow_mut(&mut gold); That's creating a temporary `&mut &mut Gold` which can't outlive the function body (because `gold` goes out of scope at the end of the function body if not moved), and reborrowing through the temporary. This makes it impossible to get back a long enough lifetime for the assignment to `*self`. Let's just fix that first to avoid problems later. - *self = cell.borrow_mut(&mut gold); + *self = cell.borrow_mut(gold); Now you're moving `gold` in the call to `borrow_mut`,[1] instead of trying to reborrow through a temporary `&mut &mut Gold`. Playground, which still errors for other reasons. beholdnec: > It seems to think the gold is still held by the closure, but that isn't my intention. Neither the closure nor its result value should hold a reference to the gold after the closure has completed execution. Here's where we're at now: let result = f(gold); // same as: f(&mut *gold); *self = cell.borrow_mut(gold); You need to first reborrow the `Gold` (`*gold`) for some lifetime that expires by the time `f` returns, or else you can't move `gold`2] in the call to `cell.borrow_mut`. But the generic parameters of functions are chosen by the caller, and the caller here is free to choose any lifetime less than or equal to `'a` -- including `'a`.[[3] Which means the function body must assume the reborrow is valid for as long as the original `&'a mut Gold` was valid. Which is longer than the function body. Which means you can't use `gold` again after calling `f(gold)`. You want the function body to "choose" (infer) the lifetime of the reborrow, not the caller. The only way to convey that in the bound is to require the closure `F` to accept any `&mut Gold` (with any lifetime), not just a `&'b mut Gold` with a lifetime `'b` of their choosing. We type that like so: fn unborrow_then<F, T>(&mut self, f: F) -> T where F: for<'b> FnOnce(&'b mut Gold) -> T Or with elision fn unborrow_then<F, T>(&mut self, f: F) -> T where F: FnOnce(&mut Gold) -> T And now when you call `f(&mut *gold)`, you can pass in a reborrowed `&mut Gold` with a lifetime that ends immediately after the call, which allows `gold` to be usable on the next line. Compiling playground. * * * 1. or perhaps technically reborrowing `*gold` for the same lifetime, but they amount to the same thing ↩︎ 2. or reborrow `*gold` ↩︎ 3. There's actually a lower bound -- they can't choose a lifetime shorter than the function body. ↩︎
users.rust-lang.org
April 7, 2025 at 1:45 AM
Big special shoutout to ghostcell on instagram who made me a microscope slide comission of my oc Iris (the girl from intestine and test2) its so lovelyyy 🫶

#epitanime #artistalley #comissionedartwork
June 13, 2026 at 8:18 PM
すご、scope をグラフライブラリに使うんだ

> #rustlang すべてのタグに強い型がついていて、use-after-freeを静的検査できるグラフライブラリをつくりました!
> 名前はGhostCell Graphを短くしたのが由来です。
> https://crates.io/crates/gotgraph

https://x.com/yasuo_ozu/status/1975175441284821184
October 6, 2025 at 2:32 PM
[Discussion] Inversion of Control Ergonomics for Linear and Branded Types
djc: > Why not? (Not completely sure what you mean by "branded types".) Branded types are a design pattern described in the GhostCell paper I linked that can be used to implement singletons. A naive implementation of singletons in Rust might look like: pub struct Singleton<'s> { _marker: PhantomInvariantLifetime<'s>, } impl<'s> Singleton<'s> { pub fn new() -> Self { Self { _marker: PhantomInvariantLifetime::new() } } } However, a user could then write let x = Singleton::<'static>::new(); let y = Singleton::<'static>::new(); which would break the singleton invariant. (Even without the turbofish, the compiler could decide that `x` and `y` have the same type due to how unbounded lifetimes work.) We can fix our singleton by replacing the new method with the following: pub fn new<R, F: for<'s> FnOnce(Singleton<'s>) -> R>(closure: F) -> R { closure(Self { _marker: PhantomInvariantLifetime::new() }) } Now, in the context of the user-provided closure, the compiler can assume nothing about the lifetime of the input singleton. From the user's perspective, no two singletons can ever have the same lifetime. (This is actually proven formally in the GhostCell paper!) This design pattern of using an invariant marker lifetime combined with a constructor that executes a closure that is generic over said lifetime is the branded type pattern. djc: > This is the blog of a prominent lang-team member, so I think there's a decent chance something like it will eventually be accepted. Oh, I probably should have checked whose blog that was lol
internals.rust-lang.org
November 19, 2025 at 1:56 AM
[Discussion] Inversion of Control Ergonomics for Linear and Branded Types
djc: > Why not? (Not completely sure what you mean by "branded types".) Branded types are a design pattern described in the GhostCell paper I linked that can be used to implement singletons. A naive implementation of singletons in Rust might look like: pub struct Singleton<'s> { _marker: PhantomInvariantLifetime<'s>, } impl<'s> Singleton<'s> { pub fn new() -> Self { Self { _marker: PhantomInvariantLifetime::new() } } } However, a user could then write let x = Singleton::<'static>::new(); let y = Singleton::<'static>::new(); which would break the singleton invariant. (Even without the turbofish, the compiler could decide that `x` and `y` have the same type due to how unbounded lifetimes work.) We can fix our singleton by replacing the new method with the following: pub fn new<R, F: for<'s> FnOnce(Singleton<'s>) -> R>(closure: F) -> R { closure(Self { _marker: PhantomInvariantLifetime::new() }) } Now, in the context of the user-provided closure, the compiler can assume nothing about the lifetime of the input singleton. From the user's perspective, no two singletons can ever have the same lifetime. (This is actually proven formally in the GhostCell paper!) This design pattern of using an invariant marker lifetime combined with a constructor that executes a closure that is generic over said lifetime is the branded type pattern. djc: > This is the blog of a prominent lang-team member, so I think there's a decent chance something like it will eventually be accepted. Oh, I probably should have checked whose blog that was lol
internals.rust-lang.org
November 18, 2025 at 9:55 PM
[Discussion] Inversion of Control Ergonomics for Linear and Branded Types
djc: > Why not? (Not completely sure what you mean by "branded types".) Branded types are a design pattern described in the GhostCell paper I linked that can be used to implement singletons. A naive implementation of singletons in Rust might look like: pub struct Singleton<'s> { _marker: PhantomInvariantLifetime<'s>, } impl<'s> Singleton<'s> { pub fn new() -> Self { Self { _marker: PhantomInvariantLifetime::new() } } } However, a user could then write let x = Singleton::<'static>::new(); let y = Singleton::<'static>::new(); which would break the singleton invariant. (Even without the turbofish, the compiler could decide that `x` and `y` have the same type due to how unbounded lifetimes work.) We can fix our singleton by replacing the new method with the following: pub fn new<R, F: for<'s> FnOnce(Singleton<'s>) -> R>(closure: F) -> R { closure(Self { _marker: PhantomInvariantLifetime::new() }) } Now, in the context of the user-provided closure, the compiler can assume nothing about the lifetime of the input singleton. From the user's perspective, no two singletons can ever have the same lifetime. (This is actually proven formally in the GhostCell paper!) This design pattern of using an invariant marker lifetime combined with a constructor that executes a closure that is generic over said lifetime is the branded type pattern. djc: > This is the blog of a prominent lang-team member, so I think there's a decent chance something like it will eventually be accepted. Oh, I probably should have checked whose blog that was lol
internals.rust-lang.org
November 18, 2025 at 5:54 PM
[Discussion] Inversion of Control Ergonomics for Linear and Branded Types
djc: > Why not? (Not completely sure what you mean by "branded types".) Branded types are a design pattern described in the GhostCell paper I linked that can be used to implement singletons. A naive implementation of singletons in Rust might look like: pub struct Singleton<'s> { _marker: PhantomInvariantLifetime<'s>, } impl<'s> Singleton<'s> { pub fn new() -> Self { Self { _marker: PhantomInvariantLifetime::new() } } } However, a user could then write let x = Singleton::<'static>::new(); let y = Singleton::<'static>::new(); which would break the singleton invariant. (Even without the turbofish, the compiler could decide that `x` and `y` have the same type due to how unbounded lifetimes work.) We can fix our singleton by replacing the new method with the following: pub fn new<R, F: for<'s> FnOnce(Singleton<'s>) -> R>(closure: F) -> R { closure(Self { _marker: PhantomInvariantLifetime::new() }) } Now, in the context of the user-provided closure, the compiler can assume nothing about the lifetime of the input singleton. From the user's perspective, no two singletons can ever have the same lifetime. (This is actually proven formally in the GhostCell paper!) This design pattern of using an invariant marker lifetime combined with a constructor that executes a closure that is generic over said lifetime is the branded type pattern. djc: > This is the blog of a prominent lang-team member, so I think there's a decent chance something like it will eventually be accepted. Oh, I probably should have checked whose blog that was lol
internals.rust-lang.org
November 18, 2025 at 3:50 PM
Nooo~ I just ❤️looove❤️ ghostcell too lol
August 25, 2025 at 2:26 PM
only good rustcell is a ghostcell
August 25, 2025 at 1:25 PM