Debian Codegraph @

tests/clone.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 // Take a look at the license at the top of the repository in the LICENSE file.
2
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/::Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#;
4
5 use glibrust-analyzer cargo glib 0.22.5 crate/::clonerust-analyzer cargo glib 0.22.5 clone/;
6
7 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
8 fn clonerust-analyzer cargo glib-macros 0.22.6 clone().() {
9 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(move || {});
10 let fut = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(async move {});
11 droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/drop().(fut);
12
13 let x = 1;
14 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(move || {
15 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {x}");
16 1
17 });
18
19 let x = 1;
20 let y = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("123");
21 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
22 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
23 #[strong]
24 v,
25 move || {
26 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {x} {y} {v}");
27 1
28 }
29 );
30
31 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
32 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
33 #[strong(rename_to = y)]
34 v,
35 move || {
36 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {y}");
37 1
38 }
39 );
40
41 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
42 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
43 #[strong(rename_to = y)]
44 Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::strong_countrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`]strong_count().(&v),
45 move || {
46 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {y}");
47 1
48 }
49 );
50
51 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
52 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
53 #[strong]
54 v,
55 move |a: i32, b: &str| {
56 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {a} {b} {v}");
57 1
58 }
59 );
60
61 let x = 1;
62 let y = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("123");
63 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
64 let fut = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
65 #[strong]
66 v,
67 async move {
68 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {x} {y} {v}");
69 1
70 }
71 );
72 droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/drop().(fut);
73
74 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
75 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
76 #[weak]
77 v,
78 move || {
79 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {v}");
80 }
81 );
82
83 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
84 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
85 #[weak]
86 v,
87 #[upgrade_or_else]
88 || Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#::<i32>,
89 move || {
90 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {v}");
91 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1)
92 }
93 );
94
95 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
96 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
97 #[weak]
98 v,
99 #[upgrade_or]
100 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#::<i32>,
101 move || {
102 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {v}");
103 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1)
104 }
105 );
106
107 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
108 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
109 #[weak]
110 v,
111 #[upgrade_or_default]
112 move || {
113 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {v}");
114 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1)
115 }
116 );
117
118 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
119 let w = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(2);
120 let x = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(3);
121 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
122 #[weak]
123 v,
124 #[weak]
125 w,
126 #[upgrade_or_else]
127 || {
128 let x: Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#<i32> = x;
129 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T, A>`][Deref]deref().x)
130 },
131 move || {
132 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {v} {w}");
133 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1)
134 }
135 );
136
137 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
138 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
139 #[weak]
140 v,
141 #[upgrade_or_panic]
142 move || {
143 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {v}");
144 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1)
145 }
146 );
147
148 let v = Rcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/Rc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc rc/impl#[`Rc<T>`]new().(1);
149 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
150 #[weak_allow_none]
151 v,
152 move || {
153 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {}", v.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().());
154 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(1)
155 }
156 );
157
158 let v = "123";
159 let _ = clonerust-analyzer cargo glib-macros 0.22.2 clone!!(
160 #[to_owned]
161 v,
162 move || {
163 printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("foo {v}");
164 1
165 }
166 );
167 }
168
169 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
•170 #[ignore]
171 fn clone_failuresrust-analyzer cargo glib-macros 0.22.6 clone_failures().() {
172 let t = trybuildrust-analyzer cargo trybuild 1.0.116 crate/::TestCasesrust-analyzer cargo trybuild 1.0.116 TestCases#::newrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]new().();
173
174 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/01-clone-empty.rs");
175 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/02-clone-no-move.rs");
176 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/03-clone-self-no-rename.rs");
177 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/04-clone-self-field-no-rename.rs");
178 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/05-clone-multiple-rename.rs");
179 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/06-clone-unsupported-property.rs");
180 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/07-clone-string-rename.rs");
181 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/08-clone-upgrade-or-else-bool.rs");
182 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/09-clone-upgrade-or-invalid.rs");
183 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/10-clone-unsupported-attribute.rs");
184 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/11-clone-watch.rs");
185 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/12-clone-duplicate-attribute.rs");
186 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/13-clone-no-attribute.rs");
187 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/14-clone-upgrade-or-else-first.rs");
188 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/15-clone-upgrade-or-else-with-param.rs");
189 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/16-clone-upgrade-or-else-async.rs");
190 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/17-clone-upgrade-or-panic-first.rs");
191 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/18-clone-async-no-move.rs");
192 t.compile_failrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]compile_fail().("tests/clone_compiletest/19-clone-block-no-parens.rs");
193 }
194
195 // Ensures that no warning are emitted if the return value is a unit tuple.
196 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
197 fn clone_unit_tuple_returnrust-analyzer cargo glib-macros 0.22.6 clone_unit_tuple_return().() {
198 let t = trybuildrust-analyzer cargo trybuild 1.0.116 crate/::TestCasesrust-analyzer cargo trybuild 1.0.116 TestCases#::newrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]new().();
199
200 t.passrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]pass().("tests/clone_compiletest/20-clone-unit-tuple-1.rs");
201 t.passrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]pass().("tests/clone_compiletest/21-clone-unit-tuple-2.rs");
202 t.passrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]pass().("tests/clone_compiletest/22-clone-unit-tuple-3.rs");
203 t.passrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]pass().("tests/clone_compiletest/23-clone-unit-tuple-4.rs");
204 t.passrust-analyzer cargo trybuild 1.0.116 impl#[TestCases]pass().("tests/clone_compiletest/24-clone-unit-tuple-5.rs");
205 }