@@ -451,13 +451,16 @@ pub macro debug_assert_matches($($arg:tt)*) {
451
451
/// ```
452
452
#[ macro_export]
453
453
#[ stable( feature = "matches_macro" , since = "1.42.0" ) ]
454
+ #[ allow_internal_unstable( hint_must_use, liballoc_internals) ]
454
455
#[ cfg_attr( not( test) , rustc_diagnostic_item = "matches_macro" ) ]
455
456
macro_rules! matches {
456
457
( $expression: expr, $pattern: pat $( if $guard: expr) ? $( , ) ?) => {
457
- match $expression {
458
- $pattern $( if $guard) ? => true ,
459
- _ => false
460
- }
458
+ $crate :: __export:: must_use( {
459
+ match $expression {
460
+ $pattern $( if $guard) ? => true ,
461
+ _ => false
462
+ }
463
+ } )
461
464
} ;
462
465
}
463
466
@@ -1010,8 +1013,12 @@ pub(crate) mod builtin {
1010
1013
#[ rustc_builtin_macro]
1011
1014
#[ macro_export]
1012
1015
macro_rules! format_args {
1013
- ( $fmt: expr) => { { /* compiler built-in */ } } ;
1014
- ( $fmt: expr, $( $args: tt) * ) => { { /* compiler built-in */ } } ;
1016
+ ( $fmt: expr) => {
1017
+ $crate :: __export:: must_use( { /* compiler built-in */ } )
1018
+ } ;
1019
+ ( $fmt: expr, $( $args: tt) * ) => {
1020
+ $crate :: __export:: must_use( { /* compiler built-in */ } )
1021
+ } ;
1015
1022
}
1016
1023
1017
1024
/// Same as [`format_args`], but can be used in some const contexts.
@@ -1081,8 +1088,12 @@ pub(crate) mod builtin {
1081
1088
#[ macro_export]
1082
1089
#[ rustc_diagnostic_item = "env_macro" ] // useful for external lints
1083
1090
macro_rules! env {
1084
- ( $name: expr $( , ) ?) => { { /* compiler built-in */ } } ;
1085
- ( $name: expr, $error_msg: expr $( , ) ?) => { { /* compiler built-in */ } } ;
1091
+ ( $name: expr $( , ) ?) => {
1092
+ $crate :: __export:: must_use( { /* compiler built-in */ } )
1093
+ } ;
1094
+ ( $name: expr, $error_msg: expr $( , ) ?) => {
1095
+ $crate :: __export:: must_use( { /* compiler built-in */ } )
1096
+ } ;
1086
1097
}
1087
1098
1088
1099
/// Optionally inspects an environment variable at compile time.
@@ -1112,7 +1123,9 @@ pub(crate) mod builtin {
1112
1123
#[ macro_export]
1113
1124
#[ rustc_diagnostic_item = "option_env_macro" ] // useful for external lints
1114
1125
macro_rules! option_env {
1115
- ( $name: expr $( , ) ?) => { { /* compiler built-in */ } } ;
1126
+ ( $name: expr $( , ) ?) => {
1127
+ $crate :: __export:: must_use( { /* compiler built-in */ } )
1128
+ } ;
1116
1129
}
1117
1130
1118
1131
/// Concatenates identifiers into one identifier.
@@ -1174,7 +1187,9 @@ pub(crate) mod builtin {
1174
1187
#[ rustc_builtin_macro]
1175
1188
#[ macro_export]
1176
1189
macro_rules! concat_bytes {
1177
- ( $( $e: literal) , + $( , ) ?) => { { /* compiler built-in */ } } ;
1190
+ ( $( $e: literal) , + $( , ) ?) => {
1191
+ $crate :: __export:: must_use( { /* compiler built-in */ } )
1192
+ } ;
1178
1193
}
1179
1194
1180
1195
/// Concatenates literals into a static string slice.
@@ -1193,10 +1208,13 @@ pub(crate) mod builtin {
1193
1208
/// assert_eq!(s, "test10btrue");
1194
1209
/// ```
1195
1210
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1211
+ #[ allow_internal_unstable( hint_must_use, liballoc_internals) ]
1196
1212
#[ rustc_builtin_macro]
1197
1213
#[ macro_export]
1198
1214
macro_rules! concat {
1199
- ( $( $e: expr) , * $( , ) ?) => { { /* compiler built-in */ } } ;
1215
+ ( $( $e: expr) , * $( , ) ?) => {
1216
+ $crate :: __export:: must_use( { /* compiler built-in */ } )
1217
+ } ;
1200
1218
}
1201
1219
1202
1220
/// Expands to the line number on which it was invoked.
@@ -1218,11 +1236,12 @@ pub(crate) mod builtin {
1218
1236
/// println!("defined on line: {current_line}");
1219
1237
/// ```
1220
1238
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1239
+ #[ allow_internal_unstable( hint_must_use, liballoc_internals) ]
1221
1240
#[ rustc_builtin_macro]
1222
1241
#[ macro_export]
1223
1242
macro_rules! line {
1224
1243
( ) => {
1225
- /* compiler built-in */
1244
+ $ crate :: __export :: must_use ( { /* compiler built-in */ } )
1226
1245
} ;
1227
1246
}
1228
1247
@@ -1257,11 +1276,12 @@ pub(crate) mod builtin {
1257
1276
/// assert_ne!(b, c);
1258
1277
/// ```
1259
1278
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1279
+ #[ allow_internal_unstable( hint_must_use, liballoc_internals) ]
1260
1280
#[ rustc_builtin_macro]
1261
1281
#[ macro_export]
1262
1282
macro_rules! column {
1263
1283
( ) => {
1264
- /* compiler built-in */
1284
+ $ crate :: __export :: must_use ( /* compiler built-in */ )
1265
1285
} ;
1266
1286
}
1267
1287
@@ -1282,11 +1302,12 @@ pub(crate) mod builtin {
1282
1302
/// println!("defined in file: {this_file}");
1283
1303
/// ```
1284
1304
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1305
+ #[ allow_internal_unstable( hint_must_use, liballoc_internals) ]
1285
1306
#[ rustc_builtin_macro]
1286
1307
#[ macro_export]
1287
1308
macro_rules! file {
1288
1309
( ) => {
1289
- /* compiler built-in */
1310
+ $ crate :: __export :: must_use ( /* compiler built-in */ )
1290
1311
} ;
1291
1312
}
1292
1313
@@ -1306,11 +1327,12 @@ pub(crate) mod builtin {
1306
1327
/// assert_eq!(one_plus_one, "1 + 1");
1307
1328
/// ```
1308
1329
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1330
+ #[ allow_internal_unstable( hint_must_use, liballoc_internals) ]
1309
1331
#[ rustc_builtin_macro]
1310
1332
#[ macro_export]
1311
1333
macro_rules! stringify {
1312
1334
( $( $t: tt) * ) => {
1313
- /* compiler built-in */
1335
+ $ crate :: __export :: must_use ( /* compiler built-in */ )
1314
1336
} ;
1315
1337
}
1316
1338
@@ -1351,7 +1373,9 @@ pub(crate) mod builtin {
1351
1373
#[ macro_export]
1352
1374
#[ cfg_attr( not( test) , rustc_diagnostic_item = "include_str_macro" ) ]
1353
1375
macro_rules! include_str {
1354
- ( $file: expr $( , ) ?) => { { /* compiler built-in */ } } ;
1376
+ ( $file: expr $( , ) ?) => {
1377
+ $crate :: __export:: must_use( { /* compiler built-in */ } )
1378
+ } ;
1355
1379
}
1356
1380
1357
1381
/// Includes a file as a reference to a byte array.
@@ -1391,7 +1415,9 @@ pub(crate) mod builtin {
1391
1415
#[ macro_export]
1392
1416
#[ cfg_attr( not( test) , rustc_diagnostic_item = "include_bytes_macro" ) ]
1393
1417
macro_rules! include_bytes {
1394
- ( $file: expr $( , ) ?) => { { /* compiler built-in */ } } ;
1418
+ ( $file: expr $( , ) ?) => {
1419
+ $crate :: __export:: must_use( { /* compiler built-in */ } )
1420
+ } ;
1395
1421
}
1396
1422
1397
1423
/// Expands to a string that represents the current module path.
@@ -1449,7 +1475,7 @@ pub(crate) mod builtin {
1449
1475
#[ macro_export]
1450
1476
macro_rules! cfg {
1451
1477
( $( $cfg: tt) * ) => {
1452
- /* compiler built-in */
1478
+ $ crate :: __export :: must_use ( /* compiler built-in */ )
1453
1479
} ;
1454
1480
}
1455
1481
0 commit comments