File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -845,11 +845,15 @@ pub const Block = struct {
845845 }
846846};
847847
848+ /// Represents the reason we are resolving a value or evaluating code at comptime.
849+ /// Most reasons are represented by a `std.zig.SimpleComptimeReason`, which provides a plain message.
848850const ComptimeReason = union(enum) {
849851 /// Evaluating at comptime for a reason in the `std.zig.SimpleComptimeReason` enum.
850852 simple: std.zig.SimpleComptimeReason,
851853
852- /// Evaluating at comptime because of a comptime-only type.
854+ /// Evaluating at comptime because of a comptime-only type. This field is separate so that
855+ /// the type in question can be included in the error message. AstGen could never emit this
856+ /// reason, because it knows nothing of types.
853857 /// The format string looks like "foo '{}' bar", where "{}" is the comptime-only type.
854858 /// We will then explain why this type is comptime-only.
855859 comptime_only: struct {
@@ -885,12 +889,14 @@ const ComptimeReason = union(enum) {
885889 }
886890};
887891
892+ /// Represents the reason a `Block` is being evaluated at comptime.
888893const BlockComptimeReason = union(enum) {
889894 /// This block inherits being comptime-only from the `inlining` call site.
890895 inlining_parent,
891896
892- /// This block is comptime for the given reason at the given source location .
897+ /// Comptime evaluation began somewhere in the current function for a given `ComptimeReason` .
893898 reason: struct {
899+ /// The source location which this reason originates from. `r` is reported here.
894900 src: LazySrcLoc,
895901 r: ComptimeReason,
896902 },
You can’t perform that action at this time.
0 commit comments