1
Fork 0

Auto merge of #113376 - Nilstrieb:pointer-coercions-are-not-casts-because-that-sounds-way-to-general-aaaa, r=oli-obk

Rename `adjustment::PointerCast` and variants using it to `PointerCoercion`

It makes it sounds like the `ExprKind` and `Rvalue` are supposed to represent all pointer related casts, when in reality their just used to share a little enum variants. Make it clear there these are only coercions and that people who see this and think "why are so many pointer related casts not in these variants" aren't insane.

This enum was added in #59987. I'm not sure whether the variant sharing is actually worth it, but this at least makes it less confusing.

r? oli-obk
This commit is contained in:
bors 2023-07-08 13:48:30 +00:00
commit 9bb6fbe261
85 changed files with 214 additions and 185 deletions

View file

@ -221,7 +221,7 @@ fn recurse_build<'tcx>(
maybe_supported_error(GenericConstantTooComplexSub::AdtNotSupported(node.span))?
}
// dont know if this is correct
ExprKind::Pointer { .. } => {
ExprKind::PointerCoercion { .. } => {
error(GenericConstantTooComplexSub::PointerNotSupported(node.span))?
}
ExprKind::Yield { .. } => {
@ -324,7 +324,7 @@ impl<'a, 'tcx> IsThirPolymorphic<'a, 'tcx> {
| thir::ExprKind::Cast { .. }
| thir::ExprKind::Use { .. }
| thir::ExprKind::NeverToAny { .. }
| thir::ExprKind::Pointer { .. }
| thir::ExprKind::PointerCoercion { .. }
| thir::ExprKind::Loop { .. }
| thir::ExprKind::Let { .. }
| thir::ExprKind::Match { .. }