I'm at the point of struggling with this bug where I can't tell if it's a bug with or not, but Rust Playground has the error

expected TraitTwo
found TraitTwo

play.rust-lang.org/?version=st

which seems.. nonsensical.

@Eden I gave TraitTwo an explicit lifetime, which still doesn't compile but I think may illuminate that error message a little bit more:

expected TraitTwo<'_>
found TraitTwo<'a>

@balrogboogie so I think it's to do with callee and caller lifetimes, which fits with that information, but I think Rust could be a lot clearer what it should be

Follow

@federicomena @balrogboogie will do, been trying to figure out if I was just being silly first!

@federicomena @balrogboogie It's so you can implement it for a non DataObject, but still guarantee get_ref will return a DataObject when used.

Was just using it when another trait was calling get_ref and I wanted to make it clearer what it'd get back

@federicomena @balrogboogie I'm not, no. Honestly I think at this point I should've moved to using a generic function instead of traits that sit upon a single generic struct

@federicomena @balrogboogie it turns out only some of it! Can't get it working with the full trait yet, but I'm trying different lifetimes..

Sign in to participate in the conversation
weirder.earth

A community that skews thoughtful and weird. Everyone who abides by the code of conduct is welcome, thoughtful weirdos most of all! :)