|
1 | 1 | // rustfmt-inline_attribute_width: 50 |
| 2 | +// rustfmt-edition: 2021 |
2 | 3 |
|
3 | 4 | #[cfg(feature = "alloc")] |
4 | 5 | use core::slice; |
@@ -129,3 +130,203 @@ use total_len_is_::_51______; |
129 | 130 | ) |
130 | 131 | )))] |
131 | 132 | use core::slice; |
| 133 | + |
| 134 | +fn foo() { |
| 135 | + // Literal expression |
| 136 | + #[cfg(feature = "len_is_50_____________")] |
| 137 | + 42; |
| 138 | + #[cfg(feature = "len_is_51______________")] |
| 139 | + 42; |
| 140 | + |
| 141 | + // Path expression |
| 142 | + #[cfg(feature = "len_is_50__")] |
| 143 | + some_variable; |
| 144 | + #[cfg(feature = "len_is_51___")] |
| 145 | + some_variable; |
| 146 | + |
| 147 | + // Block expression |
| 148 | + #[cfg(feature = "len_is_50_______________")] |
| 149 | + { |
| 150 | + let x = 2; |
| 151 | + }; |
| 152 | + #[cfg(feature = "len_is_51________________")] |
| 153 | + { |
| 154 | + let x = 2; |
| 155 | + }; |
| 156 | + |
| 157 | + // Operator expression |
| 158 | + #[cfg(feature = "len_is_50__________")] |
| 159 | + 1 + 2; |
| 160 | + #[cfg(feature = "len_is_51___________")] |
| 161 | + 1 + 2; |
| 162 | + |
| 163 | + // Tuple expression |
| 164 | + #[cfg(feature = "len_is_50")] |
| 165 | + (1, "two", 3.0); |
| 166 | + #[cfg(feature = "len_is_51_")] |
| 167 | + (1, "two", 3.0); |
| 168 | + |
| 169 | + // Array expression |
| 170 | + #[cfg(feature = "len_is_50______")] |
| 171 | + [1, 2, 3]; |
| 172 | + #[cfg(feature = "len_is_51_______")] |
| 173 | + [1, 2, 3]; |
| 174 | + |
| 175 | + // Struct expression |
| 176 | + #[cfg(feature = "len_is_50_____")] |
| 177 | + S { f: 1 }; |
| 178 | + #[cfg(feature = "len_is_51______")] |
| 179 | + S { f: 1 }; |
| 180 | + |
| 181 | + #[cfg(feature = "len_is_50______")] |
| 182 | + MyStruct { |
| 183 | + field1: 1, |
| 184 | + field2: 1, |
| 185 | + }; |
| 186 | + #[cfg(feature = "len_is_51_______")] |
| 187 | + MyStruct { |
| 188 | + field1: 1, |
| 189 | + field2: 1, |
| 190 | + }; |
| 191 | + |
| 192 | + // Enum variant expression |
| 193 | + #[cfg(feature = "len_is_50")] |
| 194 | + MyEnum::Variant; |
| 195 | + #[cfg(feature = "len_is_51_")] |
| 196 | + MyEnum::Variant; |
| 197 | + |
| 198 | + // Call expression |
| 199 | + #[cfg(feature = "len_is_50")] |
| 200 | + some_function(); |
| 201 | + #[cfg(feature = "len_is_51_")] |
| 202 | + some_function(); |
| 203 | + |
| 204 | + // Method call expression |
| 205 | + #[cfg(feature = "len_is_50")] |
| 206 | + object.method(); |
| 207 | + #[cfg(feature = "len_is_51_")] |
| 208 | + object.method(); |
| 209 | + |
| 210 | + // Field access expression |
| 211 | + #[cfg(feature = "len_is_50")] |
| 212 | + my_struct.field; |
| 213 | + #[cfg(feature = "len_is_51_")] |
| 214 | + my_struct.field; |
| 215 | + |
| 216 | + // Tuple indexing expression |
| 217 | + #[cfg(feature = "len_is_50_____")] |
| 218 | + my_tuple.0; |
| 219 | + #[cfg(feature = "len_is_51______")] |
| 220 | + my_tuple.0; |
| 221 | + |
| 222 | + // Indexing expression |
| 223 | + #[cfg(feature = "len_is_50____")] |
| 224 | + my_array[0]; |
| 225 | + #[cfg(feature = "len_is_51_____")] |
| 226 | + my_array[0]; |
| 227 | + |
| 228 | + // Range expression |
| 229 | + #[cfg(feature = "len_is_50___________")] |
| 230 | + 1..5; |
| 231 | + #[cfg(feature = "len_is_51____________")] |
| 232 | + 1..5; |
| 233 | + |
| 234 | + // If expression |
| 235 | + #[cfg(feature = "len_is_50__")] |
| 236 | + if condition { |
| 237 | + 1 |
| 238 | + }; |
| 239 | + #[cfg(feature = "len_is_51___")] |
| 240 | + if condition { |
| 241 | + 1 |
| 242 | + }; |
| 243 | + |
| 244 | + // Loop expression |
| 245 | + #[cfg(feature = "len_is_50__________")] |
| 246 | + loop { |
| 247 | + break; |
| 248 | + } |
| 249 | + #[cfg(feature = "len_is_51___________")] |
| 250 | + loop { |
| 251 | + break; |
| 252 | + } |
| 253 | + |
| 254 | + // While expression |
| 255 | + #[cfg(feature = "len_is_50____")] |
| 256 | + while cond { |
| 257 | + break; |
| 258 | + } |
| 259 | + #[cfg(feature = "len_is_51_____")] |
| 260 | + while cond { |
| 261 | + break; |
| 262 | + } |
| 263 | + |
| 264 | + // For expression |
| 265 | + #[cfg(feature = "len_is_50")] |
| 266 | + for i in 0..10 { |
| 267 | + break; |
| 268 | + } |
| 269 | + #[cfg(feature = "len_is_51_")] |
| 270 | + for i in 0..10 { |
| 271 | + break; |
| 272 | + } |
| 273 | + |
| 274 | + // Match expression |
| 275 | + #[cfg(feature = "len_is_50___")] |
| 276 | + match value { |
| 277 | + Pattern1 => 1, |
| 278 | + _ => 2, |
| 279 | + }; |
| 280 | + #[cfg(feature = "len_is_51____")] |
| 281 | + match value { |
| 282 | + Pattern1 => 1, |
| 283 | + _ => 2, |
| 284 | + }; |
| 285 | + |
| 286 | + // Return expression |
| 287 | + #[cfg(feature = "len_is_50_________")] |
| 288 | + return; |
| 289 | + #[cfg(feature = "len_is_51__________")] |
| 290 | + return; |
| 291 | + |
| 292 | + // Break expression |
| 293 | + #[cfg(feature = "len_is_50__________")] |
| 294 | + break; |
| 295 | + #[cfg(feature = "len_is_51___________")] |
| 296 | + break; |
| 297 | + |
| 298 | + // Continue expression |
| 299 | + #[cfg(feature = "len_is_50_______")] |
| 300 | + continue; |
| 301 | + #[cfg(feature = "len_is_51________")] |
| 302 | + continue; |
| 303 | + |
| 304 | + // Closure expression |
| 305 | + #[cfg(feature = "len_is_50______")] |
| 306 | + |x| x + 1; |
| 307 | + #[cfg(feature = "len_is_51_______")] |
| 308 | + |x| x + 1; |
| 309 | + |
| 310 | + // Async block expression |
| 311 | + #[cfg(feature = "len_is_50_________")] |
| 312 | + async { |
| 313 | + #[cfg(feature = "len_50__")] |
| 314 | + future.await; |
| 315 | + #[cfg(feature = "len_51___")] |
| 316 | + future.await; |
| 317 | + }; |
| 318 | + |
| 319 | + #[cfg(feature = "len_is_51__________")] |
| 320 | + async { |
| 321 | + #[cfg(feature = "len_50__")] |
| 322 | + future.await; |
| 323 | + #[cfg(feature = "len_51___")] |
| 324 | + future.await; |
| 325 | + }; |
| 326 | + |
| 327 | + // Try expression |
| 328 | + #[cfg(feature = "len_is_50___")] |
| 329 | + some_result?; |
| 330 | + #[cfg(feature = "len_is_51____")] |
| 331 | + some_result?; |
| 332 | +} |
0 commit comments