Closed
Description
On beta and nightly, the following code is correctly rejected since the impl Trait
in return position gets 'static
by default. However, on the current stable (1.38), it was wrongfully accepted. Replacing the trait object with another type seems to make the error appear on all versions.
use std::any::Any;
fn drain_dyn(v: &mut Vec<Box<dyn Any>>) -> impl Iterator<Item = Box<dyn Any>> {
v.drain()
}
This has already been fixed, so I'm not sure what the procedure is here. Observed in the crater run for 1.39 (#64962) and split out from #65527.
Metadata
Metadata
Assignees
Labels
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcHigh priorityRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the language team, which will review and decide on the PR/issue.Performance or correctness regression from stable to beta.