rust/compiler/rustc_hir_analysis/src/collect
Guillaume Gomez c21de3c91e
Rollup merge of #126228 - BoxyUwU:nested_repeat_expr_generics, r=compiler-errors
Provide correct parent for nested anon const

Fixes #126147

99% of this PR is just comments explaining what the issue is.

`tcx.parent(` and `hir().get_parent_item(` give different results as the hir owner for all the hir of anon consts is the enclosing function. I didn't attempt to change that as being a hir owner requires a `DefId` and long term we want to stop creating anon consts' `DefId`s before hir ty lowering.

So i just opted to change `generics_of` to use `tcx.parent` to get the parent for `AnonConst`'s. I'm not entirely sure about this being what we want, it does seem weird that we have two ways of getting the parent of an `AnonConst` and they both give different results.

Alternatively we could just go ahead and make `const_evaluatable_unchecked` a hard error and stop providing generics to repeat exprs. Then this isn't an issue. (The FCW has been around for almost 4 years now)

r? ````@compiler-errors````
2024-06-12 15:44:58 +02:00
..
type_of Require any function with a tait in its signature to actually constrain a hidden type 2024-06-12 08:53:59 +00:00
generics_of.rs Correct parent for nested anon consts 2024-06-10 14:32:50 +01:00
item_bounds.rs Give EarlyBinder a tcx parameter 2024-05-26 20:04:05 -04:00
predicates_of.rs Basic removal of `Ty` from places (boring) 2024-06-05 22:25:38 +01:00
resolve_bound_vars.rs Handle safety keyword for extern block inner items 2024-06-04 14:19:42 -03:00
type_of.rs Revert "Create const block DefIds in typeck instead of ast lowering" 2024-06-07 08:33:58 +00:00