Open
Description
I tried this code:
#[derive(Clone)]
struct Foo<'a>(&'a ());
// Uncomment this line and the code stops compiling
//impl Copy for Foo<'static> {}
struct Bar<'a>(Foo<'a>);
fn do_thing<'a>(b: Bar<'a>) {
drop(b.0);
}
I expected to see this happen: Uncommenting the line in question does not break the code, as implementing Copy
should not be a breaking change
Instead, this happened:
error: lifetime may not live long enough
--> src/lib.rs:10:10
|
9 | fn do_thing<'a>(b: Bar<'a>) {
| -- lifetime `'a` defined here
10 | drop(b.0);
| ^^^ copying this value requires that `'a` must outlive `'static`
Meta
Regressed in 1.42 according to Godbolt.
@rustbot label A-borrow-checker A-lifetimes A-traits T-types regression-from-stable-to-stable