logoalt Hacker News

MrBuddyCasino • today at 11:06 AM • 5 replies • view on HN

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.

Replies

afdbcreid • today at 11:38 AM

> 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).

1718627440 • today at 12:13 PM

Can someone ELI5 for people who don't know Rust (but e.g. C)?

➕ show 2 replies
high_na_euv • today at 11:10 AM

which compiler?

➕ show 1 reply
wg0 • today at 11:22 AM

DeepSeek v4.1 Flash thinks it should NOT compile. Whereas in reality it DOES compile which is why it is filed as a bug.

➕ show 1 reply