summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/issue-46471.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/issue-46471.rs')
-rw-r--r--tests/ui/borrowck/issue-46471.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/ui/borrowck/issue-46471.rs b/tests/ui/borrowck/issue-46471.rs
new file mode 100644
index 000000000..8922005d2
--- /dev/null
+++ b/tests/ui/borrowck/issue-46471.rs
@@ -0,0 +1,7 @@
+fn foo() -> &'static u32 {
+ let x = 0;
+ &x
+ //~^ ERROR cannot return reference to local variable `x` [E0515]
+}
+
+fn main() { }