@@ -1295,10 +1295,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12951295 ( GenericParamDefKind :: Type { .. } , GenericArg :: Infer ( inf) ) => {
12961296 self . fcx . ty_infer ( Some ( param) , inf. span ) . into ( )
12971297 }
1298- ( & GenericParamDefKind :: Const { has_default } , GenericArg :: Infer ( inf) ) => {
1298+ (
1299+ & GenericParamDefKind :: Const { has_default, is_host_effect } ,
1300+ GenericArg :: Infer ( inf) ,
1301+ ) => {
12991302 let tcx = self . fcx . tcx ( ) ;
13001303
1301- if has_default && tcx . has_attr ( param . def_id , sym :: rustc_host ) {
1304+ if has_default && is_host_effect {
13021305 self . fcx . var_for_effect ( param)
13031306 } else {
13041307 self . fcx
@@ -1341,7 +1344,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13411344 self . fcx . var_for_def ( self . span , param)
13421345 }
13431346 }
1344- GenericParamDefKind :: Const { has_default } => {
1347+ GenericParamDefKind :: Const { has_default, is_host_effect } => {
13451348 if has_default {
13461349 // N.B. this is a bit of a hack. `infer_args` is passed depending on
13471350 // whether the user has provided generic args. E.g. for `Vec::new`
@@ -1352,7 +1355,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13521355 // it before falling back to default, such that a `const fn` such as
13531356 // `needs_drop::<()>` can still be called in const contexts. (if we defaulted
13541357 // instead of inferred, typeck would error)
1355- if tcx . has_attr ( param . def_id , sym :: rustc_host ) {
1358+ if is_host_effect {
13561359 return self . fcx . var_for_effect ( param) ;
13571360 } else if !infer_args {
13581361 return tcx
0 commit comments