@@ -2052,6 +2052,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2052
2052
}
2053
2053
}
2054
2054
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.
2055
2058
#[ instrument( level = "debug" , skip( self ) ) ]
2056
2059
fn lower_const_path_to_const_arg (
2057
2060
& mut self ,
@@ -2068,6 +2071,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2068
2071
path,
2069
2072
ParamMode :: Optional ,
2070
2073
AllowReturnTypeNotation :: No ,
2074
+ // FIXME(min_generic_const_args): update for `fn foo() -> Bar<FOO<impl Trait>>` support
2071
2075
ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
2072
2076
None ,
2073
2077
) ;
@@ -2080,6 +2084,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2080
2084
let span = self . lower_span ( span) ;
2081
2085
2082
2086
// 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.
2083
2090
let def_id =
2084
2091
self . create_def ( parent_def_id, node_id, kw:: Empty , DefKind :: AnonConst , span) ;
2085
2092
let hir_id = self . lower_node_id ( node_id) ;
@@ -2141,6 +2148,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
2141
2148
path,
2142
2149
ParamMode :: Optional ,
2143
2150
AllowReturnTypeNotation :: No ,
2151
+ // FIXME(min_generic_const_args): update for `fn foo() -> Bar<FOO<impl Trait>>` support
2144
2152
ImplTraitContext :: Disallowed ( ImplTraitPosition :: Path ) ,
2145
2153
None ,
2146
2154
) ;
0 commit comments