| ... | ... | @@ -845,11 +845,15 @@ pub const Block = struct { |
| 845 | 845 | } |
| 846 | 846 | }; |
| 847 | 847 | |
| 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. |
| 848 | 850 | const ComptimeReason = union(enum) { |
| 849 | 851 | /// Evaluating at comptime for a reason in the `std.zig.SimpleComptimeReason` enum. |
| 850 | 852 | simple: std.zig.SimpleComptimeReason, |
| 851 | 853 | |
| 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. |
| 853 | 857 | /// The format string looks like "foo '{}' bar", where "{}" is the comptime-only type. |
| 854 | 858 | /// We will then explain why this type is comptime-only. |
| 855 | 859 | comptime_only: struct { |
| ... | ... | @@ -885,12 +889,14 @@ const ComptimeReason = union(enum) { |
| 885 | 889 | } |
| 886 | 890 | }; |
| 887 | 891 | |
| 892 | /// Represents the reason a `Block` is being evaluated at comptime. |
| 888 | 893 | const BlockComptimeReason = union(enum) { |
| 889 | 894 | /// This block inherits being comptime-only from the `inlining` call site. |
| 890 | 895 | inlining_parent, |
| 891 | 896 | |
| 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`. |
| 893 | 898 | reason: struct { |
| 899 | /// The source location which this reason originates from. `r` is reported here. |
| 894 | 900 | src: LazySrcLoc, |
| 895 | 901 | r: ComptimeReason, |
| 896 | 902 | }, |