I tried this code (edition 2024):
#![allow(unused_braces)]
use std::pin::{Pin, pin};
struct HasDrop;
impl Drop for HasDrop {
fn drop(&mut self) {
println!("drop");
}
}
fn main() {
foo(pin!({ &HasDrop as *const HasDrop }));
}
fn foo(_: Pin<&mut *const HasDrop>) {
println!("foo");
}
In version 1.87.0, the code printed drop then foo. In version 1.88.0, the code printed foo then drop.
Since version 1.88.0, the macro expands to super let mut pinned = { &HasDrop };, which extends the lifetime of HasDrop to be as long as pinned. (Thanks to @dianne for figuring this out.)
The reason for the different behavior in version 1.87.0 is presumably due to the edition 2024 temporary scope change.
This issue won't be fixed by #145342, since this issue doesn't involve if let.
Presumably regressed in #139114 cc @m-ou-se
@rustbot labels +regression-from-stable-to-stable +A-pin +F-super_let
Meta
Reproducible on godbolt, with --edition=2024.
I tried this code (edition 2024):
In version 1.87.0, the code printed
dropthenfoo. In version 1.88.0, the code printedfoothendrop.Since version 1.88.0, the macro expands to
super let mut pinned = { &HasDrop };, which extends the lifetime ofHasDropto be as long aspinned. (Thanks to @dianne for figuring this out.)The reason for the different behavior in version 1.87.0 is presumably due to the edition 2024 temporary scope change.
This issue won't be fixed by #145342, since this issue doesn't involve
if let.Presumably regressed in #139114 cc @m-ou-se
@rustbot labels +regression-from-stable-to-stable +A-pin +F-super_let
Meta
Reproducible on godbolt, with
--edition=2024.