Added the issue link and a test description for non-promotable-static-ref.rs

This commit is contained in:
Aryan Dubey
2026-03-20 16:55:28 -04:00
parent a3409fecfa
commit 1eeba934ae
2 changed files with 3 additions and 1 deletions
@@ -1,3 +1,5 @@
//Test for https://github.com/rust-lang/rust/issues/52049
//Tests that a non-promotable temp variable cannot be used as a static reference.
fn foo(_: &'static u32) {}
fn unpromotable<T>(t: T) -> T { t }
@@ -1,5 +1,5 @@
error[E0716]: temporary value dropped while borrowed
--> $DIR/non-promotable-static-ref.rs:6:10
--> $DIR/non-promotable-static-ref.rs:8:10
|
LL | foo(&unpromotable(5u32));
| -----^^^^^^^^^^^^^^^^^^-- temporary value is freed at the end of this statement