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

which seems.. nonsensical.

@Eden I get a
/root/ line 8: 7 Killed timeout --signal=KILL ${timeout} "$@"

...playground bug?

but probably unrelated

@grainloom yeah I get that for nightly which is weiiird. Works for stable though

@Eden I got the same for stable, but I might have messed something up...

@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

@Eden @balrogboogie Please submit a bug! The compiler people are super interested in improving error messages.

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

@Eden @balrogboogie maybe this code is a reduction of a larger problem... but why do you need something like get_ref() if you already have &self?

@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

@Eden @balrogboogie hmmm, are you implementing up/downcasting or something like that?

@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..

@Eden alas that link just goes to hello world for me :-S

Sign in to participate in the conversation

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