@@ -1295,10 +1295,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1295
1295
( GenericParamDefKind :: Type { .. } , GenericArg :: Infer ( inf) ) => {
1296
1296
self . fcx . ty_infer ( Some ( param) , inf. span ) . into ( )
1297
1297
}
1298
- ( & GenericParamDefKind :: Const { has_default } , GenericArg :: Infer ( inf) ) => {
1298
+ (
1299
+ & GenericParamDefKind :: Const { has_default, is_host_effect } ,
1300
+ GenericArg :: Infer ( inf) ,
1301
+ ) => {
1299
1302
let tcx = self . fcx . tcx ( ) ;
1300
1303
1301
- if has_default && tcx . has_attr ( param . def_id , sym :: rustc_host ) {
1304
+ if has_default && is_host_effect {
1302
1305
self . fcx . var_for_effect ( param)
1303
1306
} else {
1304
1307
self . fcx
@@ -1341,7 +1344,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1341
1344
self . fcx . var_for_def ( self . span , param)
1342
1345
}
1343
1346
}
1344
- GenericParamDefKind :: Const { has_default } => {
1347
+ GenericParamDefKind :: Const { has_default, is_host_effect } => {
1345
1348
if has_default {
1346
1349
// N.B. this is a bit of a hack. `infer_args` is passed depending on
1347
1350
// whether the user has provided generic args. E.g. for `Vec::new`
@@ -1352,7 +1355,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1352
1355
// it before falling back to default, such that a `const fn` such as
1353
1356
// `needs_drop::<()>` can still be called in const contexts. (if we defaulted
1354
1357
// instead of inferred, typeck would error)
1355
- if tcx . has_attr ( param . def_id , sym :: rustc_host ) {
1358
+ if is_host_effect {
1356
1359
return self . fcx . var_for_effect ( param) ;
1357
1360
} else if !infer_args {
1358
1361
return tcx
0 commit comments