derive(Clone) with HRTB and GAT #89188
Labels
A-GATs
Area: Generic associated types (GATs)
C-bug
Category: This is a bug.
F-generic_associated_types
`#![feature(generic_associated_types)]` a.k.a. GATs
I tried this code:
I expected to see this happen: it compiles
Instead, this happened: it fails to compile, with
Removing
#[derive(Clone)]
makes it compile.A bit longer playground demonstrating what this code snippet can be used for:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a20f6a74ae1c1e8b2838aa428beee1fe
I'm not an experienced user of HRTBs (nor GATs, obviously). What I'm trying to express is that the data borrowed by
Shim
does not outlive theShimMethod
call. I think the HRTB is the right way to express that, and it all compiles and works without the#[derive(Clone)]
, but I'm a bit unsure if I'm really doing something wrong and stupid and the compiler fails to catch it because potential GAT bugs 🤷Anyway, it seems there is something fishy about the
derive
code here..Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: