File tree 1 file changed +5
-1
lines changed
src/librustc_metadata/rmeta
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1360,11 +1360,15 @@ impl<'a, 'tcx> CrateMetadata {
1360
1360
}
1361
1361
}
1362
1362
1363
+ // This replicates some of the logic of the crate-local `is_const_fn_raw` query, because we
1364
+ // don't serialize constness for tuple variant and tuple struct constructors.
1363
1365
fn is_const_fn_raw ( & self , id : DefIndex ) -> bool {
1364
1366
let constness = match self . kind ( id) {
1365
1367
EntryKind :: Method ( data) => data. decode ( self ) . fn_data . constness ,
1366
1368
EntryKind :: Fn ( data) => data. decode ( self ) . constness ,
1367
- // Some intrinsics can be const fn
1369
+ // Some intrinsics can be const fn. While we could recompute this (at least until we
1370
+ // stop having hardcoded whitelists and move to stability attributes), it seems cleaner
1371
+ // to treat all const fns equally.
1368
1372
EntryKind :: ForeignFn ( data) => data. decode ( self ) . constness ,
1369
1373
EntryKind :: Variant ( ..) | EntryKind :: Struct ( ..) => hir:: Constness :: Const ,
1370
1374
_ => hir:: Constness :: NotConst ,
You can’t perform that action at this time.
0 commit comments