Give ReturnExpr a target only when initialization is in-place (#6570)

Also clarify and enforce that `ConversionTarget::init_id` is used only
as storage for in-place initialization, and correspondingly rename it to
`storage_id`.
This commit is contained in:
Geoff Romer
2026-01-13 01:20:15 +00:00
committed by GitHub
parent 93c7c9ad96
commit e1ec8d42d1
194 changed files with 575 additions and 556 deletions
+1 -1
View File
@@ -133,7 +133,7 @@ fn F() -> i32 {
// CHECK:STDOUT: %Int.as.Copy.impl.Op.call: init %i32 = call %bound_method.loc17_10.2(%.loc17_10.2)
// CHECK:STDOUT: %DestroyOp.bound: <bound method> = bound_method %n.var, constants.%DestroyOp
// CHECK:STDOUT: %DestroyOp.call: init %empty_tuple.type = call %DestroyOp.bound(%n.var)
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return.param
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @DestroyOp(%self.param: %i32) = "no_op";
+1 -1
View File
@@ -168,7 +168,7 @@ fn F() -> i32 {
// CHECK:STDOUT: %DestroyOp.call.loc17: init %empty_tuple.type = call %DestroyOp.bound.loc17(%p.var)
// CHECK:STDOUT: %DestroyOp.bound.loc16: <bound method> = bound_method %n.var, constants.%DestroyOp.b0ebf8.2
// CHECK:STDOUT: %DestroyOp.call.loc16: init %empty_tuple.type = call %DestroyOp.bound.loc16(%n.var)
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call to %return.param
// CHECK:STDOUT: return %Int.as.Copy.impl.Op.call
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @DestroyOp.loc17(%self.param: %ptr.235) = "no_op";
+1 -1
View File
@@ -84,6 +84,6 @@ fn ConstMismatch(p: const {}*) -> const ({}*) {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %p.ref: %ptr.bf9 = name_ref p, %p
// CHECK:STDOUT: %.loc23: %const.987 = converted %p.ref, <error> [concrete = <error>]
// CHECK:STDOUT: return <error> to %return.param
// CHECK:STDOUT: return <error>
// CHECK:STDOUT: }
// CHECK:STDOUT:
+1 -1
View File
@@ -111,6 +111,6 @@ fn F(p: const (const (const i32*)*)) -> const i32 {
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @const.as.Copy.impl.Op(constants.%Copy.facet.de4) [concrete = constants.%const.as.Copy.impl.Op.specific_fn]
// CHECK:STDOUT: %bound_method.loc17_10.2: <bound method> = bound_method %.loc17_10.2, %specific_fn
// CHECK:STDOUT: %const.as.Copy.impl.Op.call: init %const.20a = call %bound_method.loc17_10.2(%.loc17_10.2)
// CHECK:STDOUT: return %const.as.Copy.impl.Op.call to %return.param
// CHECK:STDOUT: return %const.as.Copy.impl.Op.call
// CHECK:STDOUT: }
// CHECK:STDOUT:
+2 -2
View File
@@ -129,7 +129,7 @@ fn ConstPtr(p: const i32*) -> (const i32)* {
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @ptr.as.Copy.impl.Op(constants.%i32) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn.101]
// CHECK:STDOUT: %bound_method.loc16_10.2: <bound method> = bound_method %p.ref, %specific_fn
// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.235 = call %bound_method.loc16_10.2(%p.ref)
// CHECK:STDOUT: return %ptr.as.Copy.impl.Op.call to %return.param
// CHECK:STDOUT: return %ptr.as.Copy.impl.Op.call
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: fn @ConstPtr(%p.param: %ptr.36b) -> %ptr.36b {
@@ -140,6 +140,6 @@ fn ConstPtr(p: const i32*) -> (const i32)* {
// CHECK:STDOUT: %specific_fn: <specific function> = specific_function %impl.elem0, @ptr.as.Copy.impl.Op(constants.%const.20a) [concrete = constants.%ptr.as.Copy.impl.Op.specific_fn.bcd]
// CHECK:STDOUT: %bound_method.loc20_10.2: <bound method> = bound_method %p.ref, %specific_fn
// CHECK:STDOUT: %ptr.as.Copy.impl.Op.call: init %ptr.36b = call %bound_method.loc20_10.2(%p.ref)
// CHECK:STDOUT: return %ptr.as.Copy.impl.Op.call to %return.param
// CHECK:STDOUT: return %ptr.as.Copy.impl.Op.call
// CHECK:STDOUT: }
// CHECK:STDOUT: