The heart of the matter:
struct Q<T: 'static>(Option<T>);
impl<T: 'static> Drop for Q<T> {
fn drop(&mut self) {
// Code in here has access to a non-'static &String
// but assumes that it's a &'static String
}
}
fn main() {
let l = String::new();
let mut q = Q(None);
q.0 = Some(&l);
}
I wonder if the certified compiler for safety critical uses (edit: Ferrocene) has the same issue.Can someone ELI5 for people who don't know Rust (but e.g. C)?
> I wonder if the certified compiler for safety critical uses has the same issue.
It uses the same code, so yes.
(Although I don't know what are their guidelines, it might be that they require avoiding code relying on implied bounds, for example).
DeepSeek v4.1 Flash thinks it should NOT compile. Whereas in reality it DOES compile which is why it is filed as a bug.
https://github.com/rust-lang/rust/issues/164250#issuecomment... seems to imply it's broader, something along the lines of "type parameter lifetimes are not checked".
I doubt my read is fully accurate, there's probably a relatively small niche where it occurs. But it does seem to be a rather glaring gap, for how long it has existed.
(All languages have this, this is not a rust bashing. Rust seems to do quite well for how complex it is)