@@ -2052,6 +2052,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20522052 }
20532053 }
20542054
2055+ /// Used when lowering a type argument that turned out to actually be a const argument.
2056+ ///
2057+ /// Only use for that purpose since otherwise it will create a duplicate def.
20552058 #[ instrument( level = "debug" , skip( self ) ) ]
20562059 fn lower_const_path_to_const_arg (
20572060 & mut self ,
@@ -2068,6 +2071,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20682071 path,
20692072 ParamMode :: Optional ,
20702073 AllowReturnTypeNotation :: No ,
2074+ // FIXME(min_generic_const_args): update for `fn foo() -> Bar<FOO<impl Trait>>` support
20712075 ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
20722076 None ,
20732077 ) ;
@@ -2080,6 +2084,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
20802084 let span = self . lower_span ( span) ;
20812085
20822086 // Add a definition for the in-band const def.
2087+ // We're lowering a const argument that was originally thought to be a type argument,
2088+ // so the def collector didn't create the def ahead of time. That's why we have to do
2089+ // it here.
20832090 let def_id =
20842091 self . create_def ( parent_def_id, node_id, kw:: Empty , DefKind :: AnonConst , span) ;
20852092 let hir_id = self . lower_node_id ( node_id) ;
@@ -2141,6 +2148,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
21412148 path,
21422149 ParamMode :: Optional ,
21432150 AllowReturnTypeNotation :: No ,
2151+ // FIXME(min_generic_const_args): update for `fn foo() -> Bar<FOO<impl Trait>>` support
21442152 ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
21452153 None ,
21462154 ) ;
0 commit comments