error[E0597]: borrowed value does not live long enough --> $DIR/const-ptr-nonnull.rs:4:37 | LL | let x: &'static NonNull = &(NonNull::dangling()); | ^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough ... LL | } | - temporary value only lives until here | = note: borrowed value must be valid for the static lifetime... error[E0597]: borrowed value does not live long enough --> $DIR/const-ptr-nonnull.rs:9:37 | LL | let x: &'static NonNull = &(non_null.cast()); | ^^^^^^^^^^^^^^^^^ temporary value does not live long enough LL | LL | } | - temporary value only lives until here | = note: borrowed value must be valid for the static lifetime... error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0597`.