summaryrefslogtreecommitdiffstats
path: root/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.rs')
-rw-r--r--src/test/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.rs43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.rs b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.rs
deleted file mode 100644
index df2fef55d..000000000
--- a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/lifetime-update.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-#![feature(type_changing_struct_update)]
-#![allow(incomplete_features)]
-
-#[derive(Clone)]
-struct Machine<'a, S> {
- state: S,
- lt_str: &'a str,
- common_field: i32,
-}
-
-#[derive(Clone)]
-struct State1;
-#[derive(Clone)]
-struct State2;
-
-fn update_to_state2() {
- let s = String::from("hello");
- let m1: Machine<State1> = Machine {
- state: State1,
- lt_str: &s,
- //~^ ERROR `s` does not live long enough [E0597]
- // FIXME: The error here actually comes from line 34. The
- // span of the error message should be corrected to line 34
- common_field: 2,
- };
- // update lifetime
- let m3: Machine<'static, State1> = Machine {
- lt_str: "hello, too",
- ..m1.clone()
- };
- // update lifetime and type
- let m4: Machine<'static, State2> = Machine {
- state: State2,
- lt_str: "hello, again",
- ..m1.clone()
- };
- // updating to `static should fail.
- let m2: Machine<'static, State1> = Machine {
- ..m1
- };
-}
-
-fn main() {}