1 trait StaticDefaultRef: 'static {
2 fn default_ref() -> &'static Self;
5 impl StaticDefaultRef for str {
6 fn default_ref() -> &'static str {
11 fn into_impl(x: &str) -> &(impl ?Sized + AsRef<str> + StaticDefaultRef + '_) {
15 fn extend_lifetime<'a>(x: &'a str) -> &'static str {
17 helper(|_| t) //~ ERROR lifetime may not live long enough
20 fn helper<T: ?Sized + AsRef<str> + StaticDefaultRef>(f: impl FnOnce(&T) -> &T) -> &'static str {
21 f(T::default_ref()).as_ref()
27 let x = String::from("Hello World?");
28 r = extend_lifetime(&x);