Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardRustStatic bound semanticsSingle-choice MCQ

A function is bounded `fn f<T: 'static>(x: T)`. A caller passes `&local` where `local` is a stack variable. Why is this rejected, and what does the `T: 'static` bound actually constrain?

fn f<T: 'static>(x: T) { /* ... */ } fn caller() { let local = String::from("hi"); f(&local); // rejected }