chiark / gitweb /
PieceTrait: make it 'static
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 8 Mar 2021 23:57:06 +0000 (23:57 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 8 Mar 2021 23:57:18 +0000 (23:57 +0000)
We don't want any non-'static and this is needed for dyn_upcast which
we want.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/gamestate.rs
src/hidden.rs

index 89450282e77ba3fcf784de590ca65cdb8618279d..ea6ca7e939cf525e15fe0465b62796fe652baf4e 100644 (file)
@@ -132,7 +132,7 @@ pub struct UoDescription {
 }
 
 #[typetag::serde] // usual variable: p
-pub trait PieceTrait: OutlineTrait + Send + Debug {
+pub trait PieceTrait: OutlineTrait + Send + Debug + 'static {
   /// by convention, occult face is nfaces-1
   // xxx this is no good, we need a central definition of the occult
   // face to avoid weird behaviour with buggy gamespecs
@@ -365,7 +365,7 @@ impl PieceRenderInstructions {
 
   #[throws(IE)]
   pub fn make_defs<'p,P>(&self, gpc: &GPiece, p: &P) -> Html
-    where P:Borrow<dyn PieceTrait + 'p>
+    where P:Borrow<dyn PieceTrait>
   {
     #[throws(IE)]
     fn inner(pri: &PieceRenderInstructions, gpc: &GPiece, p: &dyn PieceTrait)
@@ -394,7 +394,7 @@ impl PieceRenderInstructions {
   }
 
   pub fn describe<'p,P>(&self, gpc: &GPiece, p: &P) -> Html
-    where P:Borrow<dyn PieceTrait + 'p>
+    where P:Borrow<dyn PieceTrait>
   {
     fn inner(pri: &PieceRenderInstructions, gpc: &GPiece, p: &dyn PieceTrait)
              -> Html
index d63002f8589e52875d7830477a081a903d728a04..037c358022b4542c7748872a2aacfea5e19ce974 100644 (file)
@@ -445,7 +445,7 @@ pub use vpid::{PerPlayerIdMap, NotchNumber, Notch, Notches};
 // ========== public entrypoints ==========
 
 /// None => do not render at all
-pub fn piece_pri<'p, P:Borrow<dyn PieceTrait + 'p>>(
+pub fn piece_pri<P:Borrow<dyn PieceTrait>>(
   occults: &GameOccults,
   player: PlayerId, gpl: &mut GPlayer,
   piece: PieceId, gpc: &GPiece, p: &P,