range: make sure the generic in an integer
This commit is contained in:
@@ -4,6 +4,12 @@ const std = @import("std");
|
||||
|
||||
/// Non-inclusive range type over `T`.
|
||||
pub fn Range(comptime T: type) type {
|
||||
switch (@typeInfo(T)) {
|
||||
.int => {},
|
||||
else => {
|
||||
@compileError("Range(T) only support integer ranges");
|
||||
},
|
||||
}
|
||||
return struct {
|
||||
/// Range start.
|
||||
start: T,
|
||||
|
||||
Reference in New Issue
Block a user