From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/issues/issue-30438-a.rs | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 src/test/ui/issues/issue-30438-a.rs (limited to 'src/test/ui/issues/issue-30438-a.rs') diff --git a/src/test/ui/issues/issue-30438-a.rs b/src/test/ui/issues/issue-30438-a.rs deleted file mode 100644 index 0d4eb796a..000000000 --- a/src/test/ui/issues/issue-30438-a.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Original regression test for Issue #30438. - -use std::ops::Index; - -struct Test<'a> { - s: &'a String -} - -impl <'a> Index for Test<'a> { - type Output = Test<'a>; - fn index(&self, _: usize) -> &Self::Output { - return &Test { s: &self.s}; - //~^ ERROR: cannot return reference to temporary value - } -} - -fn main() { - let s = "Hello World".to_string(); - let test = Test{s: &s}; - let r = &test[0]; - println!("{}", test.s); // OK since test is valid - println!("{}", r.s); // Segfault since value pointed by r has already been dropped -} -- cgit v1.2.3